C# Класс ThemeEditor.Common.Compression.LZ11

Показать файл Открыть проект

Открытые методы

Метод Описание
Compress ( Stream instream, long inLength, Stream outstream, bool original ) : int

Compresses the input using the 'original', unoptimized compression algorithm. This algorithm should yield files that are the same as those found in the games. (delegates to the optimized method if LookAhead is set)

Compress ( string infile, string outfile ) : int
Decompress ( Stream instream, long inLength, Stream outstream ) : long

Decompresses the given stream, writing the decompressed data to the given output stream. Assumes Supports(instream) returns true. After this call, the input stream will be positioned at the end of the compressed stream, or at the initial position + inLength, whichever comes first.

Decompress ( string infile, string outfile ) : long

Приватные методы

Метод Описание
CompressWithLA ( Stream instream, long inLength, Stream outstream ) : int

Variation of the original compression method, making use of Dynamic Programming to 'look ahead' and determine the optimal 'length' values for the compressed blocks. Is not 100% optimal, as the flag-bytes are not taken into account.

GetOptimalCompressionLengths ( byte indata, int inLength, int &lengths, int &disps ) : void

Gets the optimal compression lengths for each start of a compressed block using Dynamic Programming. This takes O(n^2) time, although in practice it will often be O(n^3) since one of the constants is 0x10110 (the maximum length of a compressed block)

Описание методов

Compress() публичный статический Метод

Compresses the input using the 'original', unoptimized compression algorithm. This algorithm should yield files that are the same as those found in the games. (delegates to the optimized method if LookAhead is set)
public static Compress ( Stream instream, long inLength, Stream outstream, bool original ) : int
instream Stream
inLength long
outstream Stream
original bool
Результат int

Compress() публичный статический Метод

public static Compress ( string infile, string outfile ) : int
infile string
outfile string
Результат int

Decompress() публичный статический Метод

Decompresses the given stream, writing the decompressed data to the given output stream. Assumes Supports(instream) returns true. After this call, the input stream will be positioned at the end of the compressed stream, or at the initial position + inLength, whichever comes first.
/// When the given length of the input data /// is not enough to properly decompress the input. ///
public static Decompress ( Stream instream, long inLength, Stream outstream ) : long
instream Stream /// The stream to decompress. At the end of this method, the position /// of this stream is directly after the compressed data. ///
inLength long /// The length of the input data. Not necessarily all of the /// input data may be read (if there is padding, for example), however never more than /// this number of bytes is read from the input stream. ///
outstream Stream The stream to write the decompressed data to.
Результат long

Decompress() публичный статический Метод

public static Decompress ( string infile, string outfile ) : long
infile string
outfile string
Результат long