/// <summary> /// Initiates a dynamic connection with a Thermo .raw file. Data can be "streamed" instead of loaded all at once. Use /// GetOneBasedScanFromDynamicConnection to get data from a particular scan. Use CloseDynamicConnection to close the /// dynamic connection after all desired data has been retrieved from the dynamic connection. /// </summary> private void InitiateDynamicConnection(string filePath) { Loaders.LoadElements(); if (dynamicConnection != null) { dynamicConnection.Dispose(); } dynamicConnection = RawFileReaderAdapter.FileFactory(filePath); if (!File.Exists(filePath)) { throw new FileNotFoundException(); } if (!dynamicConnection.IsOpen) { throw new MzLibException("Unable to access RAW file!"); } if (dynamicConnection.IsError) { throw new MzLibException("Error opening RAW file!"); } if (dynamicConnection.InAcquisition) { throw new MzLibException("RAW file still being acquired!"); } dynamicConnection.SelectInstrument(Device.MS, 1); GetMsOrdersByScanInDynamicConnection(); }
protected override void OnFormClosing(FormClosingEventArgs e) { if (ConfirmExit() == false) { e.Cancel = true; } else { RawData.Dispose(); rawFileThreadManager.Dispose(); } }
/// <summary> /// Initiates a dynamic connection with a Thermo .raw file. Data can be "streamed" instead of loaded all at once. Use /// GetOneBasedScanFromDynamicConnection to get data from a particular scan. Use CloseDynamicConnection to close the /// dynamic connection after all desired data has been retrieved from the dynamic connection. /// </summary> protected override void InitiateDynamicConnection() { if (!File.Exists(FilePath)) { throw new FileNotFoundException(); } if (Path.GetExtension(FilePath).ToUpper() != ".RAW") { throw new InvalidDataException(); } Loaders.LoadElements(); if (dynamicConnection != null) { dynamicConnection.Dispose(); } dynamicConnection = RawFileReaderAdapter.FileFactory(FilePath); if (!dynamicConnection.IsOpen) { throw new MzLibException("Unable to access RAW file!"); } if (dynamicConnection.IsError) { throw new MzLibException("Error opening RAW file!"); } if (dynamicConnection.InAcquisition) { throw new MzLibException("RAW file still being acquired!"); } dynamicConnection.SelectInstrument(Device.MS, 1); GetMsOrdersByScanInDynamicConnection(); }
/// <summary> /// Dispose of the raw file object to handle memory situation /// </summary> /// <param name="rawFile"></param> private void CleanUpRawFile(IRawDataPlus rawFile) { rawFile.Dispose(); }
/// <summary> /// Dispose of the raw file when reading multiple files. /// </summary> public void Close() { rawFile.Dispose(); }