public virtual void Dispose() { posLayer?.Dispose(); posLayer = null; negLayer?.Dispose(); negLayer = null; }
/// <summary> /// Set posLayer, negLayer, and (if NeedsGrid) gridInfo from IndexFilename. /// The work is done by RawFileLayer(reader, this) and MassGridInfo(reader). /// Called only from Init, which is called only from CreateRawFile. /// The corresponding write method is WriteIndex. /// </summary> protected void ReadIndex() { BinaryReader reader = null; try{ reader = FileUtils.GetBinaryReader(IndexFilename); int indexVers = reader.ReadInt32(); // dummy var because we already know the answer from IndexVersionIsCurrent() string version = reader.ReadString(); // dummy var because the following if-block is commented out //if (!version.Equals(Application.ProductVersion)){ // throw new Exception("Wrong version"); //} posLayer = new RawFileLayer(reader, this, true); negLayer = new RawFileLayer(reader, this, false); if (NeedsGrid) { gridInfo = new MassGridInfo(reader); } } finally{ reader?.Close(); } }
internal static void InitMassGrid(RawFileLayer layer, IDictionary <int, double> mins) { for (int i = 0; i < layer.Ms1Count; i++) { layer.GetMs1SpectrumArray(i, false, out double[] masses, out double[] _); for (int j = 0; j < masses.Length - 1; j++) { double m1 = masses[j]; double m2 = masses[j + 1]; double dm = m2 - m1; int intMass = (int)((m1 + m2) / 2); if (mins.ContainsKey(intMass)) { mins[intMass] = Math.Min(mins[intMass], dm); } else { mins.Add(intMass, dm); } } } }
protected RawFile() { posLayer = new RawFileLayer(this, true); negLayer = new RawFileLayer(this, false); }