public void Parse(Stream s) { BinaryReader r = new BinaryReader(s); this.contexVersion = r.ReadUInt32(); this.publicKeyCount = r.ReadUInt32(); this.externalKeyCount = r.ReadUInt32(); this.delayLoadKeyCount = r.ReadUInt32(); this.objectKeyCount = r.ReadUInt32(); List <TGIBlock> tempList = new List <TGIBlock>(); for (int i = 0; i < publicKeyCount; i++) { tempList.Add(new TGIBlock(1, handler, "ITG", s)); } this.publicKey = new CountedTGIBlockList(null, tempList); tempList.Clear(); for (int i = 0; i < externalKeyCount; i++) { tempList.Add(new TGIBlock(1, handler, "ITG", s)); } this.externalKey = new CountedTGIBlockList(null, tempList); tempList.Clear(); for (int i = 0; i < delayLoadKeyCount; i++) { tempList.Add(new TGIBlock(1, handler, "ITG", s)); } this.delayLoadKey = new CountedTGIBlockList(null, tempList); this.objectKey = new ObjectDataLIst(handler, s, objectKeyCount); }
public void UnParse(Stream s) { BinaryWriter w = new BinaryWriter(s); w.Write(this.contexVersion); if (this.publicKey == null) { this.publicKey = new CountedTGIBlockList(handler); } w.Write(this.publicKey.Count); if (this.externalKey == null) { this.externalKey = new CountedTGIBlockList(handler); } w.Write(this.externalKey.Count); if (this.delayLoadKey == null) { this.delayLoadKey = new CountedTGIBlockList(handler); } w.Write(this.delayLoadKey.Count); if (this.objectKey == null) { this.objectKey = new ObjectDataLIst(handler); } w.Write(this.objectKey.Count); foreach (var tgi in this.publicKey) { tgi.UnParse(s); } foreach (var tgi in this.externalKey) { tgi.UnParse(s); } foreach (var tgi in this.delayLoadKey) { tgi.UnParse(s); } foreach (var obj in this.objectKey) { obj.UnParse(s); } }