public void Add(byte [] abData, ushort usID, uint uiType)
        {
            PdbRecord pdbr = new PdbRecord();

            pdbr.Data = (byte[])abData.Clone();
            pdbr.ID   = usID;
            pdbr.Type = uiType;
            m_alsPdbRecords.Add(pdbr);
        }
 public void SetRecordData(ArrayList alsRecordData)
 {
     m_alsPdbRecords.Clear();
     foreach (byte[] abData in alsRecordData)
     {
         PdbRecord pdbr = new PdbRecord();
         pdbr.Data = (byte[])abData.Clone();
         m_alsPdbRecords.Add(pdbr);
     }
 }
        public void Load(string strFileName)
        {
            Stream       stm  = new FileStream(strFileName, FileMode.Open, FileAccess.Read, FileShare.None);
            BinaryReader brdr = new BinaryReader(stm);

            // Name

            m_strName = "";
            for (int i = 0; i < s_cbDbName; i++)
            {
                char ch = brdr.ReadChar();
                if (ch == 0)
                {
                    break;
                }
                m_strName += ch;
            }
            brdr.BaseStream.Position = (long)s_cbDbName;

            // attributes
            m_usAttributes = Misc.SwapUShort(brdr.ReadUInt16());

            // version
            m_usVersion = Misc.SwapUShort(brdr.ReadUInt16());

            // creationDate
            m_uiCreationDate = Misc.SwapUInt(brdr.ReadUInt32());

            // modificationDate
            brdr.ReadUInt32();

            // lastBackupDate
            brdr.ReadUInt32();

            // modificationNumber
            brdr.ReadUInt32();

            // appInfoID
            uint uiAppInfoID = Misc.SwapUInt(brdr.ReadUInt32());

            Debug.Assert(uiAppInfoID == 0);

            // sortInfoID
            uint uiSortInfoID = Misc.SwapUInt(brdr.ReadUInt32());

            Debug.Assert(uiSortInfoID == 0);

            // type
            m_uiType = Misc.SwapUInt(brdr.ReadUInt32());

            // creator
            m_uiCreator = Misc.SwapUInt(brdr.ReadUInt32());

            // uniqueIDSeed
            brdr.ReadUInt32();

            // recordList.nextRecordListID
            brdr.ReadUInt32();

            // recordList.numRecords
            ushort crecs = Misc.SwapUShort((ushort)brdr.ReadUInt16());

            // Read in records

            m_alsPdbRecords = new ArrayList();

            for (int irec = 0; irec < crecs; irec++)
            {
                PdbRecord pdbr = new PdbRecord();
                m_alsPdbRecords.Add(pdbr);

                if ((m_usAttributes & dmHdrAttrResDB) != 0)
                {
                    pdbr.Type  = Misc.SwapUInt(brdr.ReadUInt32());
                    pdbr.ID    = Misc.SwapUShort(brdr.ReadUInt16());
                    pdbr.IbRec = Misc.SwapUInt(brdr.ReadUInt32());
                }
                else
                {
                    // localChunkId (actually an offset to the bytes for this record)
                    pdbr.IbRec = Misc.SwapUInt((uint)brdr.ReadUInt32());

                    // attributes, unique id

                    brdr.ReadByte();
                    brdr.ReadByte();
                    brdr.ReadByte();
                    brdr.ReadByte();
                }
            }

            for (int irec = 0; irec < crecs; irec++)
            {
                uint ibrecNext;

                if (irec == crecs - 1)
                {
                    ibrecNext = (uint)brdr.BaseStream.Length;
                }
                else
                {
                    ibrecNext = ((PdbRecord)m_alsPdbRecords[irec + 1]).IbRec;
                }

                PdbRecord pdbr = (PdbRecord)m_alsPdbRecords[irec];
                brdr.BaseStream.Position = pdbr.IbRec;
                pdbr.Data = brdr.ReadBytes((int)(ibrecNext - pdbr.IbRec));
            }

            // All done

            brdr.Close();
        }
 public void SetRecordData(ArrayList alsRecordData)
 {
     m_alsPdbRecords.Clear();
     foreach (byte[] abData in alsRecordData) {
         PdbRecord pdbr = new PdbRecord();
         pdbr.Data = (byte[])abData.Clone();
         m_alsPdbRecords.Add(pdbr);
     }
 }
        public void Load(string strFileName)
        {
            Stream stm = new FileStream(strFileName, FileMode.Open, FileAccess.Read, FileShare.None);
            BinaryReader brdr = new BinaryReader(stm);

            // Name

            m_strName = "";
            for (int i = 0; i < s_cbDbName; i++)
            {
                char ch = brdr.ReadChar();
                if (ch == 0)
                    break;
                m_strName += ch;
            }
            brdr.BaseStream.Position = (long)s_cbDbName;

            // attributes
            m_usAttributes = Misc.SwapUShort(brdr.ReadUInt16());

            // version
            m_usVersion = Misc.SwapUShort(brdr.ReadUInt16());

            // creationDate
            m_uiCreationDate = Misc.SwapUInt(brdr.ReadUInt32());

            // modificationDate
            brdr.ReadUInt32();

            // lastBackupDate
            brdr.ReadUInt32();

            // modificationNumber
            brdr.ReadUInt32();

            // appInfoID
            uint uiAppInfoID = Misc.SwapUInt(brdr.ReadUInt32());
            Debug.Assert(uiAppInfoID == 0);

            // sortInfoID
            uint uiSortInfoID = Misc.SwapUInt(brdr.ReadUInt32());
            Debug.Assert(uiSortInfoID == 0);

            // type
            m_uiType = Misc.SwapUInt(brdr.ReadUInt32());

            // creator
            m_uiCreator = Misc.SwapUInt(brdr.ReadUInt32());

            // uniqueIDSeed
            brdr.ReadUInt32();

            // recordList.nextRecordListID
            brdr.ReadUInt32();

            // recordList.numRecords
            ushort crecs = Misc.SwapUShort((ushort)brdr.ReadUInt16());

            // Read in records

            m_alsPdbRecords = new ArrayList();

            for (int irec = 0; irec < crecs; irec++) {
                PdbRecord pdbr = new PdbRecord();
                m_alsPdbRecords.Add(pdbr);

                if ((m_usAttributes & dmHdrAttrResDB) != 0) {
                    pdbr.Type = Misc.SwapUInt(brdr.ReadUInt32());
                    pdbr.ID = Misc.SwapUShort(brdr.ReadUInt16());
                    pdbr.IbRec = Misc.SwapUInt(brdr.ReadUInt32());
                }
                else {
                    // localChunkId (actually an offset to the bytes for this record)
                    pdbr.IbRec = Misc.SwapUInt((uint)brdr.ReadUInt32());

                    // attributes, unique id

                    brdr.ReadByte();
                    brdr.ReadByte();
                    brdr.ReadByte();
                    brdr.ReadByte();
                }
            }

            for (int irec = 0; irec < crecs; irec++) {
                uint ibrecNext;

                if (irec == crecs - 1)
                    ibrecNext = (uint)brdr.BaseStream.Length;
                else
                    ibrecNext = ((PdbRecord)m_alsPdbRecords[irec+1]).IbRec;

                PdbRecord pdbr = (PdbRecord)m_alsPdbRecords[irec];
                brdr.BaseStream.Position = pdbr.IbRec;
                pdbr.Data = brdr.ReadBytes((int)(ibrecNext - pdbr.IbRec));
            }

            // All done

            brdr.Close();
        }
 public void Add(byte [] abData, ushort usID, uint uiType)
 {
     PdbRecord pdbr = new PdbRecord();
     pdbr.Data = (byte[])abData.Clone();
     pdbr.ID = usID;
     pdbr.Type = uiType;
     m_alsPdbRecords.Add(pdbr);
 }