MobiEPUB.PRC.Header.ReadShort C# (CSharp) Method

ReadShort() public method

public ReadShort ( ) : int
return int
        public int ReadShort()
        {
            int result = ReadShort(m_CurrPos);
            m_CurrPos += 2;
            return result;
        }

Same methods

Header::ReadShort ( int pos ) : int

Usage Example

Ejemplo n.º 1
0
        //private byte[] m_Array;

        public PDBheader(Header header)
        {
            int temp;

            if (header.Length < 80)
            {
                throw new Exception("PDB header is too small");
            }
            m_Array = header;

            // Filename. Bytes 0-32 null terminated ASCII
            m_Filename = m_Array.ReadString(0, 32);
            m_Filename = m_Filename.Substring(0, m_Filename.IndexOf('\0'));

            // Version - Bytes 34-2 high-endian integer;
            m_Version = m_Array.ReadShort(34);

            // Creation date - Bytes 36-4 high-endian integer. Despite the comments
            // above, the time is based on 1-Jan-1970 not 1-Jan-1904
            temp           = m_Array.ReadInt(36);
            m_CreationDate = new DateTime(1970, 1, 1, 0, 0, 0);
            m_CreationDate = m_CreationDate.AddSeconds((double)temp);

            // Modification date - Bytes 40-4 high-endian integer. Despite the comments
            // above, the time is based on 1-Jan-1970 not 1-Jan-1904
            temp = m_Array.ReadInt(40);
            m_ModificationDate = new DateTime(1970, 1, 1, 0, 0, 0);
            m_ModificationDate = m_ModificationDate.AddSeconds((double)temp);

            // Type - Bytes 60-4 ASCII
            m_Type = m_Array.ReadString(60, 4);

            // Creator - Bytes 64-4 ASCII
            m_Creator = m_Array.ReadString(64, 4);

            // Record count - Bytes 76-2 high-endian integer;
            m_RecordCnt = m_Array.ReadShort(76);

            // Build a list of pointers to records.  These are held in an array
            // starting in bytes 78-8.
            m_RecPointer = new ArrayList(m_RecordCnt);
            for (int i = 0; i < m_RecordCnt; i++)
            {
                int offs = 78 + (i * 8);
                temp = m_Array.ReadInt(offs);
                m_RecPointer.Add(temp);
            }
        }
All Usage Examples Of MobiEPUB.PRC.Header::ReadShort