public bool Read(MemoryStream s) { magic = Helpers.ReadUInt(s); if (magic != 0xD78B40EB) { return(false); } unk01 = Helpers.ReadInt(s); DataOffset = Helpers.ReadInt(s); unk02 = Helpers.ReadUShort(s); unk03 = Helpers.ReadUShort(s); unk04 = Helpers.ReadInt(s); unk05 = Helpers.ReadInt(s); Data1Count = Helpers.ReadInt(s); Data1Offset = Helpers.ReadInt(s); Data2Count = Helpers.ReadInt(s); Data2Offset = Helpers.ReadInt(s); Data3Count = Helpers.ReadInt(s); Data3Offset = Helpers.ReadInt(s); Data4Count = Helpers.ReadInt(s); Data4Offset = Helpers.ReadInt(s); if (Data4Count > 0) { Data5Count = Helpers.ReadInt(s); Data5Offset = Helpers.ReadInt(s); } s.Seek(Data1Offset, SeekOrigin.Begin); Data1 = new List <int>(); for (int i = 0; i < Data1Count; i++) { Data1.Add(Helpers.ReadInt(s)); } s.Seek(Data2Offset, SeekOrigin.Begin); StringIDs = new List <uint>(); StringData = new List <int>(); for (int i = 0; i < Data2Count; i++) { StringIDs.Add(Helpers.ReadUInt(s)); StringData.Add(Helpers.ReadInt(s)); } s.Seek(DataOffset, SeekOrigin.Begin); Data = new List <uint>(); while (s.Position < s.Length) { Data.Add(Helpers.ReadUInt(s)); } Strings = new List <STR>(); for (int i = 0; i < StringIDs.Count; i++) { STR ValueString = new STR(); ValueString.ID = StringIDs[i]; ValueString.Value = ""; int Index = StringData[i] >> 5; int Shift = StringData[i] & 0x1F; StringBuilder sb = new StringBuilder(); while (true) { int e = (Data1.Count / 2) - 1; while (e >= 0) { uint d = Data[Index]; int offset = (int)((d >> Shift) & 1); e = Data1[(e * 2) + offset]; Shift++; Index += (Shift >> 5); Shift %= 32; } ushort c; if ((e & 0xFF00) == 0xFF) { c = (ushort)(0xFFFFFFFF - (uint)e); } else { c = (ushort)(0xFFFF - (ushort)e); } if (c == 0) { break; } else { sb.Append((char)c); } } ValueString.Value = sb.ToString(); Strings.Add(ValueString); } return(true); }