public static bool OnStartup(string[] args) {
try {
if (MainExecutingFile.Location.EndsWith(UpdatePostfix)) {
InstallAndRunNewVersion();
return true;
}
if (File.Exists(UpdateLocation)) {
if (FileVersionInfo.GetVersionInfo(UpdateLocation).FileVersion.IsVersionNewerThan(BuildInformation.AppVersion)) {
Thread.Sleep(200);
RunUpdateExeAndExitIfExists();
return true;
}
CleanUpUpdateExeAsync().Forget();
}
return false;
} catch (Exception e) {
MessageBox.Show(string.Format(ToolsStrings.AppUpdater_CannotUpdate_Message, e.Message), ToolsStrings.AppUpdater_UpdateFailed,
MessageBoxButton.OK, MessageBoxImage.Error);
return false;
}
}