Example #1
0
        public static bool Initialize()
        {
            ByteRef dec = null;

            zlib = new ZLib();

            ReadToVector("decompress.dat", ref dec);
            ReadToVector("compress.dat", ref zlib.enc);
            zlib.val = new ByteRef(0);
            PopulateJumpTable(ref zlib.val, ref zlib.jump, ref dec);
            return(false);
        }
Example #2
0
        static void PopulateJumpTable(ref ByteRef val, ref uint[] jump, ref ByteRef dec)
        {
            //jump.Resize(dec.Length);
            jump = new uint[dec.Length / 4];
            uint b = dec.GetUInt32(0) - 4;

            for (int i = 0; i < dec.Length; i += 4)
            {
                uint decval = dec.GetUInt32(i);
                if (decval > 0xFF)
                {
                    jump[i / 4] = (decval - b) / 4;
                }
                else
                {
                    jump[i / 4] = decval;
                }
            }
        }
Example #3
0
 public static bool ReadToVector(string filename, ref ByteRef vec)
 {
     byte[] fileData = File.ReadAllBytes(filename);
     vec = new ByteRef(fileData);
     return(true);
 }