示例#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);
        }
示例#3
0
        /// <summary>
        /// write the file header  to disk
        /// </summary>
        /// <param name="fileHeader">input file header</param>
        /// <returns>true is successful</returns>
        public bool Write(SEGYFileHeader fileHeader)
        {
            if (this.SEGYwriter == null)
            {
                return(false);                         // no output stream defined
            }
            this.SEGYwriter.BaseStream.Position = 0;

            bool ret = fileHeader.WriteFileHeader(this.SEGYwriter);

            SEGYreader.BaseStream.Position = SEGYwriter.BaseStream.Position;

            positionOfEndofFileHeaders = SEGYwriter.BaseStream.Position;

            return(ret);
        }
示例#4
0
        /// <summary>
        /// make a deep copy of the Header
        /// </summary>
        /// <returns>a deep copy of the SEGYFileHeader structure</returns>
        public SEGYFileHeader Copy()
        {
            SEGYFileHeader newFileHeader = new SEGYFileHeader();

            // copy binary section
            byte[] newBinarySection = new byte[400];
            Array.Copy(this.BinaryFileHeader, newBinarySection, 400);

            // copy Tape headers
            List <Byte[]> newExtendedTextHeader = new List <byte[]>();

            for (int i = 0; i < this.ExtendedTextHeader.Count; i++)
            {
                byte[] newHeader = new byte[3200];
                Array.Copy(this.ExtendedTextHeader[i], newHeader, 3200);
                newExtendedTextHeader.Add(newHeader);
            }
            newFileHeader.BinaryFileHeader      = newBinarySection;
            newFileHeader.ExtendedTextHeader    = newExtendedTextHeader;
            newFileHeader.BigEndian             = this.BigEndian;
            newFileHeader.isSEGYFileHeaderAscii = this.isSEGYFileHeaderAscii;
            return(newFileHeader);
        }