Example #1
0
File: Mzml.cs Project: B-Rich/CSMSL
 public override void Dispose()
 {
     if (_mzMLConnection != null)
     {
         _mzMLConnection = null;
     }
     if (_indexedmzMLConnection != null)
     {
         _indexedmzMLConnection = null;
     }
     base.Dispose();
 }
Example #2
0
File: Mzml.cs Project: B-Rich/CSMSL
 public override void Open()
 {
     if (!IsOpen ||_mzMLConnection == null)
     {
         Stream stream = new FileStream(FilePath, FileMode.Open);
         // Need these nested try catch to test if the file is a indexed mzML or just a plain mzML
         try
         {
             _indexedmzMLConnection = _indexedSerializer.Deserialize(stream) as indexedmzML;
             _mzMLConnection = _indexedmzMLConnection.mzML;
         }
         catch (Exception)
         {
             try
             {
                 _mzMLConnection = _mzMLSerializer.Deserialize(stream) as mzMLType;
             }
             catch (Exception)
             {
                 throw new InvalidDataException("Unable to parse " + FilePath + " as a mzML file!");
             }
         }
         base.Open();
     }
 }
 public static bool LoadFromFile(string fileName, out indexedmzML obj)
 {
     System.Exception exception = null;
     return LoadFromFile(fileName, out obj, out exception);
 }
 /// <summary>
 /// Deserializes xml markup from file into an indexedmzML object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output indexedmzML object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out indexedmzML obj, out System.Exception exception)
 {
     exception = null;
     obj = default(indexedmzML);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 public static bool Deserialize(string xml, out indexedmzML obj)
 {
     System.Exception exception = null;
     return Deserialize(xml, out obj, out exception);
 }
 /// <summary>
 /// Deserializes workflow markup into an indexedmzML object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output indexedmzML object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out indexedmzML obj, out System.Exception exception)
 {
     exception = null;
     obj = default(indexedmzML);
     try
     {
         obj = Deserialize(xml);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }