diff options
author | Marek Safar <marek.safar@gmail.com> | 2015-08-19 18:18:54 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2015-08-19 18:18:54 +0300 |
commit | ce89d264dc6c425bf0040ff7f042168891d3bdbe (patch) | |
tree | 360a0cc4bbbd0f87087a3d7b50c7469acca01588 /mcs/class/corlib/System.IO | |
parent | 8b51c80715dc331fd4de1d025246dcebdddf7f90 (diff) |
[corlib] Add underlying Console stream specialization to FileStream
Diffstat (limited to 'mcs/class/corlib/System.IO')
-rw-r--r-- | mcs/class/corlib/System.IO/FileStream.cs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/mcs/class/corlib/System.IO/FileStream.cs b/mcs/class/corlib/System.IO/FileStream.cs index bec2722bfad..0c259783836 100644 --- a/mcs/class/corlib/System.IO/FileStream.cs +++ b/mcs/class/corlib/System.IO/FileStream.cs @@ -73,12 +73,12 @@ namespace System.IO : this (handle, access, ownsHandle, bufferSize, isAsync, false) {} [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)] - internal FileStream (IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize, bool isAsync, bool isZeroSize) + internal FileStream (IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize, bool isAsync, bool isConsoleWrapper) { if (handle == MonoIO.InvalidHandle) throw new ArgumentException ("handle", Locale.GetText ("Invalid.")); - Init (new SafeFileHandle (handle, false), access, ownsHandle, bufferSize, isAsync, isZeroSize); + Init (new SafeFileHandle (handle, false), access, ownsHandle, bufferSize, isAsync, isConsoleWrapper); } // construct from filename @@ -291,15 +291,14 @@ namespace System.IO } } - private void Init (SafeFileHandle safeHandle, FileAccess access, bool ownsHandle, int bufferSize, bool isAsync, bool isZeroSize) + private void Init (SafeFileHandle safeHandle, FileAccess access, bool ownsHandle, int bufferSize, bool isAsync, bool isConsoleWrapper) { - if (safeHandle.IsInvalid) + if (!isConsoleWrapper && safeHandle.IsInvalid) throw new ArgumentException(Environment.GetResourceString("Arg_InvalidHandle"), "handle"); if (access < FileAccess.Read || access > FileAccess.ReadWrite) throw new ArgumentOutOfRangeException ("access"); -// TODO: enable -// if (bufferSize <= 0) -// throw new ArgumentOutOfRangeException("bufferSize", Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum")); + if (!isConsoleWrapper && bufferSize <= 0) + throw new ArgumentOutOfRangeException("bufferSize", Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum")); MonoIOError error; MonoFileType ftype = MonoIO.GetFileType (safeHandle, out error); |