Remove dependency on System.Linq
This commit is contained in:
parent
2474da3ba1
commit
ebda8dbed3
|
@ -2,7 +2,6 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Linq;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
||||||
namespace Kaitai
|
namespace Kaitai
|
||||||
|
@ -615,7 +614,8 @@ namespace Kaitai
|
||||||
{
|
{
|
||||||
using (MemoryStream target = new MemoryStream())
|
using (MemoryStream target = new MemoryStream())
|
||||||
{
|
{
|
||||||
ds.CopyTo(target);
|
byte[] buffer = new byte[32768];
|
||||||
|
CopyTo(target, ds);
|
||||||
return target.ToArray();
|
return target.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -708,5 +708,24 @@ namespace Kaitai
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Compatibility methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Replaces Stream.CopyTo from System.Linq for backwards compatibility.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source">Stream to copy data from.</param>
|
||||||
|
/// <param name="destination">Stream to copy data to.</param>
|
||||||
|
private static void CopyTo(Stream source, Stream destination)
|
||||||
|
{
|
||||||
|
byte[] buffer = new byte[32768];
|
||||||
|
int read;
|
||||||
|
while ((read = source.Read(buffer, 0, buffer.Length)) > 0)
|
||||||
|
{
|
||||||
|
destination.Write(buffer, 0, read);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue