public static ActionResult CopyOldDataDirectory(Session session) { session.Log("Begin CopyOldDataDirectory"); DirectoryInfo fromDirectory = null; string toDirectory = null; try { toDirectory = session.CustomActionData["DATADIRECTORY"]; session.Log("DATADIRECTORY=" + toDirectory); var newFolder = new DirectoryInfo(toDirectory); var oldOctgn = InstalledOctgn.Get(); fromDirectory = oldOctgn.DataDirectory ?? new DirectoryInfo(Paths.Get.DefaultDataDirectory); if (fromDirectory.Exists) { session.Log("Old OCTGN DataDirectory exists."); var usingDifferentDirectory = !string.Equals(newFolder.FullName.Trim('\\'), fromDirectory.FullName.Trim('\\'), StringComparison.CurrentCultureIgnoreCase); if (usingDifferentDirectory) { session.Log($"Using a different Data Directory: {newFolder} != {fromDirectory.FullName}"); StatusMessage(session, "Moving OCTGN DataDirectory"); session.Log($"Copying {fromDirectory.FullName} to {newFolder.FullName}"); var totalFileCount = fromDirectory.EnumerateFiles("*.*", SearchOption.AllDirectories).Count(); ResetProgressBar(session, totalFileCount + 1); CopyDirectory(session, fromDirectory, newFolder); session.Log($"Deleting {fromDirectory.FullName}"); fromDirectory.Delete(true); IncrementProgressBar(session, 1); } } return(ActionResult.Success); } catch (Exception ex) { session.Log(ex.ToString()); var record = new Record(); record.FormatString = $"Error moving old DataDirectory\r\nFrom: {fromDirectory.FullName}\r\nTo: {toDirectory}\r\n{ex}"; session.Message(InstallMessage.Error | (InstallMessage)(MessageBoxIcon.Error) | (InstallMessage)MessageBoxButtons.OK, record); return(ActionResult.Failure); } }
public override void Button1_Action() { if (InstalledOctgn.Get().IsIncompatible) { DoTransition(new PreviousVersionPageViewModel()); } else { DoTransition(new DirectorySelectionPageViewModel()); } }
public override void Button1_Action() { base.Button1_Action(); if (InstalledOctgn.Get().IsIncompatible) { return; } else { DoTransition(new DirectorySelectionPageViewModel()); } }