示例#1
0
 private static void BLZ_Decode(string filename)
 {
     try
     {
         Console.Write($"- decoding '{filename}'");
         long      startTime = DateTime.Now.Millisecond;
         byte[]    buf       = File.ReadAllBytes(filename);
         BlzResult result    = BlzCoder.BLZ_Decode(buf);
         if (result != null)
         {
             BlzCoder.Save(filename, result.buffer, result.length);
         }
         Console.Write(" - done, time="
                       + (DateTime.Now.Millisecond - startTime) + "ms");
         Console.Write(Environment.NewLine + "");
     }
     catch (IOException e)
     {
         Console.Write(Environment.NewLine + "File read error" + Environment.NewLine + e);
     }
 }
示例#2
0
        private void BLZ_Encode(string filename, int mode)
        {
            try
            {
                Console.Write("Now encoding {0}", filename);
                var stopwatch = new Stopwatch();
                stopwatch.Start();

                byte[]    buf    = File.ReadAllBytes(filename);
                BlzResult result = this.BLZ_Encode(buf, mode);
                if (result != null)
                {
                    BlzCoder.Save(filename, result.buffer, result.length);
                }

                stopwatch.Stop();
                Console.Write(Environment.NewLine + "Done, time elapsed = " + stopwatch.ElapsedMilliseconds + "ms" + Environment.NewLine);
            }
            catch (IOException e)
            {
                Console.Write(Environment.NewLine + "File read error" + Environment.NewLine + e + Environment.NewLine);
            }
        }