add exceptions for debugging
This commit is contained in:
@@ -122,6 +122,15 @@ namespace OpenRA.FileSystem
|
|||||||
|
|
||||||
static uint[] ReadBlocks(Stream s, long offset, int count)
|
static uint[] ReadBlocks(Stream s, long offset, int count)
|
||||||
{
|
{
|
||||||
|
if (offset < 0)
|
||||||
|
throw new ArgumentOutOfRangeException("offset", "Non-negative number required.");
|
||||||
|
|
||||||
|
if (count < 0)
|
||||||
|
throw new ArgumentOutOfRangeException("count", "Non-negative number required.");
|
||||||
|
|
||||||
|
if (offset + (count * 2) > s.Length)
|
||||||
|
throw new ArgumentException("Bytes to read {0} and offset {1} greater than stream length {2}.".F(count * 2, offset, s.Length));
|
||||||
|
|
||||||
s.Seek(offset, SeekOrigin.Begin);
|
s.Seek(offset, SeekOrigin.Begin);
|
||||||
|
|
||||||
// A block is a single encryption unit (represented as two 32-bit integers)
|
// A block is a single encryption unit (represented as two 32-bit integers)
|
||||||
|
|||||||
Reference in New Issue
Block a user