dsdecmp/CSharp/DSDecmp/Exceptions/TooMuchInputException.cs
barubary 3a6221a0c6 C#: Fixed the writing of the header of the RLE compressed files; it should state the decompressed size, and not the compressed size. Also added an exception that indicates there is still some input data to read after the compressed stream.
The current RLE implementation passed the first test: compression->decompression resulted in the same file for a manually created test file. (and the compressed file also has the expected format)
2011-04-05 16:44:41 +00:00

29 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace DSDecmp
{
public class TooMuchInputException : Exception
{
/// <summary>
/// Gets the number of bytes read by the decompressed to decompress the stream.
/// </summary>
public long ReadBytes { get; private set; }
/// <summary>
/// Creates a new exception indicating that the input has more data than necessary for
/// decompressing th stream. It may indicate that other data is present after the compressed
/// stream.
/// </summary>
/// <param name="readBytes">The number of bytes read by the decompressor.</param>
/// <param name="totLength">The indicated length of the input stream.</param>
public TooMuchInputException(long readBytes, long totLength)
: base("The input contains more data than necessary. Only used 0x"
+ readBytes.ToString("X") + " of 0x" + totLength.ToString("X") + " bytes")
{
this.ReadBytes = readBytes;
}
}
}