public bool SetLibrary(string name, string path, bool append = true) { if (string.IsNullOrWhiteSpace(path)) { _out.WriteLine(Resources.CommandLine_SetLibrary_Error__Cannot_set_library_name_without_path_); return false; } else if (!File.Exists(path)) { _out.WriteLine(Resources.CommandLine_SetLibrary_Error__The_file__0__does_not_exist_, path); return false; } else if (path.EndsWith(BiblioSpecLiteSpec.EXT_REDUNDANT)) { _out.WriteLine(Resources.CommandLine_SetLibrary_Error__The_file__0__appears_to_be_a_redundant_library_); return false; } if (string.IsNullOrWhiteSpace(name)) name = Path.GetFileNameWithoutExtension(path); LibrarySpec librarySpec; string ext = Path.GetExtension(path); if (Equals(ext, BiblioSpecLiteSpec.EXT)) librarySpec = new BiblioSpecLiteSpec(name, path); else if (Equals(ext, BiblioSpecLibSpec.EXT)) librarySpec = new BiblioSpecLibSpec(name, path); else if (Equals(ext, XHunterLibSpec.EXT)) librarySpec = new XHunterLibSpec(name, path); else if (Equals(ext, NistLibSpec.EXT)) librarySpec = new NistLibSpec(name, path); else if (Equals(ext, SpectrastSpec.EXT)) librarySpec = new SpectrastSpec(name, path); else { _out.WriteLine(Resources.CommandLine_SetLibrary_Error__The_file__0__is_not_a_supported_spectral_library_file_format_, path); return false; } // Check for conflicting names foreach (var docLibrarySpec in _doc.Settings.PeptideSettings.Libraries.LibrarySpecs) { if (docLibrarySpec.Name == librarySpec.Name || docLibrarySpec.FilePath == librarySpec.FilePath) { _out.WriteLine(Resources.CommandLine_SetLibrary_Error__The_library_you_are_trying_to_add_conflicts_with_a_library_already_in_the_file_); return false; } } var librarySpecs = append ? new List<LibrarySpec>(_doc.Settings.PeptideSettings.Libraries.LibrarySpecs) { librarySpec } : new List<LibrarySpec>{ librarySpec }; SrmSettings newSettings = _doc.Settings.ChangePeptideLibraries(l => l.ChangeLibrarySpecs(librarySpecs)); _doc = _doc.ChangeSettings(newSettings); return true; }
public bool Equals(SpectrastSpec other) { return(base.Equals(other)); }
public bool Equals(SpectrastSpec other) { return base.Equals(other); }