예제 #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));
 }