C#: Added xml comments to methods that did not have any (in the main DSDecmp project).

The SupportsDecompression-flag is now also used in the main program, and not just in composite formats.
This commit is contained in:
barubary 2011-11-14 17:33:30 +00:00
parent aff22d28da
commit 4302517e58
13 changed files with 769 additions and 11 deletions

View File

@ -58,7 +58,6 @@
<Compile Include="Formats\Nitro\NitroCFormat.cs" />
<Compile Include="Formats\Nitro\RLE.cs" />
<Compile Include="NewestProgram.cs" />
<Compile Include="NewProgram.cs" />
<Compile Include="TestProgram.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils\IOUtils.cs" />

View File

@ -5,19 +5,43 @@ using System.IO;
namespace DSDecmp.Formats
{
/// <summary>
/// A format that is composed of multiple formats.
/// When compressing, the input is compressed using the best contained format.
/// When decompressing, all contained formats will try to decompress the file, until one succeeds.
/// </summary>
public abstract class CompositeFormat : CompressionFormat
{
/// <summary>
/// The actual list of formats this format is somposed of.
/// </summary>
private List<CompressionFormat> formats;
#region Constructors
/// <summary>
/// Creates a new composite format based on the given sequence of formats.
/// </summary>
protected CompositeFormat(IEnumerable<CompressionFormat> formats)
{
this.formats = new List<CompressionFormat>(formats);
}
/// <summary>
/// Creates a new composite format based on the given formats.
/// </summary>
protected CompositeFormat(params CompressionFormat[] formats)
{
this.formats = new List<CompressionFormat>(formats);
}
#endregion
#region Method: Supports
/// <summary>
/// Checks if any of the contained formats supports the given input.
/// </summary>
public override bool Supports(System.IO.Stream stream, long inLength)
{
foreach (CompositeFormat fmt in this.formats)
@ -27,7 +51,13 @@ namespace DSDecmp.Formats
}
return false;
}
#endregion
#region Method: Decompress
/// <summary>
/// Attempts to decompress the given input by letting all contained formats
/// try to decompress the input.
/// </summary>
public override long Decompress(System.IO.Stream instream, long inLength, System.IO.Stream outstream)
{
byte[] inputData = new byte[instream.Length];
@ -57,8 +87,17 @@ namespace DSDecmp.Formats
throw new InvalidDataException("Input cannot be decompressed using the " + this.ShortFormatString + " formats.");
}
#endregion
#region Method: Compress & Field: LastUsedCompressFormatString
/// <summary>
/// Gets the ShortFormatString of the last CompressionFormat that was used to compress input.
/// </summary>
public string LastUsedCompressFormatString { get; private set; }
/// <summary>
/// Compresses the given input using the contained format that yields the best results in terms of
/// size reduction.
/// </summary>
public override int Compress(System.IO.Stream instream, long inLength, System.IO.Stream outstream)
{
// only read the input data once from the file.
@ -110,7 +149,12 @@ namespace DSDecmp.Formats
this.LastUsedCompressFormatString = bestFormatString;
return minCompSize;
}
#endregion
#region Method: ParseCompressionOptions(args)
/// <summary>
/// Handles the compression options for each of the contained compression formats.
/// </summary>
public override int ParseCompressionOptions(string[] args)
{
// try each option on each of the formats.
@ -144,5 +188,7 @@ namespace DSDecmp.Formats
}
return totalOptionCount;
}
#endregion
}
}

View File

@ -13,21 +13,33 @@ namespace DSDecmp.Formats
/// </summary>
public sealed class LZOvl : CompressionFormat
{
/// <summary>
/// Gets a short string identifying this compression format.
/// </summary>
public override string ShortFormatString
{
get { return "LZ-Ovl"; }
}
/// <summary>
/// Gets a short description of this compression format (used in the program usage).
/// </summary>
public override string Description
{
get { return "Reverse LZ format, mainly used in 'overlay' files of NDS games."; }
}
/// <summary>
/// Gets the value that must be given on the command line in order to compress using this format.
/// </summary>
public override string CompressionFlag
{
get { return "lzovl"; }
}
/// <summary>
/// Gets if this format supports compressing a file.
/// </summary>
public override bool SupportsCompression
{
get { return true; }
@ -44,6 +56,10 @@ namespace DSDecmp.Formats
set { lookAhead = value; }
}
/// <summary>
/// Checks if the given aguments have the '-opt' option, which makes this format
/// compress using (near-)optimal compression instead of the original compression algorithm.
/// </summary>
public override int ParseCompressionOptions(string[] args)
{
if (args.Length > 0)
@ -56,6 +72,9 @@ namespace DSDecmp.Formats
}
#region Method: Supports(string file)
/// <summary>
/// Checks if this format supports decompressing the given file.
/// </summary>
public override bool Supports(string file)
{
using (FileStream fstr = File.OpenRead(file))
@ -70,6 +89,9 @@ namespace DSDecmp.Formats
#endregion
#region Method: Supports(Stream, long)
/// <summary>
/// Checks if this format supports decompressing the given input.
/// </summary>
public override bool Supports(System.IO.Stream stream, long inLength)
{
// assume the 'inLength' does not include the 12 bytes at the end of arm9.bin
@ -113,6 +135,9 @@ namespace DSDecmp.Formats
#endregion
#region Method: Decompress(string, string)
/// <summary>
/// Decompresses the given input file to the given output file using the LZ-Overlay compression format.
/// </summary>
public override void Decompress(string infile, string outfile)
{
// make sure the output directory exists
@ -133,6 +158,9 @@ namespace DSDecmp.Formats
#endregion
#region Decompression method
/// <summary>
/// Decompresses the given input using the LZ-Overlay compression scheme.
/// </summary>
public override long Decompress(System.IO.Stream instream, long inLength, System.IO.Stream outstream)
{
#region Format description
@ -325,6 +353,9 @@ namespace DSDecmp.Formats
#endregion
#region Compression method; delegates to CompressNormal
/// <summary>
/// Compresses the input using the LZ-Overlay compression scheme.
/// </summary>
public override int Compress(System.IO.Stream instream, long inLength, System.IO.Stream outstream)
{
// don't bother trying to get the optimal not-compressed - compressed ratio for now.

View File

@ -4,52 +4,88 @@ using System.Text;
namespace DSDecmp.Formats.Nitro
{
/// <summary>
/// A composite format with all formats supported natively by the GBA.
/// </summary>
public class CompositeGBAFormat : CompositeFormat
{
/// <summary>
/// Creates a new instance of the format composed of all native GBA compression formats.
/// </summary>
public CompositeGBAFormat()
: base(new Huffman4(), new Huffman8(), new LZ10()) { }
/// <summary>
/// Gets a short string identifying this compression format.
/// </summary>
public override string ShortFormatString
{
get { return "GBA"; }
}
/// <summary>
/// Gets a short description of this compression format (used in the program usage).
/// </summary>
public override string Description
{
get { return "All formats natively supported by the GBA."; }
}
/// <summary>
/// Gets if this format supports compressing a file.
/// </summary>
public override bool SupportsCompression
{
get { return true; }
}
/// <summary>
/// Gets the value that must be given on the command line in order to compress using this format.
/// </summary>
public override string CompressionFlag
{
get { return "gba*"; }
}
}
/// <summary>
/// A composite format with all formats supported natively by the NDS (but not LZ-Overlay)
/// </summary>
public class CompositeNDSFormat : CompositeFormat
{
/// <summary>
/// Creates a new instance of the format composed of all native NDS compression formats.
/// </summary>
public CompositeNDSFormat()
: base(new Huffman4(), new Huffman8(), new LZ10(), new LZ11()) { }
/// <summary>
/// Gets a short string identifying this compression format.
/// </summary>
public override string ShortFormatString
{
get { return "NDS"; }
}
/// <summary>
/// Gets a short description of this compression format (used in the program usage).
/// </summary>
public override string Description
{
get { return "All formats natively supported by the NDS."; }
}
/// <summary>
/// Gets if this format supports compressing a file.
/// </summary>
public override bool SupportsCompression
{
get { return true; }
}
/// <summary>
/// Gets the value that must be given on the command line in order to compress using this format.
/// </summary>
public override string CompressionFlag
{
get { return "nds*"; }

View File

@ -11,25 +11,66 @@ namespace DSDecmp.Formats.Nitro
/// </summary>
public abstract class Huffman : NitroCFormat
{
public enum BlockSize : byte { FOURBIT = 0x24, EIGHTBIT = 0x28 }
#region Enum: BlockSize
/// <summary>
/// The possible data sizes used in Huffman compression formats on the GBA/NDS.
/// </summary>
public enum BlockSize : byte
{
/// <summary>
/// Each data block is four bits long.
/// </summary>
FOURBIT = 0x24,
/// <summary>
/// Each data block is eight bits long.
/// </summary>
EIGHTBIT = 0x28
}
#endregion
/// <summary>
/// Sets the block size used when using the Huffman format to compress.
/// </summary>
public BlockSize CompressBlockSize { get; set; }
/// <summary>
/// Gets if this format supports compression. Always returns true.
/// </summary>
public override bool SupportsCompression
{
get { return true; }
}
public Huffman(BlockSize blockSize)
#region Internal Constructor(BlockSize)
/// <summary>
/// Creates a new generic instance of the Huffman compression format.
/// </summary>
/// <param name="blockSize">The block size used.</param>
internal Huffman(BlockSize blockSize)
: base((byte)blockSize)
{
this.CompressBlockSize = blockSize;
}
#endregion
#region Decompression method
/// <summary>
/// Decompresses the given stream, writing the decompressed data to the given output stream.
/// Assumes <code>Supports(instream)</code> returns <code>true</code>.
/// After this call, the input stream will be positioned at the end of the compressed stream,
/// or at the initial position + <code>inLength</code>, whichever comes first.
/// </summary>
/// <param name="instream">The stream to decompress. At the end of this method, the position
/// of this stream is directly after the compressed data.</param>
/// <param name="inLength">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.</param>
/// <param name="outstream">The stream to write the decompressed data to.</param>
/// <returns>The length of the output data.</returns>
/// <exception cref="NotEnoughDataException">When the given length of the input data
/// is not enough to properly decompress the input.</exception>
public override long Decompress(Stream instream, long inLength, Stream outstream)
{
#region GBATEK format specification
@ -415,6 +456,9 @@ namespace DSDecmp.Formats.Nitro
}
#endregion
/// <summary>
/// Generates and returns a string-representation of the huffman tree starting at this node.
/// </summary>
public override string ToString()
{
if (this.isData)
@ -431,23 +475,38 @@ namespace DSDecmp.Formats.Nitro
#endregion
}
public class Huffman4 : Huffman
/// <summary>
/// The Huffman compression scheme using 4-bit data blocks.
/// </summary>
public sealed class Huffman4 : Huffman
{
/// <summary>
/// Gets a short string identifying this compression format.
/// </summary>
public override string ShortFormatString
{
get { return "Huffman-4"; }
}
/// <summary>
/// Gets a short description of this compression format.
/// </summary>
public override string Description
{
get { return "Huffman compression scheme using 4-bit datablocks."; }
}
/// <summary>
/// Gets the value that must be given on the command line in order to compress using this format.
/// </summary>
public override string CompressionFlag
{
get { return "huff4"; }
}
/// <summary>
/// Creates a new instance of the 4-bit Huffman compression format.
/// </summary>
public Huffman4()
: base(BlockSize.FOURBIT) { }
@ -618,23 +677,38 @@ namespace DSDecmp.Formats.Nitro
#endregion
}
public class Huffman8 : Huffman
/// <summary>
/// The Huffman compression scheme using 8-bit data blocks.
/// </summary>
public sealed class Huffman8 : Huffman
{
/// <summary>
/// Gets a short string identifying this compression format.
/// </summary>
public override string ShortFormatString
{
get { return "Huffman-8"; }
}
/// <summary>
/// Gets a short description of this compression format.
/// </summary>
public override string Description
{
get { return "Huffman compression scheme using 8-bit datablocks."; }
}
/// <summary>
/// Gets the value that must be given on the command line in order to compress using this format.
/// </summary>
public override string CompressionFlag
{
get { return "huff8"; }
}
/// <summary>
/// Creates a new instance of the 4-bit Huffman compression format.
/// </summary>
public Huffman8()
: base(BlockSize.EIGHTBIT) { }
@ -950,26 +1024,44 @@ namespace DSDecmp.Formats.Nitro
#endregion
}
/// <summary>
/// Composite compression format representing both Huffman compression schemes.
/// </summary>
public class HuffmanAny : CompositeFormat
{
/// <summary>
/// Creates a new instance of the general Huffman compression format.
/// </summary>
public HuffmanAny()
: base(new Huffman4(), new Huffman8()) { }
/// <summary>
/// Gets a short string identifying this compression format.
/// </summary>
public override string ShortFormatString
{
get { return "Huffman"; }
}
/// <summary>
/// Gets a short description of this compression format.
/// </summary>
public override string Description
{
get { return "Either the Huffman-4 or Huffman-8 format."; }
}
/// <summary>
/// Gets if this format supports compression. Always returns true.
/// </summary>
public override bool SupportsCompression
{
get { return true; }
}
/// <summary>
/// Gets the value that must be given on the command line in order to compress using this format.
/// </summary>
public override string CompressionFlag
{
get { return "huff"; }

View File

@ -10,21 +10,33 @@ namespace DSDecmp.Formats.Nitro
/// </summary>
public sealed class LZ10 : NitroCFormat
{
/// <summary>
/// Gets a short string identifying this compression format.
/// </summary>
public override string ShortFormatString
{
get { return "LZ-10"; }
}
/// <summary>
/// Gets a short description of this compression format (used in the program usage).
/// </summary>
public override string Description
{
get { return "Common LZ-type compression used in many post-GBC Nintendo games."; }
}
/// <summary>
/// Gets the value that must be given on the command line in order to compress using this format.
/// </summary>
public override string CompressionFlag
{
get { return "lz10"; }
}
/// <summary>
/// Gets if this format supports compressing a file.
/// </summary>
public override bool SupportsCompression
{
get { return true; }
@ -41,8 +53,15 @@ namespace DSDecmp.Formats.Nitro
set { lookAhead = value; }
}
/// <summary>
/// Creates a new instance of the LZ-10 compression format.
/// </summary>
public LZ10() : base(0x10) { }
/// <summary>
/// Checks if the given aguments have the '-opt' option, which makes this format
/// compress using (near-)optimal compression instead of the original compression algorithm.
/// </summary>
public override int ParseCompressionOptions(string[] args)
{
if (args.Length > 0)
@ -201,6 +220,11 @@ namespace DSDecmp.Formats.Nitro
#endregion
#region Original Compress method
/// <summary>
/// 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)
/// </summary>
public unsafe override int Compress(Stream instream, long inLength, Stream outstream)
{
// make sure the decompressed size fits in 3 bytes.

View File

@ -11,21 +11,33 @@ namespace DSDecmp.Formats.Nitro
/// </summary>
public sealed class LZ11 : NitroCFormat
{
/// <summary>
/// Gets a short string identifying this compression format.
/// </summary>
public override string ShortFormatString
{
get { return "LZ-11"; }
}
/// <summary>
/// Gets a short description of this compression format (used in the program usage).
/// </summary>
public override string Description
{
get { return "Variant of the LZ-0x10 format to support longer repetitions."; }
}
/// <summary>
/// Gets the value that must be given on the command line in order to compress using this format.
/// </summary>
public override string CompressionFlag
{
get { return "lz11"; }
}
/// <summary>
/// Gets if this format supports compressing a file.
/// </summary>
public override bool SupportsCompression
{
get { return true; }
@ -42,8 +54,15 @@ namespace DSDecmp.Formats.Nitro
set { lookAhead = value; }
}
/// <summary>
/// Creates a new instance of the LZ-11 compression format.
/// </summary>
public LZ11() : base(0x11) { }
/// <summary>
/// Checks if the given aguments have the '-opt' option, which makes this format
/// compress using (near-)optimal compression instead of the original compression algorithm.
/// </summary>
public override int ParseCompressionOptions(string[] args)
{
LookAhead = false;
@ -57,6 +76,9 @@ namespace DSDecmp.Formats.Nitro
}
#region Decompression method
/// <summary>
/// Decompresses the input using the LZ-11 compression scheme.
/// </summary>
public override long Decompress(Stream instream, long inLength, Stream outstream)
{
#region Format definition in NDSTEK style
@ -268,6 +290,11 @@ namespace DSDecmp.Formats.Nitro
#endregion
#region Original compression method
/// <summary>
/// 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)
/// </summary>
public unsafe override int Compress(Stream instream, long inLength, Stream outstream)
{
// make sure the decompressed size fits in 3 bytes.

View File

@ -27,11 +27,18 @@ namespace DSDecmp.Formats.Nitro
/// </summary>
protected byte magicByte;
public NitroCFormat(byte magicByte)
/// <summary>
/// Creates a new instance of the Nitro Compression Format base class.
/// </summary>
/// <param name="magicByte">The expected first byte of the file for this format.</param>
protected NitroCFormat(byte magicByte)
{
this.magicByte = magicByte;
}
/// <summary>
/// Checks if the first four bytes match the format used in nitro compression formats.
/// </summary>
public override bool Supports(System.IO.Stream stream, long inLength)
{
long startPosition = stream.Position;

View File

@ -11,28 +11,47 @@ namespace DSDecmp.Formats.Nitro
/// </summary>
public sealed class RLE : NitroCFormat
{
/// <summary>
/// Gets a short string identifying this compression format.
/// </summary>
public override string ShortFormatString
{
get { return "RLE"; }
}
/// <summary>
/// Gets a short description of this compression format (used in the program usage).
/// </summary>
public override string Description
{
get { return "Run-Length Encoding used in some modern Nintendo games."; }
}
/// <summary>
/// Gets the value that must be given on the command line in order to compress using this format.
/// </summary>
public override string CompressionFlag
{
get { return "rle"; }
}
/// <summary>
/// Gets if this format supports compressing a file.
/// </summary>
public override bool SupportsCompression
{
get { return true; }
}
/// <summary>
/// Creates a new instance of the RLE compression format.
/// </summary>
public RLE() : base(0x30) { }
#region Method: Decompress
/// <summary>
/// Decompresses the input using the RLE compression scheme.
/// </summary>
public override long Decompress(Stream instream, long inLength, Stream outstream)
{
/*
@ -147,7 +166,12 @@ namespace DSDecmp.Formats.Nitro
return decompressedSize;
}
#endregion Decompress
#region Method: Compress
/// <summary>
/// Compresses the input using the RLE compression scheme.
/// </summary>
public override int Compress(Stream instream, long inLength, Stream outstream)
{
@ -273,5 +297,6 @@ namespace DSDecmp.Formats.Nitro
// the total compressed stream length is the compressed data length + the 4-byte header
return compLen + 4;
}
#endregion Compress
}
}

View File

@ -169,6 +169,9 @@ namespace DSDecmp
bool decompressed = false;
foreach (CompressionFormat format in formats)
{
if (!format.SupportsDecompression)
continue;
#region try to decompress using the current format
using (MemoryStream inStr = new MemoryStream(inputData),
@ -262,8 +265,19 @@ namespace DSDecmp
#endregion Method: Decompress
#region Method: Compress
/// <summary>
/// (Attempts to) Compress the given input to the given output, using the given format.
/// </summary>
/// <param name="ioArgs">The I/O arguments from the program input.</param>
/// <param name="format">The desired format to compress with.</param>
private static void Compress(string[] ioArgs, CompressionFormat format)
{
if (!format.SupportsCompression)
{
Console.WriteLine("Cannot compress using " + format.ShortFormatString + "; compression is not supported.");
return;
}
string[] inputFiles;
string outputDir;
bool copyErrors;
@ -302,7 +316,11 @@ namespace DSDecmp
outStr.WriteTo(output);
}
compressed = true;
Console.WriteLine(format.ShortFormatString + "-compressed " + input + " to " + outputFile);
if (format is CompositeFormat)
Console.Write((format as CompositeFormat).LastUsedCompressFormatString);
else
Console.Write(format.ShortFormatString);
Console.WriteLine("-compressed " + input + " to " + outputFile);
}
}
catch (Exception) { }
@ -346,6 +364,7 @@ namespace DSDecmp
/// Parses the IO arguments of the input.
/// </summary>
/// <param name="ioArgs">The arguments to parse.</param>
/// <param name="compress">If the arguments are used for compression. If not, decompression is assumed. (used for default output folder name)</param>
/// <param name="inputFiles">The files to handle as input.</param>
/// <param name="outputDir">The directory to save the handled files in. If this is null,
/// the files should be overwritten. If this does not exist, it is the output file
@ -452,6 +471,12 @@ namespace DSDecmp
}
#endregion ParseIOArguments
#region Method: GuessExtension(magic, defaultExt)
/// <summary>
/// Guess the extension of a file by looking at the given magic bytes of a file.
/// If they are alphanumeric (without accents), they could indicate the type of file.
/// If no sensible extension could be found from the magic bytes, the given default extension is returned.
/// </summary>
private static string GuessExtension(byte[] magic, string defaultExt)
{
string ext = "";
@ -469,6 +494,7 @@ namespace DSDecmp
return defaultExt;
return ext;
}
#endregion
/// <summary>
/// Copies the source file to the destination path.

View File

@ -247,6 +247,66 @@
Nitro Dcompressor instance.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.NitroCFormat.#ctor(System.Byte)">
<summary>
Creates a new instance of the Nitro Compression Format base class.
</summary>
<param name="magicByte">The expected first byte of the file for this format.</param>
</member>
<member name="M:DSDecmp.Formats.Nitro.NitroCFormat.Supports(System.IO.Stream,System.Int64)">
<summary>
Checks if the first four bytes match the format used in nitro compression formats.
</summary>
</member>
<member name="T:DSDecmp.Formats.CompositeFormat">
<summary>
A format that is composed of multiple formats.
When compressing, the input is compressed using the best contained format.
When decompressing, all contained formats will try to decompress the file, until one succeeds.
</summary>
</member>
<member name="F:DSDecmp.Formats.CompositeFormat.formats">
<summary>
The actual list of formats this format is somposed of.
</summary>
</member>
<member name="M:DSDecmp.Formats.CompositeFormat.#ctor(System.Collections.Generic.IEnumerable{DSDecmp.CompressionFormat})">
<summary>
Creates a new composite format based on the given sequence of formats.
</summary>
</member>
<member name="M:DSDecmp.Formats.CompositeFormat.#ctor(DSDecmp.CompressionFormat[])">
<summary>
Creates a new composite format based on the given formats.
</summary>
</member>
<member name="M:DSDecmp.Formats.CompositeFormat.Supports(System.IO.Stream,System.Int64)">
<summary>
Checks if any of the contained formats supports the given input.
</summary>
</member>
<member name="M:DSDecmp.Formats.CompositeFormat.Decompress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Attempts to decompress the given input by letting all contained formats
try to decompress the input.
</summary>
</member>
<member name="M:DSDecmp.Formats.CompositeFormat.Compress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Compresses the given input using the contained format that yields the best results in terms of
size reduction.
</summary>
</member>
<member name="M:DSDecmp.Formats.CompositeFormat.ParseCompressionOptions(System.String[])">
<summary>
Handles the compression options for each of the contained compression formats.
</summary>
</member>
<member name="P:DSDecmp.Formats.CompositeFormat.LastUsedCompressFormatString">
<summary>
Gets the ShortFormatString of the last CompressionFormat that was used to compress input.
</summary>
</member>
<member name="T:DSDecmp.StreamTooShortException">
<summary>
An exception thrown by the compression or decompression function, indicating that the
@ -264,6 +324,29 @@
newer Nintendo consoles and handhelds.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.LZ11.#ctor">
<summary>
Creates a new instance of the LZ-11 compression format.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.LZ11.ParseCompressionOptions(System.String[])">
<summary>
Checks if the given aguments have the '-opt' option, which makes this format
compress using (near-)optimal compression instead of the original compression algorithm.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.LZ11.Decompress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Decompresses the input using the LZ-11 compression scheme.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.LZ11.Compress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
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)
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.LZ11.CompressWithLA(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Variation of the original compression method, making use of Dynamic Programming to 'look ahead'
@ -284,6 +367,26 @@
<param name="disps">The 'disp' values of the compressed blocks. May be 0, in which case the
corresponding length will never be anything other than 1.</param>
</member>
<member name="P:DSDecmp.Formats.Nitro.LZ11.ShortFormatString">
<summary>
Gets a short string identifying this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.LZ11.Description">
<summary>
Gets a short description of this compression format (used in the program usage).
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.LZ11.CompressionFlag">
<summary>
Gets the value that must be given on the command line in order to compress using this format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.LZ11.SupportsCompression">
<summary>
Gets if this format supports compressing a file.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.LZ11.LookAhead">
<summary>
Sets the flag that determines if 'look-ahead'/DP should be used when compressing
@ -297,6 +400,17 @@
newer Nintendo consoles and handhelds.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.LZ10.#ctor">
<summary>
Creates a new instance of the LZ-10 compression format.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.LZ10.ParseCompressionOptions(System.String[])">
<summary>
Checks if the given aguments have the '-opt' option, which makes this format
compress using (near-)optimal compression instead of the original compression algorithm.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.LZ10.Decompress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Decompress a stream that is compressed in the LZ-10 format.
@ -305,6 +419,13 @@
<param name="inLength">The length of the input stream.</param>
<param name="outstream">The output stream, where the decompressed data is written to.</param>
</member>
<member name="M:DSDecmp.Formats.Nitro.LZ10.Compress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
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)
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.LZ10.CompressWithLA(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Variation of the original compression method, making use of Dynamic Programming to 'look ahead'
@ -324,6 +445,26 @@
<param name="disps">The 'disp' values of the compressed blocks. May be 0, in which case the
corresponding length will never be anything other than 1.</param>
</member>
<member name="P:DSDecmp.Formats.Nitro.LZ10.ShortFormatString">
<summary>
Gets a short string identifying this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.LZ10.Description">
<summary>
Gets a short description of this compression format (used in the program usage).
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.LZ10.CompressionFlag">
<summary>
Gets the value that must be given on the command line in order to compress using this format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.LZ10.SupportsCompression">
<summary>
Gets if this format supports compressing a file.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.LZ10.LookAhead">
<summary>
Sets the flag that determines if 'look-ahead'/DP should be used when compressing
@ -337,6 +478,41 @@
newer Nintendo consoles and handhelds.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.RLE.#ctor">
<summary>
Creates a new instance of the RLE compression format.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.RLE.Decompress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Decompresses the input using the RLE compression scheme.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.RLE.Compress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Compresses the input using the RLE compression scheme.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.RLE.ShortFormatString">
<summary>
Gets a short string identifying this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.RLE.Description">
<summary>
Gets a short description of this compression format (used in the program usage).
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.RLE.CompressionFlag">
<summary>
Gets the value that must be given on the command line in order to compress using this format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.RLE.SupportsCompression">
<summary>
Gets if this format supports compressing a file.
</summary>
</member>
<member name="T:DSDecmp.Formats.LZOvl">
<summary>
The LZ-Overlay compression format. Compresses part of the file from end to start.
@ -345,6 +521,37 @@
decompressing arm9.bin. This is done automatically if a file is given instead of a stream.
</summary>
</member>
<member name="M:DSDecmp.Formats.LZOvl.ParseCompressionOptions(System.String[])">
<summary>
Checks if the given aguments have the '-opt' option, which makes this format
compress using (near-)optimal compression instead of the original compression algorithm.
</summary>
</member>
<member name="M:DSDecmp.Formats.LZOvl.Supports(System.String)">
<summary>
Checks if this format supports decompressing the given file.
</summary>
</member>
<member name="M:DSDecmp.Formats.LZOvl.Supports(System.IO.Stream,System.Int64)">
<summary>
Checks if this format supports decompressing the given input.
</summary>
</member>
<member name="M:DSDecmp.Formats.LZOvl.Decompress(System.String,System.String)">
<summary>
Decompresses the given input file to the given output file using the LZ-Overlay compression format.
</summary>
</member>
<member name="M:DSDecmp.Formats.LZOvl.Decompress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Decompresses the given input using the LZ-Overlay compression scheme.
</summary>
</member>
<member name="M:DSDecmp.Formats.LZOvl.Compress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Compresses the input using the LZ-Overlay compression scheme.
</summary>
</member>
<member name="M:DSDecmp.Formats.LZOvl.CompressNormal(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Compresses the given input stream with the LZ-Ovl compression, but compresses _forward_
@ -382,6 +589,26 @@
<param name="blocklengths">The lengths of the compressed blocks, as gotten from GetOptimalCompressionLengths.</param>
<returns>The 'optimal' length of the compressed part of the file.</returns>
</member>
<member name="P:DSDecmp.Formats.LZOvl.ShortFormatString">
<summary>
Gets a short string identifying this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.LZOvl.Description">
<summary>
Gets a short description of this compression format (used in the program usage).
</summary>
</member>
<member name="P:DSDecmp.Formats.LZOvl.CompressionFlag">
<summary>
Gets the value that must be given on the command line in order to compress using this format.
</summary>
</member>
<member name="P:DSDecmp.Formats.LZOvl.SupportsCompression">
<summary>
Gets if this format supports compressing a file.
</summary>
</member>
<member name="P:DSDecmp.Formats.LZOvl.LookAhead">
<summary>
Sets the flag that determines if 'look-ahead'/DP should be used when compressing
@ -389,16 +616,19 @@
implementation.
</summary>
</member>
<member name="T:DSDecmp.NewProgram.Formats">
<member name="M:DSDecmp.NewestProgram.Compress(System.String[],DSDecmp.CompressionFormat)">
<summary>
The formats allowed when compressing a file.
(Attempts to) Compress the given input to the given output, using the given format.
</summary>
<param name="ioArgs">The I/O arguments from the program input.</param>
<param name="format">The desired format to compress with.</param>
</member>
<member name="M:DSDecmp.NewestProgram.ParseIOArguments(System.String[],System.Boolean,System.String[]@,System.String@,System.Boolean@)">
<summary>
Parses the IO arguments of the input.
</summary>
<param name="ioArgs">The arguments to parse.</param>
<param name="compress">If the arguments are used for compression. If not, decompression is assumed. (used for default output folder name)</param>
<param name="inputFiles">The files to handle as input.</param>
<param name="outputDir">The directory to save the handled files in. If this is null,
the files should be overwritten. If this does not exist, it is the output file
@ -406,6 +636,13 @@
<param name="copyErrors">If files that cannot be handled (properly) should be copied to the output directory.</param>
<returns>True iff parsing of the arguments succeeded.</returns>
</member>
<member name="M:DSDecmp.NewestProgram.GuessExtension(System.Byte[],System.String)">
<summary>
Guess the extension of a file by looking at the given magic bytes of a file.
If they are alphanumeric (without accents), they could indicate the type of file.
If no sensible extension could be found from the magic bytes, the given default extension is returned.
</summary>
</member>
<member name="M:DSDecmp.NewestProgram.Copy(System.String,System.String)">
<summary>
Copies the source file to the destination path.
@ -504,12 +741,95 @@
Gets the number of items in this queue.
</summary>
</member>
<member name="T:DSDecmp.Formats.Nitro.CompositeGBAFormat">
<summary>
A composite format with all formats supported natively by the GBA.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.CompositeGBAFormat.#ctor">
<summary>
Creates a new instance of the format composed of all native GBA compression formats.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.CompositeGBAFormat.ShortFormatString">
<summary>
Gets a short string identifying this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.CompositeGBAFormat.Description">
<summary>
Gets a short description of this compression format (used in the program usage).
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.CompositeGBAFormat.SupportsCompression">
<summary>
Gets if this format supports compressing a file.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.CompositeGBAFormat.CompressionFlag">
<summary>
Gets the value that must be given on the command line in order to compress using this format.
</summary>
</member>
<member name="T:DSDecmp.Formats.Nitro.CompositeNDSFormat">
<summary>
A composite format with all formats supported natively by the NDS (but not LZ-Overlay)
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.CompositeNDSFormat.#ctor">
<summary>
Creates a new instance of the format composed of all native NDS compression formats.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.CompositeNDSFormat.ShortFormatString">
<summary>
Gets a short string identifying this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.CompositeNDSFormat.Description">
<summary>
Gets a short description of this compression format (used in the program usage).
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.CompositeNDSFormat.SupportsCompression">
<summary>
Gets if this format supports compressing a file.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.CompositeNDSFormat.CompressionFlag">
<summary>
Gets the value that must be given on the command line in order to compress using this format.
</summary>
</member>
<member name="T:DSDecmp.Formats.Nitro.Huffman">
<summary>
Compressor and decompressor for the Huffman format used in many of the games for the
newer Nintendo consoles and handhelds.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.Huffman.#ctor(DSDecmp.Formats.Nitro.Huffman.BlockSize)">
<summary>
Creates a new generic instance of the Huffman compression format.
</summary>
<param name="blockSize">The block size used.</param>
</member>
<member name="M:DSDecmp.Formats.Nitro.Huffman.Decompress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Decompresses the given stream, writing the decompressed data to the given output stream.
Assumes <code>Supports(instream)</code> returns <code>true</code>.
After this call, the input stream will be positioned at the end of the compressed stream,
or at the initial position + <code>inLength</code>, whichever comes first.
</summary>
<param name="instream">The stream to decompress. At the end of this method, the position
of this stream is directly after the compressed data.</param>
<param name="inLength">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.</param>
<param name="outstream">The stream to write the decompressed data to.</param>
<returns>The length of the output data.</returns>
<exception cref="T:DSDecmp.NotEnoughDataException">When the given length of the input data
is not enough to properly decompress the input.</exception>
</member>
<member name="M:DSDecmp.Formats.Nitro.Huffman.GetLowest(DSDecmp.SimpleReversedPrioQueue{System.Int32,DSDecmp.Formats.Nitro.Huffman.HuffTreeNode},DSDecmp.SimpleReversedPrioQueue{System.Int32,DSDecmp.Formats.Nitro.Huffman.HuffTreeNode},System.Int32@)">
<summary>
Gets the tree node with the lowest priority (frequency) from the leaf and node queues.
@ -521,6 +841,26 @@
Sets the block size used when using the Huffman format to compress.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.Huffman.SupportsCompression">
<summary>
Gets if this format supports compression. Always returns true.
</summary>
</member>
<member name="T:DSDecmp.Formats.Nitro.Huffman.BlockSize">
<summary>
The possible data sizes used in Huffman compression formats on the GBA/NDS.
</summary>
</member>
<member name="F:DSDecmp.Formats.Nitro.Huffman.BlockSize.FOURBIT">
<summary>
Each data block is four bits long.
</summary>
</member>
<member name="F:DSDecmp.Formats.Nitro.Huffman.BlockSize.EIGHTBIT">
<summary>
Each data block is eight bits long.
</summary>
</member>
<member name="T:DSDecmp.Formats.Nitro.Huffman.HuffTreeNode">
<summary>
A single node in a Huffman tree.
@ -551,6 +891,12 @@
The child of this node at side 1
</summary>
</member>
<member name="F:DSDecmp.Formats.Nitro.Huffman.HuffTreeNode.index">
<summary>
The index of this node in the array for building the proper ordering.
If -1, this node has not yet been placed in the array.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.Huffman.HuffTreeNode.#ctor(System.Byte,System.Boolean,DSDecmp.Formats.Nitro.Huffman.HuffTreeNode,DSDecmp.Formats.Nitro.Huffman.HuffTreeNode)">
<summary>
Manually creates a new node for a huffman tree.
@ -572,6 +918,11 @@
<param name="maxStreamPos">The indicated end of the huffman tree. If the stream is past
this position, the tree is invalid.</param>
</member>
<member name="M:DSDecmp.Formats.Nitro.Huffman.HuffTreeNode.ToString">
<summary>
Generates and returns a string-representation of the huffman tree starting at this node.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.Huffman.HuffTreeNode.Data">
<summary>
The data contained in this node. May not mean anything when <code>isData == false</code>.
@ -620,9 +971,14 @@
Calculates the size of the sub-tree with this node as root.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.Huffman.HuffTreeNode.PreOrderTraversal">
<member name="T:DSDecmp.Formats.Nitro.Huffman4">
<summary>
Returns a seuqnce over the nodes of the sub-tree with this node as root in a pre-order fashion. (Root-Left-Right)
The Huffman compression scheme using 4-bit data blocks.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.Huffman4.#ctor">
<summary>
Creates a new instance of the 4-bit Huffman compression format.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.Huffman4.Compress(System.IO.Stream,System.Int64,System.IO.Stream)">
@ -634,6 +990,31 @@
<param name="outstream">The stream to write the decompressed data to.</param>
<returns>The size of the decompressed data.</returns>
</member>
<member name="P:DSDecmp.Formats.Nitro.Huffman4.ShortFormatString">
<summary>
Gets a short string identifying this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.Huffman4.Description">
<summary>
Gets a short description of this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.Huffman4.CompressionFlag">
<summary>
Gets the value that must be given on the command line in order to compress using this format.
</summary>
</member>
<member name="T:DSDecmp.Formats.Nitro.Huffman8">
<summary>
The Huffman compression scheme using 8-bit data blocks.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.Huffman8.#ctor">
<summary>
Creates a new instance of the 4-bit Huffman compression format.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.Huffman8.Compress(System.IO.Stream,System.Int64,System.IO.Stream)">
<summary>
Applies Huffman compression with a datablock size of 8 bits.
@ -643,5 +1024,69 @@
<param name="outstream">The stream to write the decompressed data to.</param>
<returns>The size of the decompressed data.</returns>
</member>
<member name="M:DSDecmp.Formats.Nitro.Huffman8.Insert(DSDecmp.Formats.Nitro.Huffman.HuffTreeNode,DSDecmp.Formats.Nitro.Huffman.HuffTreeNode[],System.Int32)">
<summary>
Inserts the given node into the given array, in such a location that
the offset to both of its children is at most the given maximum, and as large as possible.
In order to do this, the contents of the array may be shifted to the right.
</summary>
<param name="node">The node to insert.</param>
<param name="array">The array to insert the node in.</param>
<param name="maxOffset">The maximum offset between parent and children.</param>
</member>
<member name="M:DSDecmp.Formats.Nitro.Huffman8.ShiftRight(DSDecmp.Formats.Nitro.Huffman.HuffTreeNode[],System.Int32,System.Int32)">
<summary>
Shifts the node at the given index one to the right.
If the distance between parent and child becomes too large due to this shift, the parent is shifted as well.
</summary>
<param name="array">The array to shift the node in.</param>
<param name="idx">The index of the node to shift.</param>
<param name="maxOffset">The maximum distance between parent and children.</param>
</member>
<member name="P:DSDecmp.Formats.Nitro.Huffman8.ShortFormatString">
<summary>
Gets a short string identifying this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.Huffman8.Description">
<summary>
Gets a short description of this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.Huffman8.CompressionFlag">
<summary>
Gets the value that must be given on the command line in order to compress using this format.
</summary>
</member>
<member name="T:DSDecmp.Formats.Nitro.HuffmanAny">
<summary>
Composite compression format representing both Huffman compression schemes.
</summary>
</member>
<member name="M:DSDecmp.Formats.Nitro.HuffmanAny.#ctor">
<summary>
Creates a new instance of the general Huffman compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.HuffmanAny.ShortFormatString">
<summary>
Gets a short string identifying this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.HuffmanAny.Description">
<summary>
Gets a short description of this compression format.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.HuffmanAny.SupportsCompression">
<summary>
Gets if this format supports compression. Always returns true.
</summary>
</member>
<member name="P:DSDecmp.Formats.Nitro.HuffmanAny.CompressionFlag">
<summary>
Gets the value that must be given on the command line in order to compress using this format.
</summary>
</member>
</members>
</doc>

Binary file not shown.

Binary file not shown.