C# Class ME3Explorer.HuffmanCompression

Exibir arquivo Open project: ME3Explorer/ME3Explorer Class Usage Examples

Public Methods

Method Description
LoadInputData ( string fileName, bool debugVersion ) : void

Loads a file into memory and prepares for compressing it to TLK

SaveToTlkFile ( string fileName ) : void

Dumps data from memory to TLK compressed file format. Compressed data should be read into memory first, by LoadInputData method.

Private Methods

Method Description
BitArrayListToByteArray ( List bitsList, int bitsCount ) : byte[]

Converts bits in a BitArray to an array with bytes. Such array is ready to be written to a file.

BuildCodingArray ( ) : void

Using Huffman Tree (created with BuildHuffmanTree method), generates a binary code for every character.

BuildHuffmanTree ( ) : void

Standard implementation of builidng a Huffman Tree

CompareNodes ( HuffmanNode L1, HuffmanNode L2 ) : int

For sorting Huffman Nodes

ConvertHuffmanTreeToBuffer ( ) : List

Converts a Huffman Tree to it's binary representation used by TLK format of Mass Effect 2.

LoadTxtInputData ( string fileName ) : void
LoadXmlInputData ( string fileName, bool debugVersion ) : void

Loads data from XML file into memory

PrepareHuffmanCoding ( ) : void

Creates Huffman Tree based on data from memory. For every character in text data, a corresponding Huffman Code is prepared. Source: http://en.wikipedia.org/wiki/Huffman_coding

TraverseHuffmanTree ( HuffmanNode node, List code ) : void

Recursively traverses Huffman Tree and generates codes

Method Details

LoadInputData() public method

Loads a file into memory and prepares for compressing it to TLK
public LoadInputData ( string fileName, bool debugVersion ) : void
fileName string
debugVersion bool
return void

SaveToTlkFile() public method

Dumps data from memory to TLK compressed file format. Compressed data should be read into memory first, by LoadInputData method.
public SaveToTlkFile ( string fileName ) : void
fileName string
return void