SIL.FieldWorks.FieldWorks.MigrateProjectsTo70 C# (CSharp) Méthode

MigrateProjectsTo70() private static méthode

Migrates the user's databases to FieldWorks 7.0+ if they haven't yet migrated successfully (and the user actually wants to migrate).
private static MigrateProjectsTo70 ( ) : bool
Résultat bool
		private static bool MigrateProjectsTo70()
		{
			string regValue = (string)FwRegistryHelper.FieldWorksRegistryKey.GetValue("MigrationTo7Needed", bool.FalseString);
			bool migrationNeeded = regValue != null ? bool.Parse(regValue) : false;
			if (!migrationNeeded)
				return false;

			DialogResult res = MessageBox.Show(Properties.Resources.ksDoYouWantToMigrate,
				Properties.Resources.ksMigrateProjects, MessageBoxButtons.YesNo);

			// See FWR-3767 for details when this line only occurred if the migrate process completed without error.
			FwRegistryHelper.FieldWorksRegistryKey.DeleteValue("MigrationTo7Needed");

			if (res == DialogResult.Yes)
			{
				try
				{
					// TODO (TimS): We should probably put FW into single process mode for these
					// migrations. It would probably be very bad to have two processes attempting to
					// do migrations at the same time.
					ProcessStartInfo info = new ProcessStartInfo(FwDirectoryFinder.MigrateSqlDbsExe);
					info.UseShellExecute = false;
					using (Process proc = Process.Start(info))
					{
						proc.WaitForExit();
						if (proc.ExitCode < 0)
							throw new Exception(Properties.Resources.ksMigratingProjectsFailed);
						if (proc.ExitCode > 0)
							throw new Exception(String.Format(Properties.Resources.ksProjectsFailedToMigrate, proc.ExitCode));
					}
				}
				catch (Exception ex)
				{
					MessageBox.Show(Properties.Resources.ksErrorMigratingProjects +
						Environment.NewLine + ex.Message);
				}
			}
			return true;
		}
		#endregion
FieldWorks