Пример #1
0
 internal static unsafe void Compact(CompressionType type, VoidPtr srcAddr, int srcLen, Stream outStream)
 {
     switch (type)
     {
     case CompressionType.LZ77: { LZ77.Compact(srcAddr, srcLen, outStream, null); break; }
     }
 }
Пример #2
0
        public static unsafe void Compact(CompressionType type, VoidPtr srcAddr, int srcLen, Stream outStream, ResourceNode r)
        {
            switch (type)
            {
            case CompressionType.LZ77: { LZ77.Compact(srcAddr, srcLen, outStream, r, false); break; }

            case CompressionType.ExtendedLZ77: { LZ77.Compact(srcAddr, srcLen, outStream, r, true); break; }

            case CompressionType.RunLength: { RunLength.Compact(srcAddr, srcLen, outStream, r); break; }
            }
        }
Пример #3
0
 public static int Compact(VoidPtr srcAddr, int srcLen, Stream outStream, ResourceNode r, bool extendedFormat)
 {
     using (LZ77 lz = new LZ77())
     {
         using (ProgressWindow prog = new ProgressWindow(r.RootNode._mainForm,
                                                         (extendedFormat ? "Extended " : "") + "LZ77",
                                                         $"Compressing {r.Name}, please wait...", false))
         {
             return(lz.Compress(srcAddr, srcLen, outStream, prog, extendedFormat));
         }
     }
 }
Пример #4
0
        public static void Expand(CompressionHeader *header, VoidPtr dstAddr, int dstLen)
        {
            switch (header->Algorithm)
            {
            case CompressionType.LZ77: { LZ77.Expand(header, dstAddr, dstLen); break; }

            case CompressionType.Huffman:
            case CompressionType.RunLength:
            case CompressionType.Differential:
            default:
                throw new InvalidCompressionException("Unknown compression type.");
            }
        }
Пример #5
0
 public static int Compact(VoidPtr srcAddr, int srcLen, Stream outStream, ResourceNode r, bool extendedFormat)
 {
     using (LZ77 lz = new LZ77())
     using (ProgressWindow prog = new ProgressWindow(r.RootNode._mainForm, (extendedFormat ? "Extended " : "") + "LZ77", String.Format("Compressing {0}, please wait...", r.Name), false))
         return lz.Compress(srcAddr, srcLen, outStream, prog, extendedFormat);
 }
Пример #6
0
 public static int Compact(VoidPtr srcAddr, int srcLen, Stream outStream, string name)
 {
     using (LZ77 lz = new LZ77())
         using (ProgressWindow prog = new ProgressWindow(null, "LZ77", String.Format("Compressing {0}, please wait...", name), false))
             return(lz.Compress(srcAddr, srcLen, outStream, prog));
 }