diff options
Diffstat (limited to 'mcs/class/corlib/System.IO/FileStream.cs')
-rw-r--r-- | mcs/class/corlib/System.IO/FileStream.cs | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/mcs/class/corlib/System.IO/FileStream.cs b/mcs/class/corlib/System.IO/FileStream.cs index 738dc0e859d..2181a3d7f48 100644 --- a/mcs/class/corlib/System.IO/FileStream.cs +++ b/mcs/class/corlib/System.IO/FileStream.cs @@ -142,22 +142,17 @@ namespace System.IO throw new ArgumentException ("Name is empty"); } -#if NET_2_0 - // ignore the Inheritable flag - share &= ~FileShare.Inheritable; -#endif - if (bufferSize <= 0) throw new ArgumentOutOfRangeException ("Positive number required."); if (mode < FileMode.CreateNew || mode > FileMode.Append) - throw new ArgumentOutOfRangeException ("mode", "Enum value was out of legal range."); + throw new ArgumentOutOfRangeException ("mode"); if (access < FileAccess.Read || access > FileAccess.ReadWrite) - throw new ArgumentOutOfRangeException ("access", "Enum value was out of legal range."); + throw new ArgumentOutOfRangeException ("access"); if (share < FileShare.None || share > FileShare.ReadWrite) - throw new ArgumentOutOfRangeException ("share", "Enum value was out of legal range."); + throw new ArgumentOutOfRangeException ("share"); if (name.IndexOfAny (Path.InvalidPathChars) != -1) { throw new ArgumentException ("Name has invalid chars"); @@ -174,16 +169,13 @@ namespace System.IO * docs) */ if (mode==FileMode.Append && - (access&FileAccess.Read)==FileAccess.Read) { - throw new ArgumentException("Append access can be requested only in write-only mode."); + (access&FileAccess.Read)==FileAccess.Read) { + throw new ArgumentException("Append streams can not be read"); } if ((access & FileAccess.Write) == 0 && - (mode != FileMode.Open && mode != FileMode.OpenOrCreate)) { - string msg = Locale.GetText ("Combining FileMode: {0} with " + - "FileAccess: {1} is invalid."); - throw new ArgumentException (string.Format (msg, access, mode)); - } + (mode != FileMode.Open && mode != FileMode.OpenOrCreate)) + throw new ArgumentException ("access and mode not compatible"); string dname = Path.GetDirectoryName (name); if (dname.Length > 0) { |