Пример #1
0
 /// <summary>
 /// write the file header to XML
 /// </summary>
 /// <param name="outputXMLFileName">output XML file name</param>
 /// <param name="fileheader">input file header</param>
 /// <returns>true is successful</returns>
 public bool WriteXML(string outputXMLFileName, SEGYFileHeader fileheader)
 {
     System.Xml.Serialization.XmlSerializer writer =
         new System.Xml.Serialization.XmlSerializer(fileheader.GetType());
     System.IO.FileStream file = System.IO.File.Create(outputXMLFileName);
     writer.Serialize(file, fileheader);
     file.Close();
     return(true);
 }
Пример #2
0
        /// <summary>
        /// read an SEGY file header in XML format
        /// </summary>
        /// <param name="inputXMLFileName">input SEGYFileHeader XML file name</param>
        /// <returns>point to SEGYFileHeader</returns>
        public static SEGYFileHeader ReadXMLFileHeader(string inputXMLFileName)
        {
            SEGYFileHeader overview = new SEGYFileHeader();

            System.Xml.Serialization.XmlSerializer reader =
                new System.Xml.Serialization.XmlSerializer(overview.GetType());
            System.IO.StreamReader file = new System.IO.StreamReader(
                inputXMLFileName);
            overview = (SEGYFileHeader)reader.Deserialize(file);
            file.Close();
            return(overview);
        }