/// <summary> /// Load the wiff file's content. /// </summary> /// <returns>A <see cref="bool"/> value indicating the success of the loading.</returns> public bool LoadContent() { bool result; var dataProvider = new AnalystWiffDataProvider(); // We're going to extract the Maldi parameters at this point. this.strmaldiparameters = this.GetMaldiParameters(this.fileName); try { // get wiff file object from given file Batch wiffFile = AnalystDataProviderFactory.CreateBatch(this.fileName, dataProvider); // get number of samples string[] sampleNames = wiffFile.GetSampleNames(); int numOfSamples = sampleNames.GetLength(0); // create sample objects for all the samples present in the wiff file for (int actSample = 0; actSample < numOfSamples; actSample++) { // create and add the sample to this objects list of samples... var sample = new WiffSample(wiffFile, this, actSample, this.strmaldiparameters); this.samples.Add(sample); } result = true; } catch (Exception e) { Util.ReportException(e); result = false; } return(result); }
public WiffFileReader(string wiffFilePath, string licenseFilePath) { if (string.IsNullOrWhiteSpace(wiffFilePath)) { throw new ArgumentNullException("wiffFilePath"); } if (string.IsNullOrWhiteSpace(licenseFilePath)) { throw new ArgumentNullException("licenseFilePath"); } if (!File.Exists(wiffFilePath)) { throw new FileNotFoundException("Wiff file not exists."); } try { ReadWiffLicense(licenseFilePath); this.dataProvider = new AnalystWiffDataProvider(true); this.batch = AnalystDataProviderFactory.CreateBatch(wiffFilePath, dataProvider); this.wiffFilePath = wiffFilePath; this.model = MzLiteJson.HandleExternalModelFile(this, GetModelFilePath()); } catch (Exception ex) { throw new MzLiteIOException(ex.Message, ex); } }
public override void Open() { if (IsOpen) { return; } _dataProvider = new AnalystWiffDataProvider(); _wiffFile = AnalystDataProviderFactory.CreateBatch(FilePath, _dataProvider); base.Open(); }