Read_Metadata() public method

Reads metadata from an open stream and saves to the provided item/package
Accepts two options: (1) 'METS_File_ReaderWriter:Minimize_File_Info' which tells whether the reader should just skip the file reading portion completely, and just read the bibliographic data ( Default is FALSE). (2) 'METS_File_ReaderWriter:Support_Divisional_dmdSec_amdSec'
public Read_Metadata ( Stream Input_Stream, SobekCM_Item Return_Package, object>.Dictionary Options, string &Error_Message ) : bool
Input_Stream Stream Open stream to read metadata from
Return_Package SobekCM_Item Package into which to read the metadata
Options object>.Dictionary Dictionary of any options which this metadata reader/writer may utilize
Error_Message string [OUTPUT] Explanation of the error, if an error occurs during reading
return bool
        /// <summary> Read the metadata file and enrich the existing bibliographic package </summary>
        /// <param name="Data_File">Generic (unspecified) metadata file</param>
        /// <param name="thisPackage">Bibliographic package to enrich</param>
        public void Read(string Data_File, SobekCM_Item thisPackage)
        {
            // Many readers output an error message
            string errorMessage;

            // Does this filename have '.info.xml' in it?
            if (Data_File.ToUpper().IndexOf(".INFO.XML") > 0)
            {
                INFO_File_ReaderWriter readInfo = new INFO_File_ReaderWriter();
                readInfo.Read_Metadata(Data_File, thisPackage, null, out errorMessage);
                return;
            }

            // Does this file have '.mets' in it?
            if ((Data_File.ToUpper().IndexOf(".METS") > 0) || (Data_File.ToUpper().IndexOf(".PMETS") > 0))
            {
                METS_File_ReaderWriter readInfo = new METS_File_ReaderWriter();
                readInfo.Read_Metadata(Data_File, thisPackage, null, out errorMessage);
                return;
            }

            // If it made it here, it may be METS or MXF
            if (Data_File.ToUpper().IndexOf(".XML") > 0)
            {
                // Read first couple lines
                StreamReader reader = new StreamReader(Data_File);
                string thisLine = reader.ReadLine();
                while (thisLine != null)
                {
                    // Is this MXF?
                    if (thisLine.ToUpper().Trim() == "<MXF>")
                    {
                        // Close the current connection
                        reader.Close();

                        // Read in the MXF file
                        MXF_File_ReaderWriter readInfo = new MXF_File_ReaderWriter();
                        readInfo.Read_Metadata(Data_File, thisPackage, null, out errorMessage);
                        return;
                    }

                    // Is this a METS declaration?
                    if (thisLine.ToUpper().IndexOf("<METS:") > 0)
                    {
                        // Close the current connection
                        reader.Close();

                        // Read in the METS file
                        METS_File_ReaderWriter readInfo = new METS_File_ReaderWriter();
                        readInfo.Read_Metadata(Data_File, thisPackage, null, out errorMessage);
                        return;
                    }

                    // Read the next line
                    thisLine = reader.ReadLine();
                }
            }
        }
        /// <summary> Read from an existing METS file and returns a new object</summary>
        /// <param name="fileName">Name of the METS file</param>
        /// <returns>Built SobekCM_Item object</returns>
        public static SobekCM_Item Read_METS(string fileName)
        {
            SobekCM_Item returnVal = new SobekCM_Item();

            // Save this to the METS file format
            METS_File_ReaderWriter writer = new METS_File_ReaderWriter();
            string Error_Message;
            writer.Read_Metadata(fileName, returnVal, null, out Error_Message);

            return returnVal;
        }
 /// <summary> Read from an existing METS file into the current object</summary>
 /// <param name="fileName">Name of the METS file</param>
 public void Read_From_METS(string fileName)
 {
     // Save this to the METS file format
     METS_File_ReaderWriter writer = new METS_File_ReaderWriter();
     string Error_Message;
     writer.Read_Metadata(fileName, this, null, out Error_Message);
 }
        private SobekCM_Item Build_Item_From_METS(string METS_URL, string METS_Name, Custom_Tracer Tracer)
        {
            try
            {
                if (Tracer != null)
                {
                    Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Build_Item_From_METS", "Open http web request stream to METS file ( <a href=\"" + METS_URL + "\">" + METS_Name + "</a> )");
                }

                SobekCM_Item thisPackage = new SobekCM_Item();
                if (METS_URL.IndexOf("http:") >= 0)
                {
                    WebRequest objRequest = WebRequest.Create(METS_URL);
                    objRequest.Timeout = 5000;
                    WebResponse objResponse = objRequest.GetResponse();

                    if (Tracer != null)
                    {
                        Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Build_Item_From_METS", "Read the METS file from the stream");
                    }

                    // Read the METS file and create the package
                    METS_File_ReaderWriter reader = new METS_File_ReaderWriter();
                    string errorMessage;
                    reader.Read_Metadata(objResponse.GetResponseStream(), thisPackage, null, out errorMessage);
                    objResponse.Close();
                }
                else
                {
                    if (File.Exists(METS_URL.Replace("/", "\\")))
                    {
                        // Read the METS file and create the package
                        METS_File_ReaderWriter reader = new METS_File_ReaderWriter();
                        string errorMessage;
                        reader.Read_Metadata(METS_URL.Replace("/", "\\"), thisPackage, null, out errorMessage);
                    }
                    else
                    {
                        return null;
                    }
                }

                return thisPackage;
            }
            catch
            {
                return null;
            }
        }