//! @brief Initializes the application. //! //! It will open the main window and connect default to server or open the connect window. bool UpdaterApp::OnInit() { //this triggers the Cli Parser amongst other stuff if (!wxApp::OnInit()) return false; assert( m_logstream_target ); wxLogStream* m_log_stream = new wxLogStream( m_logstream_target ); m_log_stream->SetLogLevel( wxLOG_Trace ); wxLog::SetActiveTarget( m_log_stream ); wxLogMessage( _T("m_exe_to_update ") + m_exe_to_update); wxLogMessage( _T("m_version ") + m_version); #if wxUSE_ON_FATAL_EXCEPTION wxHandleFatalExceptions( true ); #endif //this needs to called _before_ mainwindow instance is created wxInitAllImageHandlers(); //TODO needed? wxImage::AddHandler(new wxPNGHandler); wxFileSystem::AddHandler(new wxZipFSHandler); wxSocketBase::Initialize(); m_timer->Start( TIMER_INTERVAL ); if( m_version == _T("-1") ) m_version = GetLatestVersion(); m_updater_window = new UpdaterMainwindow( m_version ); m_updater_window->Show( true ); SetTopWindow( m_updater_window ); return Updater().StartUpdate( m_version, m_exe_to_update ); }
void FAndroidTargetSettingsCustomization::OnDepthBufferPreferenceModified() { check(SetupForPlatformAttribute.Get() == true); FManifestUpdateHelper Updater(GameManifestPath); const FString PrefixTag(TEXT("meta-data android:name=\"com.epicgames.ue4.GameActivity.DepthBufferPreference\" android:value=\"")); const FString ClosingQuote(TEXT("\"")); const FString NewDepthBufferPreferenceString = DepthBufferPreferenceToString(GetDefault<UAndroidRuntimeSettings>()->DepthBufferPreference); // First check if the key needs to be created if (!Updater.HasKey(PrefixTag)) { // Add the key for value replacement const FString CloseActivityTag(TEXT("</activity")); const FString CloseBracket(TEXT(">")); const FString NewKeyString(TEXT(">\n\t\t<meta-data android:name=\"com.epicgames.ue4.GameActivity.DepthBufferPreference\" android:value=\"0\"/")); Updater.ReplaceKey(CloseActivityTag, CloseBracket, NewKeyString); } Updater.ReplaceKey(PrefixTag, ClosingQuote, NewDepthBufferPreferenceString); Updater.Finalize(GameManifestPath); }
void frmSelect::init(QDate date) { this->setWindowFlags(Qt::Tool); this->setWindowModality(Qt::ApplicationModal); DateDoc = date; ui->all_sotr->setChecked(true); ui->all_sotr->setVisible(false); ui->all_ostatki->setVisible(false); Updater(); }
void FAndroidTargetSettingsCustomization::OnAppIDModified() { check(SetupForPlatformAttribute.Get() == true); FManifestUpdateHelper Updater(GameGooglePlayAppIDPath); const FString AppIDTag(TEXT("name=\"app_id\">")); const FString ClosingTag(TEXT("</string>")); const FString NewIDString = GetDefault<UAndroidRuntimeSettings>()->GamesAppID; Updater.ReplaceKey(AppIDTag, ClosingTag, NewIDString); Updater.Finalize(GameGooglePlayAppIDPath); }
void FAndroidTargetSettingsCustomization::OnOrientationModified() { check(SetupForPlatformAttribute.Get() == true); FManifestUpdateHelper Updater(GameManifestPath); const FString OrientationTag(TEXT("android:screenOrientation=\"")); const FString ClosingQuote(TEXT("\"")); const FString NewOrientationString = OrientationToString(GetDefault<UAndroidRuntimeSettings>()->Orientation); Updater.ReplaceKey(OrientationTag, ClosingQuote, NewOrientationString); Updater.Finalize(GameManifestPath); }
int main(int argc, char *argv[]) { QString APP_ID = (APP_DEBUG) ? UNIQUIE_DEBUG_ID : UNIQUE_ID; SingleApplication App(argc, argv,APP_ID); //check if there is another process running if(App.AlreadyExists()) { App.SendInstanceMessage(QString(APP_MESSAGE_SHOWAPP)); return 0; } WriteAppInfo(APP_LOCAL_VERSION_FILENAME,QString::number(APP_MAJOR_VERSION),QString::number(APP_MINOR_VERSION)); CheckUpdaterFiles(APP_UPDATER); bool Args = false; if(!APP_DEBUG) { if(argc < 2) { Args = true; QString UpdaterPath = QApplication::applicationDirPath() + QDir::separator() + APP_UPDATER; // Check if an updater exists QFile Updater(UpdaterPath); if(!Updater.exists()) { if(QMessageBox::critical(0,"Error","Cannot find Ouroboros Updater.exe, please re-install Ouroboros") == QMessageBox::Ok) return 0; } QProcess::startDetached(UpdaterPath,QStringList()); } } if(!Args) { //run the application Ouroboros Window; Window.show(); Window.raise(); Window.activateWindow(); App.connect(&App,SIGNAL(MessageAvailable(QStringList)),&Window,SLOT(RecievedMessageFromInstance(QStringList))); return App.exec(); } return 0; }
inline void gen_vector_copy(const VectorSrc& src, VectorDest& dest, bool with_reset) { // Works only with dense vectors as dest !!!!! (source could be sparse) // Needs vector inserter BOOST_STATIC_ASSERT((boost::is_same<typename ashape::ashape<VectorSrc>::type, typename ashape::ashape<VectorDest>::type>::value)); MTL_THROW_IF(size(src) != size(dest), incompatible_size()); if (with_reset) detail::zero_with_sparse_src(dest, typename traits::category<VectorSrc>::type()); typename traits::index<VectorSrc>::type index(src); typename traits::const_value<VectorSrc>::type value(src); typedef typename traits::range_generator<tag::nz, VectorSrc>::type cursor_type; for (cursor_type cursor = begin<tag::nz>(src), cend = end<tag::nz>(src); cursor != cend; ++cursor) Updater()(dest[index(*cursor)], value(*cursor)); }
int wmain (int argc,wchar_t ** argv) { CAppData::stdfunc(); SetRegKey(argc,argv); if (!SetLanguageSpecifigHandles(argv[0])) return 1; CArrayFP<CDatabase*> aDatabases; WORD wCurrentThread=0; aDatabases.Add(CDatabase::FromDefaults(TRUE)); aDatabases[0]->SetNamePtr(alloccopy(L"DEFAULTX")); aDatabases[0]->SetThreadId(wCurrentThread); int i,helps=0; #ifndef WIN32 if (getenv("TZ")==NULL) fprintf(stderr,"Timezone is not set. Database may contain invalid file times.\nFor example type "SET TZ=GMT+1" for central european time.\n"); #endif for (i=1;i<argc;i++) { if (argv[i][0]=='-' || argv[i][0]=='/') { switch (argv[i][1]) { case L'X': if (argv[i][2]==L'\0') { if (i<argc-1) i++; // RegKeyName already set } break; case 'l': case 'L': if (wcsncmp(aDatabases.GetLast()->GetName(),L"PARAMX",6)!=0 && wcsncmp(aDatabases.GetLast()->GetName(),L"DEFAULTX",8)!=0) wprintf(ID2W(IDS_UPDATEDB32CANNOTCHANGELOADED),aDatabases.GetLast()->GetName()); else if (argv[i][2]=='1') { aDatabases.GetLast()->AddLocalRoots(); aDatabases.GetLast()->SetNamePtr(alloccopy(L"PARAMX")); } else { CStringW* pStr; if (argv[i][2]==L'\0' && i+1<argc) pStr=new CStringW(argv[++i]); else pStr=new CStringW(argv[i]+2); if ((*pStr)[0]==L'\"') pStr->DelChar(0); if (pStr->LastChar()==L'\"') pStr->DelLastChar(); while (pStr->LastChar()==L'\\') pStr->DelLastChar(); if (pStr->GetLength()>1) { if ((*pStr)[1]==':' && pStr->GetLength()==2) aDatabases.GetLast()->AddRoot(pStr->GiveBuffer()); else if (FileSystem::IsDirectory(*pStr)) aDatabases.GetLast()->AddRoot(pStr->GiveBuffer()); else fwprintf(stderr,ID2W(IDS_UPDATEDB32DIRECTORYISNOTVALID),(LPCWSTR)*pStr); } else fwprintf(stderr,ID2W(IDS_UPDATEDB32DIRECTORYISNOTVALID),(LPCWSTR)*pStr); delete pStr; aDatabases.GetLast()->SetNamePtr(alloccopy(L"PARAMX")); } break; case 'e': if (wcsncmp(aDatabases.GetLast()->GetName(),L"PARAMX",6)!=0 && wcsncmp(aDatabases.GetLast()->GetName(),L"DEFAULTX",8)!=0) wprintf(ID2W(IDS_UPDATEDB32CANNOTCHANGELOADED),aDatabases.GetLast()->GetName()); else { CStringW* pStr; if (argv[i][2]=='\0' && i+1<argc) pStr=new CStringW(argv[++i]); else pStr=new CStringW(argv[i]+2); if ((*pStr)[0]==L'\"') pStr->DelChar(0); if (pStr->LastChar()==L'\"') pStr->DelLastChar(); while (pStr->LastChar()==L'\\') pStr->DelLastChar(); if (pStr->GetLength()>0) aDatabases.GetLast()->SetExcludedFiles(*pStr); aDatabases.GetLast()->SetNamePtr(alloccopy(L"PARAMX")); } break; case 'E': if (wcsncmp(aDatabases.GetLast()->GetName(),L"PARAMX",6)!=0 && wcsncmp(aDatabases.GetLast()->GetName(),L"DEFAULTX",8)!=0) wprintf(ID2W(IDS_UPDATEDB32CANNOTCHANGELOADED),aDatabases.GetLast()->GetName()); else { CStringW* pStr; if (argv[i][2]=='\0' && i+1<argc) pStr=new CStringW(argv[++i]); else pStr=new CStringW(argv[i]+2); if ((*pStr)[0]==L'\"') pStr->DelChar(0); if (pStr->LastChar()==L'\"') pStr->DelLastChar(); while (pStr->LastChar()==L'\\') pStr->DelLastChar(); if (pStr->GetLength()>1) { if (!aDatabases.GetLast()->AddExcludedDirectory(*pStr)) fwprintf(stderr,ID2W(IDS_UPDATEDB32DIRECTORYISNOTVALID),(LPCWSTR)*pStr); } else fwprintf(stderr,ID2W(IDS_UPDATEDB32DIRECTORYISNOTVALID),(LPCWSTR)*pStr); delete pStr; aDatabases.GetLast()->SetNamePtr(alloccopy(L"PARAMX")); } break; case 't': case 'T': if (wcsncmp(aDatabases.GetLast()->GetName(),L"PARAMX",6)!=0 && wcsncmp(aDatabases.GetLast()->GetName(),L"DEFAULTX",8)!=0) wprintf(ID2W(IDS_UPDATEDB32CANNOTCHANGELOADED),aDatabases.GetLast()->GetName()); else if (argv[i][2]==L'c' || argv[i][2]==L'C') { if (argv[i][3]==L'\0') aDatabases.GetLast()->SetCreatorPtr(alloccopy(argv[++i])); else aDatabases.GetLast()->SetCreatorPtr(alloccopy(argv[i]+2)); aDatabases.GetLast()->SetNamePtr(alloccopy(L"PARAMX")); } else if (argv[i][2]==L'd' || argv[i][2]==L'D') { if (argv[i][3]==L'\0') aDatabases.GetLast()->SetDescriptionPtr(alloccopy(argv[++i])); else aDatabases.GetLast()->SetDescriptionPtr(alloccopy(argv[i]+2)); aDatabases.GetLast()->SetNamePtr(alloccopy(L"PARAMX")); } break; case 'i': case 'I': if (wcsncmp(aDatabases.GetLast()->GetName(),L"PARAMX",6)!=0 && wcsncmp(aDatabases.GetLast()->GetName(),L"DEFAULTX",8)!=0) wprintf(ID2W(IDS_UPDATEDB32CANNOTCHANGELOADED),aDatabases.GetLast()->GetName()); else { aDatabases.GetLast()->SetFlag(CDatabase::flagIncrementalUpdate,TRUE); aDatabases.GetLast()->SetNamePtr(alloccopy(L"PARAMX")); } break; case 'c': case 'C': if (wcsncmp(aDatabases.GetLast()->GetName(),L"PARAMX",6)!=0 && wcsncmp(aDatabases.GetLast()->GetName(),L"DEFAULTX",8)!=0) wprintf(ID2W(IDS_UPDATEDB32CANNOTCHANGELOADED),aDatabases.GetLast()->GetName()); else if (argv[i][2]==L'A' || argv[i][2]==L'a') { aDatabases.GetLast()->SetFlag(CDatabase::flagAnsiCharset,TRUE); aDatabases.GetLast()->SetNamePtr(alloccopy(L"PARAMX")); } else if (argv[i][2]==L'U' || argv[i][2]==L'u') { aDatabases.GetLast()->SetFlag(CDatabase::flagAnsiCharset,FALSE); aDatabases.GetLast()->SetNamePtr(alloccopy(L"PARAMX")); } break; case 'N': case 'n': wCurrentThread++; break; case 'q': case 'Q': nQuiet=TRUE; break; case 'v': case 'V': printf("%s\n",szVersionStr); return 0; case 'd': { // Using database file CStringW sFile; if (argv[i][2]=='\0') sFile=argv[++i]; else sFile=(argv[i]+2); if (aDatabases.GetSize()==1 && wcscmp(aDatabases[0]->GetName(),L"DEFAULTX")==0) { aDatabases[0]->SetNamePtr(alloccopy(L"PARAMX")); aDatabases[0]->SetArchiveNamePtr(sFile.GiveBuffer()); } else { CDatabase* pDatabase=CDatabase::FromFile(sFile,(int)sFile.GetLength()); if (pDatabase!=NULL) { aDatabases.Add(pDatabase); pDatabase->SetNamePtr(alloccopy(L"PARAMX")); pDatabase->SetThreadId(wCurrentThread); } } } break; case 'D': { // Loading database 'name' from registry, cannot be changed CStringW sName; if (argv[i][2]=='\0') sName=argv[++i]; else sName=(argv[i]+2); if (CDatabase::FindByName(aDatabases,sName,(int)sName.GetLength())==NULL) { CDatabase* pDatabase=CDatabase::FromName(HKCU, CString(g_szRegKey)+"\\Databases",sName); if (pDatabase!=NULL) { pDatabase->SetFlag(CDatabase::flagGlobalUpdate); // Is only default loaded if (aDatabases.GetSize()==1 && wcscmp(aDatabases[0]->GetName(),L"DEFAULTX")==0) { delete aDatabases[0]; aDatabases[0]=pDatabase; } else { aDatabases.Add(pDatabase); pDatabase->SetThreadId(wCurrentThread); } } } } break; case 'h': case 'H': case '?': helps=1; break; default: helps=1; break; } } } if (helps==1) { #ifdef WIN32 fprintf(stdout,"%s\n",szVersionStr); #else fprintf(stdout,"%s\nusage updatedb",szVersionStr); #endif HRSRC hRc=FindResource(GetLanguageSpecificResourceHandle(),MAKEINTRESOURCE(IDR_UPDATEDBHELP),"HELPTEXT"); HGLOBAL hGlobal=LoadResource(GetLanguageSpecificResourceHandle(),hRc); LPCSTR pStr=(LPCSTR)LockResource(hGlobal); // Counting length int len; for (len=0;pStr[len]!='\0';len++) { if (pStr[len]=='E' && pStr[len+1]=='O' && pStr[len+2]=='F') break; } fwrite(pStr,1,len,stdout); FreeLibrary(GetLanguageSpecificResourceHandle()); return 1; } // Checking databases // First, check that there is database if (aDatabases.GetSize()==0) CDatabase::LoadFromRegistry(HKCU,CString(g_szRegKey)+"\\Databases",aDatabases); else if (aDatabases.GetSize()==1 && wcsncmp(aDatabases[0]->GetName(),L"DEFAULTX",8)==0) { aDatabases.RemoveAll(); CDatabase::LoadFromRegistry(HKCU,CString(g_szRegKey)+"\\Databases",aDatabases); // No registry values? if (aDatabases.GetSize()==0) { aDatabases.Add(CDatabase::FromDefaults(TRUE)); aDatabases[0]->SetNamePtr(alloccopy(L"DEFAULTX")); } } CDatabase::CheckValidNames(aDatabases); CDatabase::CheckDoubleNames(aDatabases); for (int i=0;i<aDatabases.GetSize();) { if (!aDatabases[i]->IsGloballyUpdated()) aDatabases.RemoveAt(i); else { if ((wcsncmp(aDatabases[i]->GetName(),L"PARAMX",6)==0 || wcsncmp(aDatabases[i]->GetName(),L"DEFAULTX",8)==0)) { BOOL bNameChanged=FALSE; if (aDatabases[i]->GetRoots()==0) { BOOL bFree; LPWSTR pFile=aDatabases[i]->GetResolvedArchiveName(bFree); CDatabaseInfo* pDatabaseInfo=CDatabaseInfo::GetFromFile(pFile); if (bFree) delete[] pFile; if (pDatabaseInfo!=NULL) { CDatabase* pDatabase; if (!pDatabaseInfo->sExtra2.IsEmpty()) pDatabase=CDatabase::FromExtraBlock(pDatabaseInfo->sExtra2); if (pDatabase==NULL && !pDatabaseInfo->sExtra1.IsEmpty()) pDatabase=CDatabase::FromExtraBlock(pDatabaseInfo->sExtra1); wprintf(ID2W(IDS_UPDATEDB32USINGEXISTINGSETTINGS), aDatabases[i]->GetArchiveName(),pDatabase->GetName()); pDatabase->SetArchiveType(aDatabases[i]->GetArchiveType()); pDatabase->SetArchiveName(aDatabases[i]->GetArchiveName()); delete aDatabases[i]; aDatabases[i]=pDatabase; delete pDatabaseInfo; bNameChanged=TRUE; } } if (!bNameChanged) { ULONG_PTR nFirst=LastCharIndex(aDatabases[i]->GetArchiveName(),L'\\')+1; int nLength=LastCharIndex(aDatabases[i]->GetArchiveName()+nFirst,L'.'); if (nLength==-1) nLength=istrlenw(aDatabases[i]->GetArchiveName()+nFirst); aDatabases[i]->SetNamePtr(alloccopy(aDatabases[i]->GetArchiveName()+nFirst,nLength)); } } i++; } } // Starting to update WORD dwTheads=CDatabase::CheckIDs(aDatabases); if (dwTheads==0) { FreeLibrary(GetLanguageSpecificResourceHandle()); return FALSE; } if (dwTheads==1) { CDatabaseUpdater Updater(aDatabases,aDatabases.GetSize(),UpdateProc); Updater.Update(FALSE); } else { WORD wThread; ppUpdaters=new CDatabaseUpdater*[dwTheads+1]; for (wThread=0;wThread<dwTheads;wThread++) { ppUpdaters[wThread]=new CDatabaseUpdater(aDatabases,aDatabases.GetSize(), UpdateProc,wThread,(DWORD)0); } ppUpdaters[dwTheads]=NULL; // Starting DWORD dwRunning=0; UpdateError ueCode; for (wThread=0;wThread<dwTheads;wThread++) { ueCode=ppUpdaters[wThread]->Update(TRUE); if (ueCode==ueSuccess) dwRunning++; else { delete ppUpdaters[wThread]; ppUpdaters[wThread]=UPDATER_EXITED(ueCode); } } if (dwRunning==0) delete ppUpdaters; else { while (ppUpdaters!=NULL) Sleep(100); } } FinishRegKey(); FreeLibrary(GetLanguageSpecificResourceHandle()); return 1; }
void FIOSTargetSettingsCustomization::OnPlistPropertyModified() { check(SetupForPlatformAttribute.Get() == true); const UIOSRuntimeSettings& Settings = *GetDefault<UIOSRuntimeSettings>(); FManifestUpdateHelper Updater(GameInfoPath); // The text we're trying to replace looks like this: // <key>UISupportedInterfaceOrientations</key> // <array> // <string>UIInterfaceOrientationLandscapeRight</string> // <string>UIInterfaceOrientationLandscapeLeft</string> // </array> const FString InterfaceOrientations(TEXT("<key>UISupportedInterfaceOrientations</key>")); const FString ClosingArray(TEXT("</array>")); // Build the replacement array FString OrientationArrayBody = TEXT("\n\t<array>\n"); if (Settings.bSupportsPortraitOrientation) { OrientationArrayBody += TEXT("\t\t<string>UIInterfaceOrientationPortrait</string>\n"); } if (Settings.bSupportsUpsideDownOrientation) { OrientationArrayBody += TEXT("\t\t<string>UIInterfaceOrientationPortraitUpsideDown</string>\n"); } if (Settings.bSupportsLandscapeLeftOrientation && (!Settings.bSupportsPortraitOrientation && !Settings.bSupportsUpsideDownOrientation)) { OrientationArrayBody += TEXT("\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n"); } if (Settings.bSupportsLandscapeRightOrientation && (!Settings.bSupportsPortraitOrientation && !Settings.bSupportsUpsideDownOrientation)) { OrientationArrayBody += TEXT("\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n"); } OrientationArrayBody += TEXT("\t"); Updater.ReplaceKey(InterfaceOrientations, ClosingArray, OrientationArrayBody); // build the replacement bundle display name const FString BundleDisplayNameKey(TEXT("<key>CFBundleDisplayName</key>")); const FString ClosingString(TEXT("</string>")); FString BundleDisplayNameBody = TEXT("\n\t<string>") + Settings.BundleDisplayName; Updater.ReplaceKey(BundleDisplayNameKey, ClosingString, BundleDisplayNameBody); // build the replacement bundle display name const FString BundleNameKey(TEXT("<key>CFBundleName</key>")); FString BundleNameBody = TEXT("\n\t<string>") + Settings.BundleName; Updater.ReplaceKey(BundleNameKey, ClosingString, BundleNameBody); // build the replacement bundle identifier const FString BundleIdentifierKey(TEXT("<key>CFBundleIdentifier</key>")); FString BundleIdentifierBody = TEXT("\n\t<string>") + Settings.BundleIdentifier; Updater.ReplaceKey(BundleIdentifierKey, ClosingString, BundleIdentifierBody); // build the replacement version info const FString BundleShortVersionKey(TEXT("<key>CFBundleShortVersionString</key>")); FString VersionInfoBody = TEXT("\n\t<string>") + Settings.VersionInfo; Updater.ReplaceKey(BundleShortVersionKey, ClosingString, VersionInfoBody); // build the replacement required device caps const FString RequiredDeviceCaps(TEXT("<key>UIRequiredDeviceCapabilities</key>")); FString DeviceCapsArrayBody = TEXT("\n\t<array>\n"); // automatically add armv7 for now DeviceCapsArrayBody += TEXT("\t\t<string>armv7</string>\n"); if (Settings.bSupportsOpenGLES2) { DeviceCapsArrayBody += TEXT("\t\t<string>opengles-2</string>\n"); } else if (Settings.bSupportsMetal) { DeviceCapsArrayBody += TEXT("\t\t<string>metal</string>\n"); } DeviceCapsArrayBody += TEXT("\t"); Updater.ReplaceKey(RequiredDeviceCaps, ClosingArray, DeviceCapsArrayBody); // Write out the updated .plist Updater.Finalize(GameInfoPath, true, FFileHelper::EEncodingOptions::ForceUTF8); }
void frmSelect::on_all_sotr_stateChanged(int arg1) { Updater(); }
void frmSelect::on_all_ostatki_clicked() { Updater(); }
void HandleUpdate() { ConfigureDevice(); Updater(); }