Example #1
0
 public LngFile(Stream fileStream)
 {
     using (LngBinaryReader b = new LngBinaryReader(EndianBitConverter.Big, fileStream))
     {
         byte[] keys, values;
         hasChanges = false;
         magic      = b.ReadInt32();
         // SIZE - Skip
         b.ReadInt32();
         // Hash Section (HSHS)
         hshs = new Hshs(b);
         // Hash Table (HSHT)
         hsht = new Hsht(b);
         // Offsets (SIDA)
         sida = new SidA(b);
         // Keys (SIDB)
         sidb = new SidB(b);
         keys = b.ReadBytes(sidb.Size);
         // Values (LNGB)
         lngb   = new LngB(b);
         values = b.ReadBytes(lngb.Size);
         count  = sida.Entry.Length;
         for (int i = 0; i < sida.Entry.Length; i++)
         {
             HashEntry hEntry = new HashEntry();
             hEntry.Key   = ReadTerminatedString(keys, sida.Entry[i].KeyOffset, 0x00);
             hEntry.Value = ReadTerminatedString(values, sida.Entry[i].ValueOffset, 0x00);
             hsht.Table[GetHash(hEntry.Key)].Add(hEntry);
         }
     }
 }
 public LngFile(Stream fileStream)
 {
     using (LngBinaryReader b = new LngBinaryReader(EndianBitConverter.Big, fileStream))
     {
         byte[] keys, values;
         hasChanges = false;
         magic = b.ReadInt32();
         // SIZE - Skip
         b.ReadInt32();
         // Hash Section (HSHS)
         hshs = new Hshs(b);
         // Hash Table (HSHT)
         hsht = new Hsht(b);
         // Offsets (SIDA)
         sida = new SidA(b);
         // Keys (SIDB)
         sidb = new SidB(b);
         keys = b.ReadBytes(sidb.Size);
         // Values (LNGB)
         lngb = new LngB(b);
         values = b.ReadBytes(lngb.Size);
         count = sida.Entry.Length;
         for (int i = 0; i < sida.Entry.Length; i++)
         {
             HashEntry hEntry = new HashEntry();
             hEntry.Key = ReadTerminatedString(keys, sida.Entry[i].KeyOffset, 0x00);
             hEntry.Value = ReadTerminatedString(values, sida.Entry[i].ValueOffset, 0x00);
             hsht.Table[GetHash(hEntry.Key)].Add(hEntry);
         }
     }
 }
Example #3
0
 public Hshs(LngBinaryReader b)
 {
     Magic = b.ReadInt32();
     Size = b.ReadInt32();
     Buckets = b.ReadUInt32();
     Seed = b.ReadUInt32();
     Multiplier = b.ReadUInt32();
 }
Example #4
0
 public Hshs(LngBinaryReader b)
 {
     Magic      = b.ReadInt32();
     Size       = b.ReadInt32();
     Buckets    = b.ReadUInt32();
     Seed       = b.ReadUInt32();
     Multiplier = b.ReadUInt32();
 }
Example #5
0
 public Hsht(LngBinaryReader b)
 {
     Magic = b.ReadInt32();
     Size = b.ReadInt32();
     Table = new HashTable[Size / 8];
     for (int i = 0; i < Table.Length; i++)
     {
         Table[i] = new HashTable(b.ReadInt32(), b.ReadInt32());
     }
 }
Example #6
0
 public Hsht(LngBinaryReader b)
 {
     Magic = b.ReadInt32();
     Size  = b.ReadInt32();
     Table = new HashTable[Size / 8];
     for (int i = 0; i < Table.Length; i++)
     {
         Table[i] = new HashTable(b.ReadInt32(), b.ReadInt32());
     }
 }
Example #7
0
 public SidA(LngBinaryReader b)
 {
     Magic = b.ReadInt32();
     Size = b.ReadInt32();
     Entry = new SidaEntry[b.ReadInt32()];
     for (int i = 0; i < Entry.Length; i++)
     {
         Entry[i].KeyOffset = b.ReadInt32();
         Entry[i].ValueOffset = b.ReadInt32();
     }
 }
Example #8
0
 public SidA(LngBinaryReader b)
 {
     Magic = b.ReadInt32();
     Size  = b.ReadInt32();
     Entry = new SidaEntry[b.ReadInt32()];
     for (int i = 0; i < Entry.Length; i++)
     {
         Entry[i].KeyOffset   = b.ReadInt32();
         Entry[i].ValueOffset = b.ReadInt32();
     }
 }
Example #9
0
 public SidB(LngBinaryReader b)
 {
     Magic = b.ReadInt32();
     Size = b.ReadInt32();
 }
Example #10
0
 public LngB(LngBinaryReader b)
 {
     Magic = b.ReadInt32();
     Size  = b.ReadInt32();
 }