private static void ShowErrorMessage(string message, IEnumerable <string> items) { ConsoleMsgUtils.ShowErrors(message, items); }
private static void ShowErrorMessage(string message, IEnumerable <string> additionalInfo) { ConsoleMsgUtils.ShowErrors(message, additionalInfo); }
private static void ShowErrorMessage(string title, IEnumerable <string> errorMessages) { ConsoleMsgUtils.ShowErrors(title, errorMessages); }
private static bool SetOptionsUsingCommandLineParameters(clsParseCommandLine commandLineParser, SplitterOptions options) { // Returns True if no problems; otherwise, returns false var validParameters = new List <string> { "I", "N", "MB", "O", "P", "S", "A", "R", "L" }; try { // Make sure no invalid parameters are present if (commandLineParser.InvalidParametersPresent(validParameters)) { ConsoleMsgUtils.ShowErrors("Invalid command line parameters", (from item in commandLineParser.InvalidParameters(validParameters) select("/" + item)).ToList()); return(false); } // Query commandLineParser to see if various parameters are present if (commandLineParser.RetrieveValueForParameter("I", out var inputFilePath)) { mInputFilePath = inputFilePath; } else if (commandLineParser.NonSwitchParameterCount > 0) { mInputFilePath = commandLineParser.RetrieveNonSwitchParameter(0); } if (commandLineParser.RetrieveValueForParameter("N", out var splitCount)) { if (int.TryParse(splitCount, out var value)) { options.SplitCount = value; } else { ConsoleMsgUtils.ShowError( "Error parsing number from the /N parameter; " + "for example, use /N:{0} to specify the file be split into {0} parts", SplitterOptions.DEFAULT_SPLIT_COUNT); options.SplitCount = SplitterOptions.DEFAULT_SPLIT_COUNT; } } if (commandLineParser.RetrieveValueForParameter("MB", out var targetSizeMB)) { options.UseTargetFileSize = true; if (int.TryParse(targetSizeMB, out var value)) { options.TargetFastaFileSizeMB = value; } else { ConsoleMsgUtils.ShowError( "Error parsing number from the /MB parameter; " + "for example, use /MB:{0} to specify the file be split into files that are each {0} MB in size", SplitterOptions.DEFAULT_TARGET_FILE_SIZE_MB); options.TargetFastaFileSizeMB = SplitterOptions.DEFAULT_TARGET_FILE_SIZE_MB; } } if (commandLineParser.RetrieveValueForParameter("O", out var outputDirectory)) { mOutputDirectoryName = outputDirectory; } if (commandLineParser.RetrieveValueForParameter("P", out var parameterFile)) { mParameterFilePath = parameterFile; } if (commandLineParser.RetrieveValueForParameter("S", out var recurseSubdirectories)) { mRecurseDirectories = true; if (!int.TryParse(recurseSubdirectories, out mMaxLevelsToRecurse)) { mMaxLevelsToRecurse = 0; } } if (commandLineParser.RetrieveValueForParameter("A", out var alternateOutputDirectory)) { mOutputDirectoryAlternatePath = alternateOutputDirectory; } if (commandLineParser.IsParameterPresent("R")) { mRecreateDirectoryHierarchyInAlternatePath = true; } if (commandLineParser.IsParameterPresent("L")) { mLogMessagesToFile = true; } return(true); } catch (Exception ex) { ConsoleMsgUtils.ShowError("Error parsing the command line parameters", ex); return(false); } }