SIL.FieldWorks.FieldWorks.RestoreCurrentProject C# (CSharp) Метод

RestoreCurrentProject() приватный статический Метод

Restores from the backup specified in restoreSettings, replacing the current version of this project (requires restarting apps and the cache).
private static RestoreCurrentProject ( SIL.FieldWorks.FwRestoreProjectSettings restoreSettings, Form dialogOwner ) : void
restoreSettings SIL.FieldWorks.FwRestoreProjectSettings The restore settings.
dialogOwner System.Windows.Forms.Form A form that can be used as an owner for progress dialog/ /// message box.
Результат void
		private static void RestoreCurrentProject(FwRestoreProjectSettings restoreSettings,
			Form dialogOwner)
		{
			// When we get here we can safely do the backup of the project because we either
			// have no cache (and no other process has this project open), or we are the
			// process that has this project open. (FWR-3344)
			if (restoreSettings.Settings.BackupOfExistingProjectRequested &&
				!BackupProjectForRestore(restoreSettings, Cache, dialogOwner))
			{
				return;
			}

			ExecuteWithAppsShutDown(restoreSettings.FwAppCommandLineAbbrev, () =>
			{
				bool retry;
				do
				{
					retry = false;
					try
					{
						var restoreService = new ProjectRestoreService(restoreSettings.Settings, s_ui, FwDirectoryFinder.ConverterConsoleExe, FwDirectoryFinder.DbExe);
						Logger.WriteEvent("Restoring from " + restoreSettings.Settings.Backup.File);
						if (RestoreProjectDlg.HandleRestoreFileErrors(null, ResourceHelper.GetResourceString("ksRestoreFailed"),
							restoreSettings.Settings.Backup.File, () => DoRestore(restoreService)))
						{
							s_LinkDirChangedTo = restoreService.LinkDirChangedTo;
							return s_projectId ??
								new ProjectId(ClientServerServices.Current.Local.IdForLocalProject(restoreSettings.Settings.ProjectName), null);
						}
					}
					catch (CannotConvertException e)
					{
						MessageBoxUtils.Show(e.Message, ResourceHelper.GetResourceString("ksRestoreFailed"));
					}
					catch (MissingOldFwException e)
					{
						using (var dlg = new MissingOldFieldWorksDlg(restoreSettings.Settings,
							e.HaveOldFieldWorks, e.HaveFwSqlServer))
						{
							retry = (dlg.ShowDialog() == DialogResult.Retry);
						}
					}
					catch (FailedFwRestoreException e)
					{
						MessageBoxUtils.Show(Properties.Resources.ksRestoringOldFwBackupFailed, Properties.Resources.ksFailed);
					}
				}
				while (retry);

				return null;
			});
		}
FieldWorks