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 LngFile(DataTable DT)
 {
     hasChanges = false;
     magic      = (int)DT.Rows[0][0];
     count      = (int)DT.Rows[0][1];
     hshs       = new Hshs((int)DT.Rows[0][2], (uint)DT.Rows[0][3], (uint)DT.Rows[0][4], (uint)DT.Rows[0][5]);
     hsht       = new Hsht((int)DT.Rows[0][6], (int)hshs.Buckets);
     sida       = new SidA((int)DT.Rows[0][7]);
     sidb       = new SidB((int)DT.Rows[0][8]);
     lngb       = new LngB((int)DT.Rows[0][9]);
 }
        public LngFile(DataSet data)
        {
            hasChanges = false;
            DataTable DT = data.Tables["info"];
            magic = (int)DT.Rows[0][0];
            count = (int)DT.Rows[0][1];
            hshs = new Hshs((int)DT.Rows[0][2], (uint)DT.Rows[0][3], (uint)DT.Rows[0][4], (uint)DT.Rows[0][5]);
            hsht = new Hsht((int)DT.Rows[0][6], (int)hshs.Buckets);
            sida = new SidA((int)DT.Rows[0][7]);
            sidb = new SidB((int)DT.Rows[0][8]);
            lngb = new LngB((int)DT.Rows[0][9]);

            DT = data.Tables["entry"];
            count = DT.Rows.Count;
            resize();
            count = 0;
            foreach (DataRow row in DT.Rows)
            {
                Add((string)row[0], (string)row[1], false);
            }
        }
Example #5
0
        public LngFile(DataSet data)
        {
            hasChanges = false;
            DataTable DT = data.Tables["info"];

            magic = (int)DT.Rows[0][0];
            count = (int)DT.Rows[0][1];
            hshs  = new Hshs((int)DT.Rows[0][2], (uint)DT.Rows[0][3], (uint)DT.Rows[0][4], (uint)DT.Rows[0][5]);
            hsht  = new Hsht((int)DT.Rows[0][6], (int)hshs.Buckets);
            sida  = new SidA((int)DT.Rows[0][7]);
            sidb  = new SidB((int)DT.Rows[0][8]);
            lngb  = new LngB((int)DT.Rows[0][9]);

            DT    = data.Tables["entry"];
            count = DT.Rows.Count;
            resize();
            count = 0;
            foreach (DataRow row in DT.Rows)
            {
                Add((string)row[0], (string)row[1], false);
            }
        }
Example #6
0
        public LngFile(DataSet data)
        {
            hasChanges = false;
            DataTable DT = data.Tables["info"] ??
                           throw new InvalidDataException("The dataset does not have a table named info.");

            magic = (int)DT.Rows[0][0];
            count = (int)DT.Rows[0][1];
            hshs  = new Hshs((int)DT.Rows[0][2], (uint)DT.Rows[0][3], (uint)DT.Rows[0][4], (uint)DT.Rows[0][5]);
            hsht  = new Hsht((int)DT.Rows[0][6], (int)hshs.Buckets);
            sida  = new SidA((int)DT.Rows[0][7]);
            sidb  = new SidB((int)DT.Rows[0][8]);
            lngb  = new LngB((int)DT.Rows[0][9]);

            DT = data.Tables["entry"] ??
                 throw new InvalidDataException("The dataset does not have a table named entry.");
            count = DT.Rows.Count;
            resize();
            count = 0;
            foreach (DataRow row in DT.Rows)
            {
                Add((string)row[0], (string)row[1], false);
            }
        }
 public LngFile(DataTable DT)
 {
     hasChanges = false;
     magic = (int)DT.Rows[0][0];
     count = (int)DT.Rows[0][1];
     hshs = new Hshs((int)DT.Rows[0][2], (uint)DT.Rows[0][3], (uint)DT.Rows[0][4], (uint)DT.Rows[0][5]);
     hsht = new Hsht((int)DT.Rows[0][6], (int)hshs.Buckets);
     sida = new SidA((int)DT.Rows[0][7]);
     sidb = new SidB((int)DT.Rows[0][8]);
     lngb = new LngB((int)DT.Rows[0][9]);
 }