public string SetOutputFolder(string outputFolder, string currentOutputFolder = null) { if (currentOutputFolder == null) { currentOutputFolder = RegistryStuff.GetOutputFolder(DefaultOutputFolder); } if (outputFolder == null) { // If not given, use the existing default folder outputFolder = currentOutputFolder; } if (outputFolder != currentOutputFolder) { // Update the registry key if the output folder has changed RegistryStuff.SetOutputFolder(outputFolder); } return(outputFolder); }
public ExitCode Run(string destination, string shortcutPath, string outputFolder, string openWithAppPath = null, bool force = false) { var result = ExitCode.NotStarted; var currentOutputFolder = RegistryStuff.GetOutputFolder(DefaultOutputFolder); outputFolder = SetOutputFolder(outputFolder, currentOutputFolder); var systemPathResult = PathSetup.AddToOrReplaceInSystemPath(currentOutputFolder, outputFolder); if (!systemPathResult) { result = ExitCode.CannotUpdatePath; } else { var shortcut = new Shortcut(destination, shortcutPath, outputFolder, openWithAppPath); if (shortcut.Type != ShortcutType.Unknown) { var createOutputFolderResult = CreateOutputFolder(shortcut.Folder); if (!createOutputFolderResult) { result = ExitCode.CannotCreateOutputFolder; } else { var createShortcutResult = CreateShortcutFile(shortcut, force); result = createShortcutResult ? ExitCode.Success : ExitCode.FileAlreadyExists; } } } return(result); }
public string GetOutputFolder() { var outputFolder = RegistryStuff.GetOutputFolder(DefaultOutputFolder); return(outputFolder); }