Example #1
0
 public PythonInstaller(ProgramPathContainer pythonPathContainer, IEnumerable<string> packages, bool installed, TextWriter writer)
 {
     _version = pythonPathContainer.ProgramVersion;
     _installed = installed;
     _writer = writer;
     AssignPackages(packages);
     InitializeComponent();
 }
 // Python is not installed and there are no packages to install
 public static void TestDlgLoadNotInstalled()
 {
     var ppc = new ProgramPathContainer(PYTHON, VERSION_27);
     var pythonInstaller = ShowDialog<PythonInstaller>(() => InstallProgram(ppc, new String[0], false));
     WaitForConditionUI(5 * 1000, () => pythonInstaller.IsLoaded);
     RunUI(() => Assert.AreEqual(string.Format(Resources.PythonInstaller_PythonInstaller_Load_This_tool_requires_Python__0___Click_install_to_begin_the_installation_process_, VERSION_27), pythonInstaller.Message));
     OkDialog(pythonInstaller, () => Cancel(pythonInstaller));
 }
Example #3
0
 public PythonInstaller(ProgramPathContainer pythonPathContainer, IEnumerable <string> packages, bool installed, TextWriter writer)
 {
     _version   = pythonPathContainer.ProgramVersion;
     _installed = installed;
     _writer    = writer;
     AssignPackages(packages);
     InitializeComponent();
 }
Example #4
0
        // Python is not installed and there are no packages to install
        public static void TestDlgLoadNotInstalled()
        {
            var ppc             = new ProgramPathContainer(PYTHON, VERSION_27);
            var pythonInstaller = ShowDialog <PythonInstaller>(() => InstallProgram(ppc, new String[0], false));

            WaitForConditionUI(5 * 1000, () => pythonInstaller.IsLoaded);
            RunUI(() => Assert.AreEqual(string.Format(Resources.PythonInstaller_PythonInstaller_Load_This_tool_requires_Python__0___Click_install_to_begin_the_installation_process_, VERSION_27), pythonInstaller.Message));
            OkDialog(pythonInstaller, () => Cancel(pythonInstaller));
        }
Example #5
0
        public void EditMacro()
        {
            ProgramPathContainer pcc = ToolMacros.GetProgramPathContainer(textCommand.Text);

            using (var dlg = new LocateFileDlg(pcc))
            {
                dlg.ShowDialog();
            }
        }
Example #6
0
 public RInstaller(ProgramPathContainer rPathContainer, ICollection<ToolPackage> packages, bool installed, TextWriter writer, string pathToInstallScript)
 {
     PackagesToInstall = packages;
     _version = rPathContainer.ProgramVersion;
     _installed = installed;
     _writer = writer;
     PathToInstallScript = pathToInstallScript;
     InitializeComponent();
 }
Example #7
0
 public RInstaller(ProgramPathContainer rPathContainer, ICollection <ToolPackage> packages, bool installed, TextWriter writer, string pathToInstallScript)
 {
     PackagesToInstall   = packages;
     _version            = rPathContainer.ProgramVersion;
     _installed          = installed;
     _writer             = writer;
     PathToInstallScript = pathToInstallScript;
     InitializeComponent();
 }
Example #8
0
 // helper method to simulate the creation of the InstallR dialog, so we can use our test installer
 private static void InstallProgram(ProgramPathContainer ppc, ICollection <ToolPackage> packages, bool installed, TextWriter writer = null)
 {
     using (var dlg = new RInstaller(ppc, packages, installed, writer, null))
     {
         // Keep OK button from doing anything ever
         dlg.TestRunProcess = new TestRunProcess {
             ExitCode = 0
         };
         dlg.ShowDialog(SkylineWindow);
     }
 }
Example #9
0
 private static void InstallProgram(ProgramPathContainer ppc, IEnumerable <string> packageUris, bool installed)
 {
     using (var dlg = new PythonInstaller(ppc, packageUris, installed, null))
     {
         // Keep OK button from doing anything ever
         dlg.TestRunProcess = new TestRunProcess {
             ExitCode = 0
         };
         dlg.ShowDialog(SkylineWindow);
     }
 }
Example #10
0
        // Python is installed and there are packages to install
        private static void TestDlgLoadPackagesOnly()
        {
            var ppc         = new ProgramPathContainer(PYTHON, VERSION_27);
            var packageUris = new Collection <string> {
                EXE_PACKAGE, TARGZ_PACKAGE, ZIP_PACKAGE, LOCAL_EXE_PACKAGE, LOCAL_TARGZ_PACKAGE, LOCAL_ZIP_PACKAGE
            };
            var pythonInstaller = ShowDialog <PythonInstaller>(() => InstallProgram(ppc, packageUris, true));

            WaitForConditionUI(5 * 1000, () => pythonInstaller.IsLoaded);
            RunUI(() => Assert.AreEqual(Resources.PythonInstaller_PythonInstaller_Load_This_tool_requires_the_following_Python_packages__Select_packages_to_install_and_then_click_Install_to_begin_the_installation_process_, pythonInstaller.Message));
            OkDialog(pythonInstaller, () => Cancel(pythonInstaller));
        }
Example #11
0
        // Cannot test methods below because of common dialogs

        private void btnFindCommand_Click(object sender, EventArgs e)
        {
            ProgramPathContainer pcc = ToolMacros.GetProgramPathContainer(textCommand.Text);

            if (pcc != null)
            {
                contextMenuCommand.Show(btnFindCommand.Parent, btnFindCommand.Left, btnFindCommand.Bottom + 1);
            }
            else
            {
                CommandBtnClick();
            }
        }
Example #12
0
        // Tests that the form properly populates the checkbox
        private static void TestProperPopulation()
        {
            var PPC         = new ProgramPathContainer(PYTHON, VERSION_27);
            var PackageUris = new Collection <string> {
                EXE_PACKAGE, TARGZ_PACKAGE, ZIP_PACKAGE, LOCAL_EXE_PACKAGE, LOCAL_TARGZ_PACKAGE, LOCAL_ZIP_PACKAGE
            };
            var pythonInstaller = ShowDialog <PythonInstaller>(() => InstallProgram(PPC, PackageUris, false));

            WaitForConditionUI(5 * 1000, () => pythonInstaller.IsLoaded);

            RunUI(() => Assert.AreEqual(PackageUris.Count, pythonInstaller.PackagesListCount));

            // ensure that packages default to checked upon load
            RunUI(() => Assert.AreEqual(PackageUris.Count, pythonInstaller.CheckedPackagesCount));
            OkDialog(pythonInstaller, () => Cancel(pythonInstaller));
        }
Example #13
0
        private void TestPackageVersioning()
        {
            IUnpackZipToolSupport support = new UnpackZipToolTestSupport();
            string version1 = TestFilesDir.GetTestPath("TestPackageVersioning.zip");
            var    retval   = ToolInstaller.UnpackZipTool(version1, support);

            Assert.AreEqual(1, retval.Installations.Count);
            ProgramPathContainer ppc = new ProgramPathContainer("BogusProgram", "3.0.0");
            var ListPackages         = retval.Installations[ppc];

            Assert.AreEqual(3, ListPackages.Count);
            Assert.AreEqual("TestPAckages", ListPackages[0].Name);
            Assert.AreEqual("7.3-28", ListPackages[0].Version);
            Assert.AreEqual("TestOtherPAckage", ListPackages[1].Name);
            Assert.AreEqual("3.2.3", ListPackages[1].Version);
            Assert.AreEqual("noVersionPackage", ListPackages[2].Name);
            Assert.AreEqual(null, ListPackages[2].Version);
        }
Example #14
0
        public LocateFileDlg(ProgramPathContainer ppc)
        {
            InitializeComponent();
            string programName    = ppc.ProgramName;
            string programVersion = ppc.ProgramVersion;

            if (Settings.Default.ToolFilePaths.ContainsKey(ppc))
            {
                labelMessage.Text = programVersion != null
                                          ? string.Format(TextUtil.LineSeparate(
                                                              Resources.LocateFileDlg_LocateFileDlg_This_tool_requires_0_version_1,
                                                              Resources.LocateFileDlg_LocateFileDlg_Below_is_the_saved_value_for_the_path_to_the_executable,
                                                              Resources.LocateFileDlg_LocateFileDlg_Please_verify_and_update_if_incorrect),
                                                          programName, programVersion)
                                          : string.Format(TextUtil.LineSeparate(
                                                              Resources.LocateFileDlg_LocateFileDlg_This_tool_requires_0,
                                                              Resources.LocateFileDlg_LocateFileDlg_Below_is_the_saved_value_for_the_path_to_the_executable,
                                                              Resources.LocateFileDlg_LocateFileDlg_Please_verify_and_update_if_incorrect),
                                                          programName);

                textPath.Text = Settings.Default.ToolFilePaths[ppc];
            }
            else
            {
                labelMessage.Text = programVersion != null
                                          ? string.Format(TextUtil.LineSeparate(
                                                              Resources.LocateFileDlg_LocateFileDlg_This_tool_requires_0_version_1,
                                                              Resources.LocateFileDlg_LocateFileDlg_If_you_have_it_installed_please_provide_the_path_below,
                                                              Resources.LocateFileDlg_LocateFileDlg_Otherwise__please_cancel_and_install__0__version__1__first,
                                                              Resources.LocateFileDlg_LocateFileDlg_then_run_the_tool_again),
                                                          programName, programVersion)
                                          : string.Format(TextUtil.LineSeparate(
                                                              Resources.LocateFileDlg_LocateFileDlg_This_tool_requires_0,
                                                              Resources.LocateFileDlg_LocateFileDlg_If_you_have_it_installed_please_provide_the_path_below,
                                                              Resources.LocateFileDlg_LocateFileDlg_Otherwise__please_cancel_and_install__0__first,
                                                              Resources.LocateFileDlg_LocateFileDlg_then_run_the_tool_again),
                                                          programName);
            }
            _pathContainer = ppc;
        }
Example #15
0
        private static PythonInstaller FormatPythonInstaller(bool cancelDownload, bool downloadSuccess,
                                                             bool installSuccess)
        {
            var ppc = new ProgramPathContainer(PYTHON, VERSION_27);
            // ReSharper disable once CollectionNeverUpdated.Local
            var packageUris     = new Collection <string>();
            var pythonInstaller = ShowDialog <PythonInstaller>(() => InstallProgram(ppc, packageUris, false));

            WaitForConditionUI(() => pythonInstaller.IsLoaded);
            RunUI(() =>
            {
                pythonInstaller.TestDownloadClient = new TestAsynchronousDownloadClient
                {
                    CancelDownload  = cancelDownload,
                    DownloadSuccess = downloadSuccess
                };
                pythonInstaller.TestRunProcess = new TestRunProcess {
                    ExitCode = installSuccess ? 0 : 1
                };
            });
            return(pythonInstaller);
        }
Example #16
0
        private static PythonInstaller FormatPackageInstaller(bool cancelDownload, bool downloadSuccess,
                                                              bool connectSuccess, bool installSuccess, IEnumerable <string> packageUris)
        {
            var ppc             = new ProgramPathContainer(PYTHON, VERSION_27);
            var pythonInstaller = ShowDialog <PythonInstaller>(() => InstallProgram(ppc, packageUris, true));

            WaitForConditionUI(() => pythonInstaller.IsLoaded);
            RunUI(() =>
            {
                pythonInstaller.TestDownloadClient = new TestAsynchronousDownloadClient
                {
                    CancelDownload  = cancelDownload,
                    DownloadSuccess = downloadSuccess
                };
                pythonInstaller.TestSkylineProcessRunner = new TestSkylineProcessRunner
                {
                    ConnectSuccess = connectSuccess,
                    ExitCode       = installSuccess ? 0 : 1
                };
            });
            return(pythonInstaller);
        }
Example #17
0
 public LocateFileDlg(ProgramPathContainer ppc)
 {
     InitializeComponent();
     string programName = ppc.ProgramName;
     string programVersion = ppc.ProgramVersion;
     if (Settings.Default.ToolFilePaths.ContainsKey(ppc))
     {
         labelMessage.Text = programVersion != null
                                   ? string.Format(TextUtil.LineSeparate(
                                       Resources.LocateFileDlg_LocateFileDlg_This_tool_requires_0_version_1,
                                       Resources.LocateFileDlg_LocateFileDlg_Below_is_the_saved_value_for_the_path_to_the_executable,
                                       Resources.LocateFileDlg_LocateFileDlg_Please_verify_and_update_if_incorrect),
                                       programName, programVersion)
                                   : string.Format(TextUtil.LineSeparate(
                                       Resources.LocateFileDlg_LocateFileDlg_This_tool_requires_0,
                                       Resources.LocateFileDlg_LocateFileDlg_Below_is_the_saved_value_for_the_path_to_the_executable,
                                       Resources.LocateFileDlg_LocateFileDlg_Please_verify_and_update_if_incorrect),
                                       programName);
         textPath.Text = Settings.Default.ToolFilePaths[ppc];
     }
     else
     {
         labelMessage.Text = programVersion != null
                                   ? string.Format(TextUtil.LineSeparate(
                                       Resources.LocateFileDlg_LocateFileDlg_This_tool_requires_0_version_1,
                                       Resources.LocateFileDlg_LocateFileDlg_If_you_have_it_installed_please_provide_the_path_below,
                                       Resources.LocateFileDlg_LocateFileDlg_Otherwise__please_cancel_and_install__0__version__1__first,
                                       Resources.LocateFileDlg_LocateFileDlg_then_run_the_tool_again),
                                       programName, programVersion)
                                   : string.Format(TextUtil.LineSeparate(
                                       Resources.LocateFileDlg_LocateFileDlg_This_tool_requires_0,
                                       Resources.LocateFileDlg_LocateFileDlg_If_you_have_it_installed_please_provide_the_path_below,
                                       Resources.LocateFileDlg_LocateFileDlg_Otherwise__please_cancel_and_install__0__first,
                                       Resources.LocateFileDlg_LocateFileDlg_then_run_the_tool_again),
                                       programName);
     }
     _pathContainer = ppc;
 }
Example #18
0
        private static void FindPackagesToInstall(ExternalToolProperties readin,
            UnzipToolReturnAccumulator accumulator,
            ProgramPathContainer programPathContainer)
        {
            var packages = new List<ToolPackage>();
            int i = 1;
            var package = readin.GetPackageWithVersion(i);
            while (package != null)
            {
                // if the package is not a uri, it is stored locally in the tool-inf directory
                //if (!package.StartsWith("http")) // Not L10N
                //    package = Path.Combine(tempToolPath, TOOL_INF, package);

                packages.Add(package);
                package = readin.GetPackageWithVersion(++i);
            }

            if (!Settings.Default.ToolFilePaths.ContainsKey(programPathContainer) || packages.Count > 0)
                accumulator.AddInstallation(programPathContainer, packages);
        }
Example #19
0
 public RInstaller(ProgramPathContainer rPathContainer, ICollection <ToolPackage> packages, TextWriter writer, string pathToInstallScript)
     : this(rPathContainer, packages, RUtil.CheckInstalled(rPathContainer.ProgramVersion), writer, pathToInstallScript)
 {
 }
Example #20
0
 public PythonInstaller(ProgramPathContainer pythonPathContainer, IEnumerable<string> packages, TextWriter writer)
     : this(pythonPathContainer, packages, PythonUtil.CheckInstalled(pythonPathContainer.ProgramVersion), writer)
 {
 }
Example #21
0
 public PythonInstaller(ProgramPathContainer pythonPathContainer, IEnumerable <string> packages, TextWriter writer)
     : this(pythonPathContainer, packages, PythonUtil.CheckInstalled(pythonPathContainer.ProgramVersion), writer)
 {
 }
        // Tests that the form properly populates the checkbox
        private static void TestProperPopulation()
        {
            var PPC = new ProgramPathContainer(PYTHON, VERSION_27);
            var PackageUris = new Collection<string> { EXE_PACKAGE, TARGZ_PACKAGE, ZIP_PACKAGE, LOCAL_EXE_PACKAGE, LOCAL_TARGZ_PACKAGE, LOCAL_ZIP_PACKAGE };
            var pythonInstaller = ShowDialog<PythonInstaller>(() => InstallProgram(PPC, PackageUris, false));
            WaitForConditionUI(5 * 1000, () => pythonInstaller.IsLoaded);

            RunUI(() => Assert.AreEqual(PackageUris.Count, pythonInstaller.PackagesListCount));

            // ensure that packages default to checked upon load
            RunUI(() => Assert.AreEqual(PackageUris.Count, pythonInstaller.CheckedPackagesCount));
            OkDialog(pythonInstaller, () => Cancel(pythonInstaller));
        }
Example #23
0
        private bool ParseArgsInternal(IEnumerable<string> args)
        {
            foreach (string s in args)
            {
                var pair = new NameValuePair(s);
                if (string.IsNullOrEmpty(pair.Name))
                    continue;

                if (IsNameOnly(pair, "ui")) // Not L10N
                {
                    // Handled by Program
                }
                else if (IsNameOnly(pair, "hideacg")) // Not L10N
                {
                    HideAllChromatogramsGraph = true;
                }
                else if (IsNameOnly(pair, "noacg")) // Not L10N
                {
                    NoAllChromatogramsGraph = true;
                }
                else if (IsNameValue(pair, "in")) // Not L10N
                {
                    SkylineFile = GetFullPath(pair.Value);
                    // Set requiresInCommand to be true so if SkylineFile is null or empty it still complains.
                    RequiresSkylineDocument = true;
                }
                else if (IsNameValue(pair, "dir")) // Not L10N
                {
                    if (!Directory.Exists(pair.Value))
                    {
                        _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Error__The_specified_working_directory__0__does_not_exist_, pair.Value);
                        return false;
                    }
                    Directory.SetCurrentDirectory(pair.Value);
                }
                else if (IsNameOnly(pair, "timestamp")) // Not L10N
                {
                    _out.IsTimeStamped = true;
                }

                // A command that exports all the tools to a text file in a SkylineRunner form for --batch-commands
                // Not advertised.
                // ReSharper disable NonLocalizedString
                else if (IsNameValue(pair, "tool-list-export"))
                {
                    string pathToOutputFile = pair.Value;
                    using (StreamWriter sw = new StreamWriter(pathToOutputFile))
                    {
                        foreach (var tool in Settings.Default.ToolList)
                        {
                            string command = "--tool-add=" + "\"" + tool.Title + "\"" +
                                             " --tool-command=" + "\"" + tool.Command + "\"" +
                                             " --tool-arguments=" + "\"" + tool.Arguments + "\"" +
                                             " --tool-initial-dir=" + "\"" + tool.InitialDirectory + "\"" +
                                             " --tool-conflict-resolution=skip" +
                                             " --tool-report=" + "\"" + tool.ReportTitle + "\"";

                            if (tool.OutputToImmediateWindow)
                                command += " --tool-output-to-immediate-window";

                            sw.WriteLine(command);
                        }
                    }
                }
                // ReSharper restore NonLocalizedString

                // Import a skyr file.
                else if (IsNameValue(pair, "report-add")) // Not L10N
                {
                    ImportingSkyr = true;
                    SkyrPath = pair.Value;
                }

                else if (IsNameValue(pair, "report-conflict-resolution")) // Not L10N
                {
                    string input = pair.Value.ToLowerInvariant();
                    if (input == "overwrite") // Not L10N
                    {
                        ResolveSkyrConflictsBySkipping = false;
                    }
                    if (input == "skip") // Not L10N
                    {
                        ResolveSkyrConflictsBySkipping = true;
                    }
                }

                else if (IsNameValue(pair, ARG_FULL_SCAN_PRECURSOR_RES))
                {
                    RequiresSkylineDocument = true;
                    FullScanPrecursorRes = ParseDouble(pair.Value, ARG_FULL_SCAN_PRECURSOR_RES);
                    if (!FullScanPrecursorRes.HasValue)
                        return false;
                }
                else if (IsNameValue(pair, ARG_FULL_SCAN_PRECURSOR_RES_MZ))
                {
                    RequiresSkylineDocument = true;
                    FullScanPrecursorResMz = ParseDouble(pair.Value, ARG_FULL_SCAN_PRECURSOR_RES_MZ);
                    if (!FullScanPrecursorResMz.HasValue)
                        return false;
                }
                else if (IsNameValue(pair, ARG_FULL_SCAN_PRODUCT_RES))
                {
                    RequiresSkylineDocument = true;
                    FullScanProductRes = ParseDouble(pair.Value, ARG_FULL_SCAN_PRODUCT_RES);
                    if (!FullScanProductRes.HasValue)
                        return false;
                }
                else if (IsNameValue(pair, ARG_FULL_SCAN_PRODUCT_RES_MZ))
                {
                    RequiresSkylineDocument = true;
                    FullScanProductResMz = ParseDouble(pair.Value, ARG_FULL_SCAN_PRODUCT_RES_MZ);
                    if (!FullScanProductResMz.HasValue)
                        return false;
                }
                else if (IsNameValue(pair, ARG_FULL_SCAN_RT_FILTER_TOLERANCE))
                {
                    RequiresSkylineDocument = true;
                    FullScanRetentionTimeFilterLength = ParseDouble(pair.Value, ARG_FULL_SCAN_RT_FILTER_TOLERANCE);
                    if (!FullScanRetentionTimeFilterLength.HasValue)
                        return false;
                }

                else if (IsNameValue(pair, "tool-add-zip")) // Not L10N
                {
                    InstallingToolsFromZip = true;
                    ZippedToolsPath = pair.Value;
                }
                else if (IsNameValue(pair, "tool-zip-conflict-resolution")) // Not L10N
                {
                    string input = pair.Value.ToLowerInvariant();
                    if (input == "overwrite") // Not L10N
                    {
                        ResolveZipToolConflictsBySkipping = CommandLine.ResolveZipToolConflicts.overwrite;
                    }
                    if (input == "parallel") // Not L10N
                    {
                        ResolveZipToolConflictsBySkipping = CommandLine.ResolveZipToolConflicts.in_parallel;
                    }
                }
                else if (IsNameValue(pair, "tool-zip-overwrite-annotations")) // Not L10N
                {
                    string input = pair.Value.ToLowerInvariant();
                    if (input == "true") // Not L10N
                    {
                        ResolveZipToolAnotationConflictsBySkipping = true;
                    }
                    if (input == "false") // Not L10N
                    {
                        ResolveZipToolAnotationConflictsBySkipping = false;
                    }
                }
                else if (IsNameValue(pair, "tool-program-macro")) // example --tool-program-macro=R,2.15.2  // Not L10N
                {
                    string [] spliced = pair.Value.Split(',');
                    if (spliced.Count() > 2)
                    {
                        _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Warning__Incorrect_Usage_of_the___tool_program_macro_command_);
                    }
                    else
                    {
                        string programName = spliced[0];
                        string programVersion = null;
                        if (spliced.Count() > 1)
                        {
                            // Extract the version if specified.
                            programVersion = spliced[1];
                        }
                        ZippedToolsProgramPathContainer = new ProgramPathContainer(programName, programVersion);
                    }
                }
            // ReSharper disable NonLocalizedString
                else if (IsNameValue(pair, "tool-program-path"))
                {
                    ZippedToolsProgramPathValue = pair.Value;
                }
                else if (IsNameOnly(pair, "tool-ignore-required-packages"))
                {
                    ZippedToolsPackagesHandled = true;
                }

                else if (IsNameValue(pair, "tool-add"))
                {
                    ImportingTool = true;
                    ToolName = pair.Value;
                }

                else if (IsNameValue(pair, "tool-command"))
                {
                    ImportingTool = true;
                    ToolCommand = pair.Value;
                }

                else if (IsNameValue(pair, "tool-arguments"))
                {
                    ImportingTool = true;
                    ToolArguments = pair.Value;
                }

                else if (IsNameValue(pair, "tool-initial-dir"))
                {
                    ImportingTool = true;
                    ToolInitialDirectory = pair.Value;
                }
                else if (IsNameValue(pair, "tool-report"))
                {
                    ImportingTool = true;
                    ToolReportTitle = pair.Value;
                }
                else if (IsNameOnly(pair, "tool-output-to-immediate-window"))
                {
                    ImportingTool = true;
                    ToolOutputToImmediateWindow = true;
                }

                else if (IsNameValue(pair, "tool-conflict-resolution"))
                {
                    string input = pair.Value.ToLowerInvariant();
                    if (input == "overwrite")
                    {
                        ResolveToolConflictsBySkipping = false;
                    }
                    if (input == "skip")
                    {
                        ResolveToolConflictsBySkipping = true;
                    }
                }
                else if (IsNameValue(pair, ARG_IMPORT_PEPTIDE_SEARCH_FILE))
                {
                    RequiresSkylineDocument = true;
                    SearchResultsFiles.Add(GetFullPath(pair.Value));
                    CutoffScore = CutoffScore ?? Settings.Default.LibraryResultCutOff;
                }
                else if (IsNameValue(pair, ARG_IMPORT_PEPTIDE_SEARCH_CUTOFF))
                {
                    double? cutoff;
                    try
                    {
                        cutoff = pair.ValueDouble;
                        if (cutoff < 0 || cutoff > 1)
                        {
                            cutoff = null;
                        }
                    }
                    catch
                    {
                        cutoff = null;
                    }
                    if (cutoff.HasValue)
                    {
                        CutoffScore = cutoff.Value;
                    }
                    else
                    {
                        var defaultScore = Settings.Default.LibraryResultCutOff;
                        _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Warning__The_cutoff_score__0__is_invalid__It_must_be_a_value_between_0_and_1_, pair.Value);
                        _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Defaulting_to__0__, defaultScore);
                        CutoffScore = defaultScore;
                    }
                }
                else if (IsNameOnly(pair, ARG_IMPORT_PEPTIDE_SEARCH_MODS))
                {
                    AcceptAllModifications = true;
                }
                else if (IsNameOnly(pair, ARG_IMPORT_PEPTIDE_SEARCH_AMBIGUOUS))
                {
                    IncludeAmbiguousMatches = true;
                }

                // Run each line of a text file like a SkylineRunner command
                else if (IsNameValue(pair, "batch-commands"))
                {
                    BatchCommandsPath = GetFullPath(pair.Value);
                    RunningBatchCommands = true;
                }

                else if (IsNameOnly(pair, "save"))
                {
                    Saving = true;
                    RequiresSkylineDocument = true;
                }

                else if (IsNameValue(pair, "out"))
                {
                    SaveFile = GetFullPath(pair.Value);
                    RequiresSkylineDocument = true;
                }

                else if (IsNameValue(pair, "add-library-name"))
                {
                    LibraryName = pair.Value;
                    RequiresSkylineDocument = true;
                }

                else if (IsNameValue(pair, "add-library-path"))
                {
                    LibraryPath = GetFullPath(pair.Value);
                    RequiresSkylineDocument = true;
                }

                else if (IsNameValue(pair, "import-fasta"))
                {
                    FastaPath = GetFullPath(pair.Value);
                    RequiresSkylineDocument = true;
                }

                else if (IsNameValue(pair, ARG_IMPORT_TRANSITION_LIST))
                {
                    TransitionListPath = GetFullPath(pair.Value);
                    IsTransitionListAssayLibrary = false;
                    RequiresSkylineDocument = true;
                }

                else if (IsNameValue(pair, ARG_IMPORT_ASSAY_LIBRARY))
                {
                    TransitionListPath = GetFullPath(pair.Value);
                    IsTransitionListAssayLibrary = true;
                    RequiresSkylineDocument = true;
                }

                else if (IsNameOnly(pair, ARG_IGNORE_TRANSITION_ERRORS))
                {
                    IsIgnoreTransitionErrors = true;
                }

                else if (IsNameValue(pair, ARG_IRT_STANDARDS_GROUP_NAME))
                {
                    IrtGroupName = pair.Value;
                }

                else if (IsNameValue(pair, ARG_IRT_STANDARDS_FILE))
                {
                    IrtStandardsPath = pair.Value;
                }

                else if (IsNameValue(pair, ARG_IRT_DATABASE_PATH))
                {
                    IrtDatabasePath = pair.Value;
                }

                else if (IsNameValue(pair, ARG_IRT_CALC_NAME))
                {
                    IrtCalcName = pair.Value;
                }

                else if (IsNameValue(pair, ARG_DECOYS_ADD))
                {
                    if (pair.Value == "reversed")
                        AddDecoysType = DecoyGeneration.REVERSE_SEQUENCE;
                    else if (pair.Value == "shuffled")
                        AddDecoysType = DecoyGeneration.SHUFFLE_SEQUENCE;
                    else
                    {
                        _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Error__Invalid_value___0___for__1___use__reversed__or__shuffled__, pair.Value, ARG_DECOYS_ADD);
                        return false;
                    }
                    RequiresSkylineDocument = true;
                }

                else if (IsNameValue(pair, ARG_DECOYS_ADD_COUNT))
                {
                    int count;
                    if (!int.TryParse(pair.Value, out count))
                    {
                        _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Error__The_value___0___for__1__must_be_an_integer_, pair.Value, ARG_DECOYS_ADD_COUNT);
                        return false;
                    }
                    AddDecoysCount = count;
                }

                else if (IsNameOnly(pair, ARG_DECOYS_DISCARD))
                {
                    DiscardDecoys = true;
                    RequiresSkylineDocument = true;
                }

                else if (IsNameOnly(pair, "keep-empty-proteins"))
                {
                    KeepEmptyProteins = true;
                }

                else if (IsNameValue(pair, "import-file"))
                {
                    if (pair.Value.StartsWith(ChorusUrl.ChorusUrlPrefix))
                    {
                        ReplicateFile = MsDataFileUri.Parse(pair.Value);
                    }
                    else
                    {
                        ReplicateFile = new MsDataFilePath(GetFullPath(pair.Value));
                    }
                    RequiresSkylineDocument = true;
                }

                else if (IsNameValue(pair, "import-replicate-name"))
                {
                    ReplicateName = pair.Value;
                    RequiresSkylineDocument = true;
                }

                else if (IsNameValue(pair, ARG_IMPORT_LOCKMASS_POSITIVE))
                {
                    LockmassPositive = ParseDouble(pair.Value, ARG_IMPORT_LOCKMASS_POSITIVE);
                    RequiresSkylineDocument = true;
                }

                else if (IsNameValue(pair, ARG_IMPORT_LOCKMASS_NEGATIVE))
                {
                    LockmassNegative = ParseDouble(pair.Value, ARG_IMPORT_LOCKMASS_NEGATIVE);
                    RequiresSkylineDocument = true;
                }

                else if (IsNameValue(pair, ARG_IMPORT_LOCKMASS_TOLERANCE))
                {
                    LockmassTolerance = ParseDouble(pair.Value, ARG_IMPORT_LOCKMASS_TOLERANCE);
                    RequiresSkylineDocument = true;
                }

                else if (IsNameOnly(pair, "import-append"))
                {
                    ImportAppend = true;
                    RequiresSkylineDocument = true;
                }

                else if (IsNameValue(pair, "import-all"))
                {
                    ImportSourceDirectory = GetFullPath(pair.Value);
                    RequiresSkylineDocument = true;
                }

                else if (IsNameOnly(pair, "import-no-join"))
                {
                    ImportDisableJoining = true;
                    RequiresSkylineDocument = true;
                }
                // ReSharper restore NonLocalizedString

                else if (IsNameValue(pair, "import-naming-pattern")) // Not L10N
                {
                    var importNamingPatternVal = pair.Value;
                    RequiresSkylineDocument = true;
                    if (importNamingPatternVal != null)
                    {
                        try
                        {
                            ImportNamingPattern = new Regex(importNamingPatternVal);
                        }
                        catch (Exception e)
                        {
                            _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Error__Regular_expression__0__cannot_be_parsed_, importNamingPatternVal);
                            _out.WriteLine(e.Message);
                            return false;
                        }

                        Match match = Regex.Match(importNamingPatternVal, @".*\(.+\).*"); // Not L10N
                        if (!match.Success)
                        {
                            _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Error__Regular_expression___0___does_not_have_any_groups___String,
                                importNamingPatternVal);
                            return false;
                        }
                    }
                }

                else if (IsNameValue(pair, "import-optimizing")) // Not L10N
                {
                    try
                    {
                        ImportOptimizeType = pair.Value;
                    }
                    catch (ArgumentException)
                    {
                        _out.WriteLine(
                            Resources.CommandArgs_ParseArgsInternal_Warning__Invalid_optimization_parameter___0____Use__ce____dp___or__none____Defaulting_to_none_,
                            pair.Value);
                    }
                }

                else if (IsNameValue(pair, "import-before")) // Not L10N
                {
                    var importBeforeDate = pair.Value;
                    if (importBeforeDate != null)
                    {
                        try
                        {
                            ImportBeforeDate = Convert.ToDateTime(importBeforeDate);
                        }
                        catch (Exception e)
                        {
                            _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Error__Date__0__cannot_be_parsed_, importBeforeDate);
                            _out.WriteLine(e.Message);
                            return false;
                        }
                    }
                }

                else if (IsNameValue(pair, "import-on-or-after")) // Not L10N
                {
                    var importAfterDate = pair.Value;
                    if (importAfterDate != null)
                    {
                        try
                        {
                            ImportOnOrAfterDate = Convert.ToDateTime(importAfterDate);
                        }
                        catch (Exception e)
                        {
                            _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Error__Date__0__cannot_be_parsed_, importAfterDate);
                            _out.WriteLine(e.Message);
                            return false;
                        }
                    }
                }

                else if (IsNameValue(pair, "remove-all")) // Not L10N
                {
                    RemovingResults = true;
                    RequiresSkylineDocument = true;
                    RemoveBeforeDate = null;
                }
                else if (IsNameValue(pair, "remove-before")) // Not L10N
                {
                    var removeBeforeDate = pair.Value;
                    RemovingResults = true;
                    RequiresSkylineDocument = true;
                    if (removeBeforeDate != null)
                    {
                        try
                        {
                            RemoveBeforeDate = Convert.ToDateTime(removeBeforeDate);
                        }
                        catch (Exception e)
                        {
                            _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Error__Date__0__cannot_be_parsed_, removeBeforeDate);
                            _out.WriteLine(e.Message);
                            return false;
                        }
                    }
                }
                else if (IsNameValue(pair, ARG_REINTEGRATE_MODEL_NAME))
                {
                    ReintegratModelName = pair.Value;
                }
                else if (IsNameOnly(pair, ARG_REINTEGRATE_CREATE_MODEL))
                {
                    IsCreateScoringModel = true;
                    if (!IsSecondBestModel)
                        IsDecoyModel = true;
                }
                else if (IsNameOnly(pair, ARG_REINTEGRATE_ANNOTATE_SCORING))
                {
                    IsAnnotateScoring = true;
                }
                else if (IsNameOnly(pair, ARG_REINTEGRATE_OVERWRITE_PEAKS))
                {
                    IsOverwritePeaks = true;
                }
                else if (IsNameOnly(pair, ARG_REINTEGRATE_MODEL_SECOND_BEST))
                {
                    IsSecondBestModel = true;
                    IsDecoyModel = false;
                }
                else if (IsNameOnly(pair, ARG_REINTEGRATE_MODEL_BOTH))
                {
                    IsSecondBestModel = IsDecoyModel = true;
                }
                else if (IsNameValue(pair, "report-name")) // Not L10N
                {
                    ReportName = pair.Value;
                    RequiresSkylineDocument = true;
                }

                else if (IsNameValue(pair, "report-file")) // Not L10N
                {
                    ReportFile = GetFullPath(pair.Value);
                    RequiresSkylineDocument = true;
                }

                else if (IsNameValue(pair, "report-format")) // Not L10N
                {
                    if (pair.Value.Equals("TSV", StringComparison.CurrentCultureIgnoreCase)) // Not L10N
                        ReportColumnSeparator = TextUtil.SEPARATOR_TSV;
                    else if (pair.Value.Equals("CSV", StringComparison.CurrentCultureIgnoreCase)) // Not L10N
                        ReportColumnSeparator = TextUtil.CsvSeparator;
                    else
                    {
                        _out.WriteLine(
                            Resources.CommandArgs_ParseArgsInternal_Warning__The_report_format__0__is_invalid__It_must_be_either__CSV__or__TSV__,
                            pair.Value);
                        _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Defaulting_to_CSV_);
                        ReportColumnSeparator = TextUtil.CsvSeparator;
                    }
                }

                else if (IsName(pair, "report-invariant")) // Not L10N
                {
                    IsReportInvariant = true;
                }

                else if (IsNameValue(pair, "chromatogram-file")) // Not L10N
                {
                    ChromatogramsFile = GetFullPath(pair.Value);
                    RequiresSkylineDocument = true;
                }

                else if (IsNameOnly(pair, "chromatogram-precursors")) // Not L10N
                {
                    ChromatogramsPrecursors = true;
                }

                else if (IsNameOnly(pair, "chromatogram-products")) // Not L10N
                {
                    ChromatogramsProducts = true;
                }

                else if (IsNameOnly(pair, "chromatogram-base-peaks")) // Not L10N
                {
                    ChromatogramsBasePeaks = true;
                }

                else if (IsNameOnly(pair, "chromatogram-tics")) // Not L10N
                {
                    ChromatogramsTics = true;
                }
                else if (IsNameValue(pair, "exp-translist-instrument")) // Not L10N
                {
                    try
                    {
                        TransListInstrumentType = pair.Value;
                        RequiresSkylineDocument = true;
                    }
                    catch (ArgumentException)
                    {
                        _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Warning__The_instrument_type__0__is_not_valid__Please_choose_from_,
                            pair.Value);
                        foreach (string str in ExportInstrumentType.TRANSITION_LIST_TYPES)
                        {
                            _out.WriteLine(str);
                        }
                        _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_No_transition_list_will_be_exported_);
                    }
                }
                else if (IsNameValue(pair, "exp-method-instrument")) // Not L10N
                {
                    try
                    {
                        MethodInstrumentType = pair.Value;
                        RequiresSkylineDocument = true;
                    }
                    catch (ArgumentException)
                    {
                        _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Warning__The_instrument_type__0__is_not_valid__Please_choose_from_,
                            pair.Value);
                        foreach (string str in ExportInstrumentType.METHOD_TYPES)
                        {
                            _out.WriteLine(str);
                        }
                        _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_No_method_will_be_exported_);
                    }
                }
                else if (IsNameValue(pair, "exp-file")) // Not L10N
                {
                    ExportPath = GetFullPath(pair.Value);
                    RequiresSkylineDocument = true;
                }
                else if (IsNameValue(pair, "exp-strategy")) // Not L10N
                {
                    ExportStrategySet = true;
                    RequiresSkylineDocument = true;

                    string strategy = pair.Value;

                    if (strategy.Equals("single", StringComparison.CurrentCultureIgnoreCase)) // Not L10N
                    {
                        //default
                    }
                    else if (strategy.Equals("protein", StringComparison.CurrentCultureIgnoreCase)) // Not L10N
                        ExportStrategy = ExportStrategy.Protein;
                    else if (strategy.Equals("buckets", StringComparison.CurrentCultureIgnoreCase)) // Not L10N
                        ExportStrategy = ExportStrategy.Buckets;
                    else
                    {
                        _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Warning__The_export_strategy__0__is_not_valid__It_must_be_one_of_the_following___string,
                            pair.Value);
                        //already set to Single
                    }
                }

                else if (IsNameValue(pair, "exp-method-type")) // Not L10N
                {
                    var type = pair.Value;
                    RequiresSkylineDocument = true;
                    if (type.Equals("scheduled", StringComparison.CurrentCultureIgnoreCase)) // Not L10N
                    {
                        ExportMethodType = ExportMethodType.Scheduled;
                    }
                    else if (type.Equals("triggered", StringComparison.CurrentCultureIgnoreCase)) // Not L10N
                    {
                        ExportMethodType = ExportMethodType.Triggered;
                    }
                    else if (type.Equals("standard", StringComparison.CurrentCultureIgnoreCase)) // Not L10N
                    {
                        //default
                    }
                    else
                    {
                        _out.WriteLine(
                            Resources.CommandArgs_ParseArgsInternal_Warning__The_method_type__0__is_invalid__It_must_be_one_of_the_following___standard____scheduled__or__triggered__,
                            pair.Value);
                        _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Defaulting_to_standard_);
                    }
                }

                else if (IsNameValue(pair, "exp-max-trans")) // Not L10N
                {
                    //This one can't be kept within bounds because the bounds depend on the instrument
                    //and the document.
                    try
                    {
                        MaxTransitionsPerInjection = pair.ValueInt;
                    }
                    catch
                    {
                        _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Warning__Invalid_max_transitions_per_injection_parameter___0___, pair.Value);
                        _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_It_must_be_a_number__Defaulting_to__0__, AbstractMassListExporter.MAX_TRANS_PER_INJ_DEFAULT);
                        MaxTransitionsPerInjection = AbstractMassListExporter.MAX_TRANS_PER_INJ_DEFAULT;
                    }
                    RequiresSkylineDocument = true;
                }

                else if (IsNameValue(pair, "exp-optimizing")) // Not L10N
                {
                    try
                    {
                        ExportOptimizeType = pair.Value;
                    }
                    catch (ArgumentException)
                    {
                        _out.WriteLine(
                            Resources.CommandArgs_ParseArgsInternal_Warning__Invalid_optimization_parameter___0____Use__ce____dp___or__none__,
                            pair.Value);
                        _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Defaulting_to_none_);
                    }
                    RequiresSkylineDocument = true;
                }
                else if (IsNameValue(pair, "exp-scheduling-replicate")) // Not L10N
                {
                    SchedulingReplicate = pair.Value;
                    RequiresSkylineDocument = true;
                }
                else if (IsNameValue(pair, "exp-template")) // Not L10N
                {
                    TemplateFile = GetFullPath(pair.Value);
                    RequiresSkylineDocument = true;
                }
                else if (IsNameOnly(pair, "exp-ignore-proteins")) // Not L10N
                {
                    IgnoreProteins = true;
                    RequiresSkylineDocument = true;
                }
                else if (IsNameValue(pair, "exp-primary-count")) // Not L10N
                {
                    try
                    {
                        PrimaryTransitionCount = pair.ValueInt;
                    }
                    catch
                    {
                        _out.WriteLine(
                            Resources.CommandArgs_ParseArgsInternal_Warning__The_primary_transition_count__0__is_invalid__it_must_be_a_number_between__1__and__2__,
                            pair.Value,
                            AbstractMassListExporter.PRIMARY_COUNT_MIN, AbstractMassListExporter.PRIMARY_COUNT_MAX);
                        _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Defaulting_to__0__, AbstractMassListExporter.PRIMARY_COUNT_DEFAULT);
                    }
                    RequiresSkylineDocument = true;
                }
                else if (IsNameValue(pair, "exp-dwell-time")) // Not L10N
                {
                    try
                    {
                        DwellTime = pair.ValueInt;
                    }
                    catch
                    {
                        _out.WriteLine(
                            Resources.CommandArgs_ParseArgsInternal_Warning__The_dwell_time__0__is_invalid__it_must_be_a_number_between__1__and__2__,
                            pair.Value,
                            AbstractMassListExporter.DWELL_TIME_MIN, AbstractMassListExporter.DWELL_TIME_MAX);
                        _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Defaulting_to__0__, AbstractMassListExporter.DWELL_TIME_DEFAULT);
                    }
                    RequiresSkylineDocument = true;
                }
                else if (IsNameOnly(pair, "exp-add-energy-ramp")) // Not L10N
                {
                    AddEnergyRamp = true;
                    RequiresSkylineDocument = true;
                }
                else if (IsNameOnly(pair, "exp-use-s-lens")) // Not L10N
                {
                    UseSlens = true;
                    RequiresSkylineDocument = true;
                }
                else if (IsNameValue(pair, "exp-run-length")) // Not L10N
                {
                    try
                    {
                        RunLength = pair.ValueInt;
                    }
                    catch
                    {
                        _out.WriteLine(
                            Resources
                                .CommandArgs_ParseArgsInternal_Warning__The_run_length__0__is_invalid__It_must_be_a_number_between__1__and__2__,
                            pair.Value,
                            AbstractMassListExporter.RUN_LENGTH_MIN, AbstractMassListExporter.RUN_LENGTH_MAX);
                        _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Defaulting_to__0__,
                            AbstractMassListExporter.RUN_LENGTH_DEFAULT);
                    }
                    RequiresSkylineDocument = true;
                }
                else if (IsNameValue(pair, PANORAMA_SERVER_URI))
                {
                    PanoramaServerUri = pair.Value;
                }
                else if (IsNameValue(pair, PANORAMA_USERNAME))
                {
                    PanoramaUserName = pair.Value;
                }
                else if (IsNameValue(pair, PANORAMA_PASSWD))
                {
                    PanoramaPassword = pair.Value;
                }
                else if (IsNameValue(pair, PANORAMA_FOLDER))
                {
                    PanoramaFolder = pair.Value;
                }
                else if (IsName(pair, "share-zip")) // Not L10N
                {
                    SharingZipFile = true;
                    RequiresSkylineDocument = true;
                    if (!string.IsNullOrEmpty(pair.Value))
                    {
                        SharedFile = pair.Value;
                    }
                }
                else
                {
                    _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Error__Unexpected_argument____0_, pair.Name);
                    return false;
                }
            }

            if (Reintegrating)
                RequiresSkylineDocument = true;
            else
            {
                if (IsCreateScoringModel)
                    WarnArgRequirment(ARG_REINTEGRATE_MODEL_NAME, ARG_REINTEGRATE_CREATE_MODEL);
                if (IsAnnotateScoring)
                    WarnArgRequirment(ARG_REINTEGRATE_MODEL_NAME, ARG_REINTEGRATE_ANNOTATE_SCORING);
                if (IsOverwritePeaks)
                    WarnArgRequirment(ARG_REINTEGRATE_MODEL_NAME, ARG_REINTEGRATE_OVERWRITE_PEAKS);
            }
            if (FullScanPrecursorResMz.HasValue && !FullScanPrecursorRes.HasValue)
                WarnArgRequirment(ARG_FULL_SCAN_PRECURSOR_RES, ARG_FULL_SCAN_PRECURSOR_RES_MZ);
            if (FullScanProductResMz.HasValue && !FullScanProductRes.HasValue)
                WarnArgRequirment(ARG_FULL_SCAN_PRODUCT_RES, ARG_FULL_SCAN_PRODUCT_RES_MZ);
            if (!IsCreateScoringModel && IsSecondBestModel)
            {
                if (IsDecoyModel)
                    WarnArgRequirment(ARG_REINTEGRATE_CREATE_MODEL, ARG_REINTEGRATE_MODEL_BOTH);
                else
                    WarnArgRequirment(ARG_REINTEGRATE_CREATE_MODEL, ARG_REINTEGRATE_MODEL_SECOND_BEST);
            }
            if (!AddDecoys && AddDecoysCount.HasValue)
            {
                WarnArgRequirment(ARG_DECOYS_ADD, ARG_DECOYS_ADD_COUNT);
            }
            if (!ImportingTransitionList)
            {
                if (IsIgnoreTransitionErrors)
                    WarnArgRequirment(ARG_IMPORT_TRANSITION_LIST, ARG_IGNORE_TRANSITION_ERRORS);
            }
            if (!ImportingTransitionList || !IsTransitionListAssayLibrary)
            {
                if (!string.IsNullOrEmpty(IrtGroupName))
                    WarnArgRequirment(ARG_IMPORT_ASSAY_LIBRARY, ARG_IRT_STANDARDS_GROUP_NAME);
                if (!string.IsNullOrEmpty(IrtStandardsPath))
                    WarnArgRequirment(ARG_IMPORT_ASSAY_LIBRARY, ARG_IRT_STANDARDS_FILE);
            }
            if (!string.IsNullOrEmpty(PanoramaServerUri) || !string.IsNullOrEmpty(PanoramaFolder))
            {
                if (!PanoramaArgsComplete())
                {
                    return false;
                }

                var serverUri = PanoramaUtil.ServerNameToUri(PanoramaServerUri);
                if (serverUri == null)
                {
                    _out.WriteLine(Resources.EditServerDlg_OkDialog_The_text__0__is_not_a_valid_server_name_,
                        PanoramaServerUri);
                    return false;
                }

                var panoramaClient = new WebPanoramaClient(serverUri);
                var panoramaHelper = new PanoramaHelper(_out);
                PanoramaServer = panoramaHelper.ValidateServer(panoramaClient, PanoramaUserName, PanoramaPassword);
                if (PanoramaServer == null)
                {
                    return false;
                }

                if (!panoramaHelper.ValidateFolder(panoramaClient, PanoramaServer, PanoramaFolder))
                {
                    return false;
                }

                RequiresSkylineDocument = true;
                PublishingToPanorama = true;
            }
            if (!ImportingSearch)
            {
                if (CutoffScore.HasValue)
                    WarnArgRequirment(ARG_IMPORT_PEPTIDE_SEARCH_FILE, ARG_IMPORT_PEPTIDE_SEARCH_CUTOFF);
                if (AcceptAllModifications)
                    WarnArgRequirment(ARG_IMPORT_PEPTIDE_SEARCH_FILE, ARG_IMPORT_PEPTIDE_SEARCH_MODS);
                if (IncludeAmbiguousMatches)
                    WarnArgRequirment(ARG_IMPORT_PEPTIDE_SEARCH_FILE, ARG_IMPORT_PEPTIDE_SEARCH_AMBIGUOUS);
            }

            // If skylineFile isn't set and one of the commands that requires --in is called, complain.
            if (String.IsNullOrEmpty(SkylineFile) && RequiresSkylineDocument && !_isDocumentLoaded)
            {
                _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Error__Use___in_to_specify_a_Skyline_document_to_open_);
                return false;
            }

            if(ImportingReplicateFile && ImportingSourceDirectory)
            {
                _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Error____import_file_and___import_all_options_cannot_be_used_simultaneously_);
                return false;
            }
            if(ImportingReplicateFile && ImportNamingPattern != null)
            {
                _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Error____import_naming_pattern_cannot_be_used_with_the___import_file_option_);
                return false;
            }
            if(ImportingSourceDirectory && !string.IsNullOrEmpty(ReplicateName))
            {
                _out.WriteLine(Resources.CommandArgs_ParseArgsInternal_Error____import_replicate_name_cannot_be_used_with_the___import_all_option_);
                return false;
            }

            // Use the original file as the output file, if not told otherwise.
            if (Saving && String.IsNullOrEmpty(SaveFile))
            {
                SaveFile = SkylineFile;
            }
            return true;
        }
Example #24
0
 public string InstallProgram(ProgramPathContainer missingProgramPathContainer, ICollection<ToolPackage> packages, string pathToInstallScript)
 {
     if (packages.Count > 0 && !packagesHandled)
     {
         _out.WriteLine(Resources.AddZipToolHelper_InstallProgram_Error__Package_installation_not_handled_in_SkylineRunner___If_you_have_already_handled_package_installation_use_the___tool_ignore_required_packages_flag);
         return null;
     }
     string path;
     return Settings.Default.ToolFilePaths.TryGetValue(missingProgramPathContainer, out path) ? path : FindProgramPath(missingProgramPathContainer);
 }
 private static void InstallProgram(ProgramPathContainer ppc, IEnumerable<string> packageUris, bool installed)
 {
     using (var dlg = new PythonInstaller(ppc, packageUris, installed, null))
     {
         // Keep OK button from doing anything ever
         dlg.TestRunProcess = new TestRunProcess { ExitCode = 0 };
         dlg.ShowDialog();
     }
 }
Example #26
0
 public void AddInstallation(ProgramPathContainer ppc, List<ToolPackage> packages )
 {
     List<ToolPackage> listPackages;
     if (Installations.TryGetValue(ppc, out listPackages))
     {
         listPackages.AddRange(packages.Where(p => !listPackages.Contains(p)));
     }
     else
     {
         Installations.Add(ppc, packages);
     }
 }
Example #27
0
 private void TestPackageVersioning()
 {
     IUnpackZipToolSupport support = new UnpackZipToolTestSupport();
     string version1 = TestFilesDir.GetTestPath("TestPackageVersioning.zip");
     var retval = ToolInstaller.UnpackZipTool(version1, support);
     Assert.AreEqual(1, retval.Installations.Count);
     ProgramPathContainer ppc = new ProgramPathContainer("BogusProgram","3.0.0");
     var ListPackages = retval.Installations[ppc];
     Assert.AreEqual(3, ListPackages.Count);
     Assert.AreEqual("TestPAckages", ListPackages[0].Name);
     Assert.AreEqual("7.3-28",ListPackages[0].Version);
     Assert.AreEqual("TestOtherPAckage",ListPackages[1].Name);
     Assert.AreEqual("3.2.3",ListPackages[1].Version);
     Assert.AreEqual("noVersionPackage", ListPackages[2].Name);
     Assert.AreEqual(null,ListPackages[2].Version);
 }
 private static PythonInstaller FormatPackageInstaller(bool cancelDownload, bool downloadSuccess,
     bool connectSuccess, bool installSuccess, IEnumerable<string> packageUris)
 {
     var ppc = new ProgramPathContainer(PYTHON, VERSION_27);
     var pythonInstaller = ShowDialog<PythonInstaller>(() => InstallProgram(ppc, packageUris, true));
     WaitForConditionUI(() => pythonInstaller.IsLoaded);
     RunUI(() =>
         {
             pythonInstaller.TestDownloadClient = new TestAsynchronousDownloadClient
                 {
                     CancelDownload = cancelDownload,
                     DownloadSuccess = downloadSuccess
                 };
             pythonInstaller.TestSkylineProcessRunner = new TestSkylineProcessRunner
                 {
                     ConnectSuccess = connectSuccess,
                     ExitCode = installSuccess ? 0 : 1
                 };
         });
     return pythonInstaller;
 }
Example #29
0
 public string InstallProgram(ProgramPathContainer ppc, ICollection<ToolPackage> packages, string pathToInstallScript)
 {
     return string.Empty;
 }
Example #30
0
 public AddZipToolHelper(CommandLine.ResolveZipToolConflicts? howToResolve, bool? howToResolveAnnotations,
     CommandStatusWriter output,
     string fileName, ProgramPathContainer ppc, string inputProgramPath,
     bool arePackagesHandled)
 {
     resolveToolsAndReports = howToResolve;
     overwriteAnnotations = howToResolveAnnotations;
     _out = output;
     zipFileName = fileName;
     programPathContainer = ppc;
     programPath = inputProgramPath;
     packagesHandled = arePackagesHandled;
 }
Example #31
0
 public string FindProgramPath(ProgramPathContainer missingProgramPathContainer)
 {
     if ((Equals(programPathContainer, missingProgramPathContainer)) && programPath != null)
     {
         //add to settings list
         Settings.Default.ToolFilePaths.Add(programPathContainer,programPath);
         return programPath;
     }
     _out.WriteLine(Resources.AddZipToolHelper_FindProgramPath_A_tool_requires_Program__0__Version__1__and_it_is_not_specified_with_the___tool_program_macro_and___tool_program_path_commands__Tool_Installation_Canceled_, missingProgramPathContainer.ProgramName, missingProgramPathContainer.ProgramVersion);
     return null;
 }
 private static PythonInstaller FormatPythonInstaller(bool cancelDownload, bool downloadSuccess,
     bool installSuccess)
 {
     var ppc = new ProgramPathContainer(PYTHON, VERSION_27);
     // ReSharper disable once CollectionNeverUpdated.Local
     var packageUris = new Collection<string>();
     var pythonInstaller = ShowDialog<PythonInstaller>(() => InstallProgram(ppc, packageUris, false));
     WaitForConditionUI(() => pythonInstaller.IsLoaded);
     RunUI(() =>
         {
             pythonInstaller.TestDownloadClient = new TestAsynchronousDownloadClient
                 {
                     CancelDownload = cancelDownload,
                     DownloadSuccess = downloadSuccess
                 };
             pythonInstaller.TestRunProcess = new TestRunProcess {ExitCode = installSuccess ? 0 : 1};
         });
     return pythonInstaller;
 }
Example #33
0
 public void ImportToolsFromZip(string path, ResolveZipToolConflicts? resolveConflicts, bool? overwriteAnnotations, ProgramPathContainer ppc, string programPath, bool arePackagesHandled)
 {
     if (string.IsNullOrEmpty(path))
     {
         _out.WriteLine(Resources.CommandLine_ImportToolsFromZip_Error__to_import_tools_from_a_zip_you_must_specify_a_path___tool_add_zip_must_be_followed_by_an_existing_path_);
         return;
     }
     if (!File.Exists(path))
     {
         _out.WriteLine(Resources.CommandLine_ImportToolsFromZip_Error__the_file_specified_with_the___tool_add_zip_command_does_not_exist__Please_verify_the_file_location_and_try_again_);
         return;
     }
     if (Path.GetExtension(path) != ".zip") // Not L10N
     {
         _out.WriteLine(Resources.CommandLine_ImportToolsFromZip_Error__the_file_specified_with_the___tool_add_zip_command_is_not_a__zip_file__Please_specify_a_valid__zip_file_);
         return;
     }
     string filename = Path.GetFileName(path);
     _out.WriteLine(Resources.CommandLine_ImportToolsFromZip_Installing_tools_from__0_, filename);
     ToolInstaller.UnzipToolReturnAccumulator result = null;
     try
     {
         result = ToolInstaller.UnpackZipTool(path, new AddZipToolHelper(resolveConflicts, overwriteAnnotations, _out, filename, ppc,
                                                                        programPath, arePackagesHandled));
     }
     catch (ToolExecutionException x)
     {
         _out.WriteLine(x.Message);
     }
     if (result != null)
     {
         foreach (var message in result.MessagesThrown)
         {
             _out.WriteLine(message);
         }
         foreach (var tool in result.ValidToolsFound)
         {
             _out.WriteLine(Resources.CommandLine_ImportToolsFromZip_Installed_tool__0_, tool.Title);
         }
         Settings.Default.Save();
     }
     else
     {
         _out.WriteLine(Resources.CommandLine_ImportToolsFromZip_Canceled_installing_tools_from__0__, filename);
     }
 }
Example #34
0
 public string InstallProgram(ProgramPathContainer programPathContainer,
                              ICollection <ToolPackage> packages,
                              string pathToInstallScript)
 {
     return(_installProgram(programPathContainer, packages, pathToInstallScript));
 }
Example #35
0
 public RInstaller(ProgramPathContainer rPathContainer, ICollection<ToolPackage> packages, TextWriter writer, string pathToInstallScript)
     : this(rPathContainer, packages, RUtil.CheckInstalled(rPathContainer.ProgramVersion), writer, pathToInstallScript)
 {
 }
 // Python is installed and there are packages to install
 private static void TestDlgLoadPackagesOnly()
 {
     var ppc = new ProgramPathContainer(PYTHON, VERSION_27);
     var packageUris = new Collection<string> { EXE_PACKAGE, TARGZ_PACKAGE, ZIP_PACKAGE, LOCAL_EXE_PACKAGE, LOCAL_TARGZ_PACKAGE, LOCAL_ZIP_PACKAGE };
     var pythonInstaller = ShowDialog<PythonInstaller>(() => InstallProgram(ppc, packageUris, true));
     WaitForConditionUI(5 * 1000, () => pythonInstaller.IsLoaded);
     RunUI(() => Assert.AreEqual(Resources.PythonInstaller_PythonInstaller_Load_This_tool_requires_the_following_Python_packages__Select_packages_to_install_and_then_click_Install_to_begin_the_installation_process_, pythonInstaller.Message));
     OkDialog(pythonInstaller, () => Cancel(pythonInstaller));
 }
Example #37
0
 public string InstallProgram(ProgramPathContainer programPathContainer,
     ICollection<ToolPackage> packages,
     string pathToInstallScript)
 {
     return _installProgram(programPathContainer, packages, pathToInstallScript);
 }
Example #38
0
 public string InstallProgram(ProgramPathContainer ppc, ICollection <ToolPackage> packages, string pathToInstallScript)
 {
     return(string.Empty);
 }
Example #39
0
        public void TestInstallFromZip()
        {
            // Using clause here overwrites failure exception when it fails
            var movedDir = new MovedDirectory(ToolDescriptionHelpers.GetToolsDirectory(), Program.StressTest);
            try
            {
                Settings.Default.ToolList.Clear();
                var testFilesDir = new TestFilesDir(TestContext, COMMAND_FILE);
                {
                    // Test bad input
                    const string badFileName = "BadFilePath";
                    Assert.IsFalse(File.Exists(badFileName));
                    const string command = "--tool-add-zip=" + badFileName;
                    string output = RunCommand(command);
                    Assert.IsTrue(output.Contains(Resources.CommandLine_ImportToolsFromZip_Error__the_file_specified_with_the___tool_add_zip_command_does_not_exist__Please_verify_the_file_location_and_try_again_));
                }
                {
                    string notZip = testFilesDir.GetTestPath("Broken_file.sky");
                    Assert.IsTrue(File.Exists(notZip));
                    string command = "--tool-add-zip=" + notZip;
                    string output = RunCommand(command);
                    Assert.IsTrue(output.Contains(Resources.CommandLine_ImportToolsFromZip_Error__the_file_specified_with_the___tool_add_zip_command_is_not_a__zip_file__Please_specify_a_valid__zip_file_));
                }
                {
                    var uniqueReportZip = testFilesDir.GetTestPath("UniqueReport.zip");
                    Assert.IsTrue(File.Exists(uniqueReportZip));
                    string command = "--tool-add-zip=" + uniqueReportZip;
                    string output = RunCommand(command);

                    Assert.IsTrue(Settings.Default.ToolList.Count == 1);
                    ToolDescription newTool = Settings.Default.ToolList.Last();
                    Assert.AreEqual("HelloWorld", newTool.Title);
                    Assert.IsTrue(newTool.OutputToImmediateWindow);
                    Assert.AreEqual("UniqueReport", newTool.ReportTitle);
                    string path = newTool.ToolDirPath;
                    Assert.IsTrue(File.Exists(Path.Combine(path, "HelloWorld.exe")));
                    Assert.IsTrue(output.Contains(string.Format(Resources.CommandLine_ImportToolsFromZip_Installed_tool__0_,"HelloWorld")));
                    //Try to add the same tool again. Get conflicting report and tool with no overwrite specified.
                    string output1 = RunCommand(command);
                    Assert.IsTrue(output1.Contains(string.Format(Resources.AddZipToolHelper_ShouldOverwrite_Error__There_is_a_conflicting_tool + Resources.AddZipToolHelper_ShouldOverwrite__in_the_file__0_, "UniqueReport.zip")));
                    Assert.IsTrue(
                        output1.Contains(
                            Resources.AddZipToolHelper_ShouldOverwrite_Please_specify__overwrite__or__parallel__with_the___tool_zip_conflict_resolution_command_));
                    //Now run with overwrite specified.
                    string output2 = RunCommand(command, "--tool-zip-conflict-resolution=overwrite");
                    Assert.IsTrue(output2.Contains(string.Format(Resources.AddZipToolHelper_ShouldOverwrite_Overwriting_tool___0_,"HelloWorld")));
                    //Now install in parallel.
                    string output3 = RunCommand(command, "--tool-zip-conflict-resolution=parallel");
                    Assert.IsTrue(output3.Contains(string.Format(Resources.CommandLine_ImportToolsFromZip_Installed_tool__0_, "HelloWorld1")));
                    ToolDescription newTool1 = Settings.Default.ToolList.Last();
                    Assert.AreEqual("HelloWorld1", newTool1.Title);
                    Assert.IsTrue(newTool1.OutputToImmediateWindow);
                    Assert.AreEqual("UniqueReport", newTool1.ReportTitle);
                    string path1 = newTool1.ToolDirPath;
                    Assert.IsTrue(File.Exists(Path.Combine(path1, "HelloWorld.exe")));
                    //Cleanup.
                    Settings.Default.ToolList.Clear();
                    DirectoryEx.SafeDelete(ToolDescriptionHelpers.GetToolsDirectory());
                    Settings.Default.PersistedViews.RemoveView(PersistedViews.ExternalToolsGroup.Id, "UniqueReport");
                    Settings.Default.PersistedViews.RemoveView(PersistedViews.ExternalToolsGroup.Id, "UniqueReport1");
                }
                {
                    //Test working with packages and ProgramPath Macro.
                    var testCommandLine = testFilesDir.GetTestPath("TestCommandLine.zip");
                    Assert.IsTrue(File.Exists(testCommandLine));
                    string command = "--tool-add-zip=" + testCommandLine;
                    string output = RunCommand(command);
                    StringAssert.Contains(output, Resources.AddZipToolHelper_InstallProgram_Error__Package_installation_not_handled_in_SkylineRunner___If_you_have_already_handled_package_installation_use_the___tool_ignore_required_packages_flag);
                    string output1 = RunCommand(command, "--tool-ignore-required-packages");
                    StringAssert.Contains(output1, string.Format(
                        Resources.AddZipToolHelper_FindProgramPath_A_tool_requires_Program__0__Version__1__and_it_is_not_specified_with_the___tool_program_macro_and___tool_program_path_commands__Tool_Installation_Canceled_,
                        "Bogus",
                        "2.15.2"));

                    string path = testFilesDir.GetTestPath("NumberWriter.exe");
                    string output2 = RunCommand(command, "--tool-ignore-required-packages",
                                                "--tool-program-macro=Bogus,2.15.2",
                                                "--tool-program-path=" + path);

                    StringAssert.Contains(output2, string.Format(Resources.CommandLine_ImportToolsFromZip_Installed_tool__0_, "TestCommandline"));
                    ToolDescription newTool = Settings.Default.ToolList.Last();
                    Assert.AreEqual("TestCommandline", newTool.Title);
                    Assert.AreEqual("$(ProgramPath(Bogus,2.15.2))", newTool.Command);
                    Assert.AreEqual("100 12", newTool.Arguments);
                    ProgramPathContainer ppc = new ProgramPathContainer("Bogus", "2.15.2");
                    Assert.IsTrue(Settings.Default.ToolFilePaths.ContainsKey(ppc));
                    Assert.AreEqual(path, Settings.Default.ToolFilePaths[ppc]);
                    Settings.Default.ToolFilePaths.Remove(ppc);
                    Settings.Default.ToolList.Clear();
                    DirectoryEx.SafeDelete(ToolDescriptionHelpers.GetToolsDirectory());
                }
                {
                    //Test working with annotations.
                    var testCommandLine = testFilesDir.GetTestPath("TestAnnotations.zip");
                    Assert.IsTrue(File.Exists(testCommandLine));
                    string command = "--tool-add-zip=" + testCommandLine;
                    string output = RunCommand(command);
                    Assert.IsTrue(output.Contains(string.Format(Resources.CommandLine_ImportToolsFromZip_Installed_tool__0_, "AnnotationTest\\Tool1")));
                    Assert.IsTrue(output.Contains(string.Format(Resources.CommandLine_ImportToolsFromZip_Installed_tool__0_, "AnnotationTest\\Tool2")));
                    Assert.IsTrue(output.Contains(string.Format(Resources.CommandLine_ImportToolsFromZip_Installed_tool__0_, "AnnotationTest\\Tool3")));
                    Assert.IsTrue(output.Contains(string.Format(Resources.CommandLine_ImportToolsFromZip_Installed_tool__0_, "AnnotationTest\\Tool4")));
                }
                {
                    var conflictingAnnotations = testFilesDir.GetTestPath("ConflictAnnotations.zip");
                    Assert.IsTrue(File.Exists(conflictingAnnotations));
                    string command = "--tool-add-zip=" + conflictingAnnotations;
                    string output = RunCommand(command);
                    Assert.IsTrue(
                        output.Contains(string.Format(Resources.AddZipToolHelper_ShouldOverwriteAnnotations_There_are_annotations_with_conflicting_names__Please_use_the___tool_zip_overwrite_annotations_command_)));
                    output = RunCommand(command, "--tool-zip-overwrite-annotations=false");
                    Assert.IsTrue(output.Contains(string.Format(Resources.AddZipToolHelper_ShouldOverwriteAnnotations_There_are_conflicting_annotations__Keeping_existing_)));
                    Assert.IsTrue(
                        output.Contains(
                            string.Format(
                                Resources.AddZipToolHelper_ShouldOverwriteAnnotations_Warning__the_annotation__0__may_not_be_what_your_tool_requires_,
                                "SampleID")));

                    output = RunCommand(command, "--tool-zip-overwrite-annotations=true");
                    Assert.IsTrue(output.Contains(string.Format(Resources.AddZipToolHelper_ShouldOverwriteAnnotations_There_are_conflicting_annotations__Overwriting_)));
                    Assert.IsTrue(output.Contains(string.Format(Resources.AddZipToolHelper_ShouldOverwriteAnnotations_Warning__the_annotation__0__is_being_overwritten,"SampleID")));

                    Settings.Default.AnnotationDefList = new AnnotationDefList();
                    Settings.Default.ToolList.Clear();
                    DirectoryEx.SafeDelete(ToolDescriptionHelpers.GetToolsDirectory());
                }
            }
            finally
            {
                try { movedDir.Dispose(); }
            // ReSharper disable once EmptyGeneralCatchClause
                catch (Exception) {}
            }
        }
Example #40
0
 // helper method to simulate the creation of the InstallR dialog, so we can use our test installer
 private static void InstallProgram(ProgramPathContainer ppc, ICollection<ToolPackage> packages, bool installed, TextWriter writer = null)
 {
     using (var dlg = new RInstaller(ppc, packages, installed, writer, null))
     {
         // Keep OK button from doing anything ever
         dlg.TestRunProcess = new TestRunProcess { ExitCode = 0 };
         dlg.ShowDialog();
     }
 }