Ejemplo n.º 1
0
        /// <summary>
        /// Name:        OpenMZXMLFile
        /// Description: After giving a valid file location, if a file is not already loaded, is loaded into m_fileToRead and the
        ///              m_isFileOpened flag is set to true.
        /// </summary>
        /// <param name="fileLocation">
        /// Name:        fileLocation
        /// Description: The fileLocation is an input that represents the direct location of a mzXML or mzData file.
        /// </param>
        public void OpenMZXMLFile(string fileLocation)
        {
            m_fileLocation = fileLocation;

            if (m_fileLocation != null)
            {
                if (m_fileLocation.Contains(".mzXML"))
                {
                    m_fileToRead   = new clsMzXMLFileReader();
                    m_isFileOpened = m_fileToRead.OpenFile(m_fileLocation);
                }
                else if (m_fileLocation.Contains(".mzData"))
                {
                    m_fileToRead   = new clsMzDataFileReader();
                    m_isFileOpened = m_fileToRead.OpenFile(m_fileLocation);
                }
                else
                {
                    // Todo: throw an error <--- invalid file input.
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// The constructor of this parser will attempt to open any files that
 /// end in ".mzXML" or ".mzData".  If a null string is passed in or a
 /// a string without a ".mzXML" or ".mzData" file extension then an exception
 /// will be thrown.
 /// </summary>
 /// <param name="fileLocation">This must be a file Location to a ".mzXML" or ".mzData" file.</param>
 public MzParser(string fileLocation)
 {
     this.m_fileLocation = fileLocation;
     if (m_fileLocation != null)
     {
         if (m_fileLocation.ToLower().EndsWith(".mzXML".ToLower()) ||
             m_fileLocation.ToLower().EndsWith(".mzData".ToLower()))
         {
             m_fileToRead = new clsMzXMLFileAccessor();
             m_fileOpened = m_fileToRead.OpenFile(m_fileLocation);
         }
         else
         {
             throw new System.InvalidProgramException("Invalid File Type, must be .mzXML or .mzData");
         }
         m_fileToRead.ReadAndCacheEntireFile();
     }
     else
     {
         throw new System.InvalidOperationException("The file location passed was equal to null");
     }
 }