コード例 #1
0
ファイル: SEGYFile.cs プロジェクト: bobcourtney/CleanNav
        /// <summary>
        /// write the trace to XML
        /// </summary>
        /// <param name="outputXMLFileName">output XML file name</param>
        /// <param name="trace">input trace</param>
        /// <returns>true is successful</returns>
        public bool WriteXML(string outputXMLFileName, SEGYTrace trace)
        {
            System.Xml.Serialization.XmlSerializer writer =
                new System.Xml.Serialization.XmlSerializer(trace.GetType());
            System.IO.FileStream file = System.IO.File.Create(outputXMLFileName);

            writer.Serialize(file, trace);
            file.Close();
            return(true);
        }
コード例 #2
0
ファイル: SEGYFile.cs プロジェクト: bobcourtney/CleanNav
        /// <summary>
        /// read an SEGY trace in XML format
        /// </summary>
        /// <param name="inputXMLFileName">input SEGYTrace XML file name</param>
        /// <returns>pointer to SEGYTrace</returns>
        public static SEGYTrace ReadXMLTrace(string inputXMLFileName)
        {
            SEGYTrace overview = new SEGYTrace();

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