示例#1
0
 public LureAnim(int resnum, string pal)
 {
     this.resnum = resnum;
     palette     = pal;
     xdata       = Decompressor.decompress(LureDisks.getResource(resnum));
     cdata       = LureDisks.getResource(resnum + 1);
 }
示例#2
0
 static void test(string[] args)
 {
     Console.WriteLine("running test");
     int[] imgs = new int[] { 5, 0x18, 0x1A, 0x1C, 0x1E, 0x40, 0x42, 0x44, 0x46, 0x24 };
     for (int i = 0; i < imgs.Length; i++)
     {
         Console.WriteLine(String.Format("----test compression res {0:D}(0x{0:X})", imgs[i]));
         byte[] data  = LureDisks.getResource(imgs[i]);
         byte[] real  = Decompressor.decompress(data);
         byte[] udata = Compressor.compress(real);
         byte[] xdata = Decompressor.decompress(udata);
         bool   eq    = true;
         if (xdata.Length != real.Length)
         {
             eq = false;
         }
         else
         {
             for (int j = 0; j < xdata.Length && eq; j++)
             {
                 if (xdata[j] != real[j])
                 {
                     eq = false;
                 }
             }
         }
         Console.WriteLine("decompress test " + (eq?"OK":"FAILED"));
         Console.WriteLine(String.Format("res {0:d} compress real={1:d} our={2:d}", imgs[i], data.Length, udata.Length));
         eq = true;
         if (data.Length == udata.Length)
         {
             for (int j = 0; j < data.Length; j++)
             {
                 if (data[j] != udata[j])
                 {
                     eq = false;
                 }
             }
         }
         else
         {
             eq = false;
         }
         Console.WriteLine("res " + imgs[i].ToString() + " " + (eq?"EQUAL":"not equal"));
         if (!eq)
         {
             FileStream fs = new FileStream("res" + imgs[i].ToString() + "real.bin", FileMode.Create);
             fs.Write(data, 0, data.Length);
             fs.Close();
             fs = new FileStream("res" + imgs[i].ToString() + "our.bin", FileMode.Create);
             fs.Write(udata, 0, udata.Length);
             fs.Close();
             fs = new FileStream("res" + imgs[i].ToString() + "unpacked.bin", FileMode.Create);
             fs.Write(real, 0, real.Length);
             fs.Close();
         }
     }
     Console.ReadKey();
 }
示例#3
0
 public LureImage(int resnum, int w, int h, string pal)
 {
     this.resnum = resnum;
     width       = w;
     height      = h;
     palette     = pal;
     //xdata = LureDisks.getResource(resnum);
     xdata = Decompressor.decompress(LureDisks.getResource(resnum));
 }
示例#4
0
        static void dump(int id)
        {
            string of = LureConfig.get().outputFile(id.ToString() + ".bin");

            Console.WriteLine("dumping " + id.ToString() + " to " + of);
            byte[] data = LureDisks.getResource(id);
            if (LureConfig.get().compress)
            {
                data = Decompressor.decompress(data);
            }
            LureCommon.dumpFile(data, of);
        }