コード例 #1
0
        /// <summary>
        /// Returns the size of the object data
        /// </summary>
        /// <returns>Object size</returns>
        public int DataSize()
        {
            int sectorInformationSize = 0;

            sectorInformationSize += SectorDescription.FileRecordSize();

            return(sectorInformationSize);
        }
コード例 #2
0
        /// <summary>
        /// Populates properties on the current object reading information from the
        /// provided binary reader.
        /// </summary>
        /// <param name="binaryReader">The binary reader to read</param>
        public void Read(BinaryReader binaryReader)
        {
            SectorDescription.Read(binaryReader);

            long currentPosition = binaryReader.BaseStream.Position;

            binaryReader.BaseStream.Position = SectorDescription.NotesOffset;
            Notes = new String(binaryReader.ReadChars(SectorDescription.NotesLength));

            // Position back to after the end of the SectorDescriptor
            binaryReader.BaseStream.Position = currentPosition;
        }
コード例 #3
0
        /// <summary>
        /// Writes property values to a binary file using the binary writer
        /// </summary>
        /// <param name="binaryWriter">The instantiated binary writer used to write property information</param>
        /// <exception cref="SectorInformationWriteException"><c>SectorInformationWriteException</c>.</exception>
        public void Write(BinaryWriter binaryWriter)
        {
            try
            {
                SectorDescription.Write(binaryWriter);

                long currentPosition = binaryWriter.BaseStream.Position;

                binaryWriter.BaseStream.Position = SectorDescription.NotesOffset;

                binaryWriter.Write(BinaryFileHelper.StringToCharArray(Notes, SectorDescription.NotesLength));

                // Position back to after the end of the SectorDescriptor
                binaryWriter.BaseStream.Position = currentPosition;
            }
            catch (Exception eek)
            {
                var message = String.Format("Error encountered writing sector information: {0} {1} = {2}", Number, Name, eek.ToString());
            }
        }
コード例 #4
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public SectorInformation()
 {
     SectorDescription = new SectorDescription();
 }