diff --git a/CSharp/Libraries/UniversalEditor.Core/ExtensionMethods.cs b/CSharp/Libraries/UniversalEditor.Core/ExtensionMethods.cs index ce49c41e..29db4a38 100644 --- a/CSharp/Libraries/UniversalEditor.Core/ExtensionMethods.cs +++ b/CSharp/Libraries/UniversalEditor.Core/ExtensionMethods.cs @@ -528,9 +528,13 @@ namespace UniversalEditor } public static byte[] ToByteArray(this System.IO.Stream stream) { + long oldpos = stream.Position; + byte[] array = new byte[(int)((IntPtr)stream.Length)]; stream.Position = 0L; stream.Read(array, 0, array.Length); + + stream.Position = oldpos; return array; } #endregion