public DepListEntry(TS3GUID PackageID) { this.PackageID = PackageID; Dependencies = new List<TS3GUID>(); Resources = new List<TGI_Key>(); ExtraData = new List<string>(); }
private void WriteGUID(TS3GUID GUID, BinaryWriter Writer) { byte[] buf1 = GUID.Value; byte[] buffer = new byte[16]; for (int i = 7; i >= 0; i--) { buffer[7 - i] = buf1[i]; buffer[15 - i] = buf1[i + 8]; } Writer.Write(buf1); }
public void AddDependency(TS3GUID GUID) { Dependencies.Add(GUID); }
void Import(Stream Source) { BinaryReader Reader = new BinaryReader(Source); UInt16 Version = Reader.ReadUInt16(); // expect 0x002b //if (Version == 32) //{ // LotName = "Borked"; // return; //} TS3GUID NameGUID = new TS3GUID(Reader.ReadBytes(8)); // 0 in exported lots TS3GUID DescGUID = new TS3GUID(Reader.ReadBytes(8)); // TS3GUID LotNameGUID = new TS3GUID(Reader.ReadBytes(8)); // --- UInt32 Len = Reader.ReadUInt32(); Name = Encoding.Unicode.GetString(Reader.ReadBytes((int)Len * 2)); if (Version >= 32) { float Unknown1 = Reader.ReadSingle(); float Unknown2 = Reader.ReadSingle(); } float CornerX = Reader.ReadSingle(); float CornerY = Reader.ReadSingle(); float CornerZ = Reader.ReadSingle(); float Heading = Reader.ReadSingle(); LotWidth = Reader.ReadUInt32(); LotHeight = Reader.ReadUInt32(); UInt32 Unknown3 = Reader.ReadUInt32(); UInt32 Unknown4 = Reader.ReadUInt32(); float Unknown5 = Reader.ReadSingle(); float Unknown6 = Reader.ReadSingle(); UInt32 Unknown7 = Reader.ReadUInt32(); UInt32 Unknown8 = Reader.ReadUInt32(); Len = Reader.ReadUInt32(); LotName = Encoding.Unicode.GetString(Reader.ReadBytes((int)Len * 2)); Len = Reader.ReadUInt32(); LotDescription = Encoding.Unicode.GetString(Reader.ReadBytes((int)Len * 2)); Len = Reader.ReadUInt32(); LotAddress = Encoding.Unicode.GetString(Reader.ReadBytes((int)Len * 2)); LotType = Reader.ReadUInt32(); if (Version >= 0x2b) { LotSubType = Reader.ReadUInt32(); } BeautifulVistaBuf = Reader.ReadSingle(); float LotValueModifier = Reader.ReadSingle(); LotValue = Reader.ReadUInt32(); if (Version <= 32) return; UInt32 Unknown9 = Reader.ReadUInt32(); byte[] UnknownA = Reader.ReadBytes(5); }
private void Import(Stream Source) { BinaryReader Reader = new BinaryReader(Source); // Read the DepList from the Stream and create the appropriate DepListEntries... // Get the Count UInt32 Count = Reader.ReadUInt32().Swap(); DepListEntry Entry; for (int i = 0; i < Count; i++) { // Read the Signature byte[] sig = Reader.ReadBytes(5); // Next get DependencyCount and ResourceCount UInt32 DependencyCount = Reader.ReadUInt32().Swap(); UInt32 ResourceCount = Reader.ReadUInt32().Swap(); TS3GUID PackageID = new TS3GUID(Reader.ReadBytes(16)); Entry = new DepListEntry(PackageID); // Now read the Dependencies for (int j = 0; j < DependencyCount; j++) { Entry.AddDependency(new TS3GUID(Reader.ReadBytes(16))); } // Now read the Entry Type and Sub Type Entry.SetPackageType(Reader.ReadUInt32().Swap(), Reader.ReadUInt32().Swap()); UInt16 unknown01 = Reader.ReadUInt16(); UInt32 Type; UInt32 Group; UInt32 InstLo; UInt32 InstHi; UInt64 Inst; // Now read the Resource Keys for (int j = 0; j < ResourceCount; j++) { Type = Reader.ReadUInt32().Swap(); Group = Reader.ReadUInt32().Swap(); InstLo = Reader.ReadUInt32().Swap(); InstHi = Reader.ReadUInt32().Swap(); Inst = (UInt64)(InstLo + ((UInt64)InstHi << 32)); TGI_Key Key1 = new TGI_Key(Type, Group, Inst); Type = Reader.ReadUInt32().Swap(); Group = Reader.ReadUInt32().Swap(); InstLo = Reader.ReadUInt32().Swap(); InstHi = Reader.ReadUInt32().Swap(); Inst = (UInt64)(InstLo + ((UInt64)InstHi << 32)); TGI_Key Key2 = new TGI_Key(Type, Group, Inst); Entry.AddResource(Key1, Key2); } // Next, read the String Length and the String int NameCount = (int)Reader.ReadUInt32().Swap(); Entry.Name = Encoding.BigEndianUnicode.GetString(Reader.ReadBytes(NameCount * 2)); Reader.ReadBytes(4); // skip the gap at the end of the String Type = Reader.ReadUInt32().Swap(); Group = Reader.ReadUInt32().Swap(); InstLo = Reader.ReadUInt32().Swap(); InstHi = Reader.ReadUInt32().Swap(); Inst = (UInt64)(InstLo + ((UInt64)InstHi << 32)); Entry.Thumbnail = new TGI_Key(Type, Group, Inst); Console.WriteLine(Entry.Thumbnail); UInt32 ExtraLen; byte Flags = Reader.ReadByte(); // Get the flag do { ExtraLen = Reader.ReadUInt32().Swap(); if (ExtraLen != 0) { Entry.AddExtraData (Encoding.ASCII.GetString(Reader.ReadBytes((int)ExtraLen))); } } while (ExtraLen != 0); Entries.Add(Entry.PackageID, Entry); } }
public bool ContainsID(TS3GUID PackageID) { return Entries.ContainsKey(PackageID); }
public SimIndexEntry(TS3GUID GUID, TGI_Key SIME) { this.GUID = GUID; this.SIME = SIME; }