Imported Upstream version 4.3.2.467

Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
Xamarin Public Jenkins
2016-02-22 11:00:01 -05:00
parent f302175246
commit f3e3aab35a
4097 changed files with 122406 additions and 82300 deletions

View File

@ -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
@ -113,7 +113,6 @@ namespace System.IO
{
}
#if !NET_2_1
public FileStream (SafeFileHandle handle, FileAccess access)
:this(handle, access, DefaultBufferSize, false)
{
@ -130,6 +129,7 @@ namespace System.IO
Init (handle, access, false, bufferSize, isAsync, false);
}
#if !MOBILE
[MonoLimitation ("This ignores the rights parameter")]
public FileStream (string path, FileMode mode,
FileSystemRights rights, FileShare share,
@ -291,10 +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 (!isConsoleWrapper && safeHandle.IsInvalid)
throw new ArgumentException(Environment.GetResourceString("Arg_InvalidHandle"), "handle");
if (access < FileAccess.Read || access > FileAccess.ReadWrite)
throw new ArgumentOutOfRangeException ("access");
if (!isConsoleWrapper && bufferSize <= 0)
throw new ArgumentOutOfRangeException("bufferSize", Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"));
MonoIOError error;
MonoFileType ftype = MonoIO.GetFileType (safeHandle, out error);
@ -411,10 +415,8 @@ namespace System.IO
return ret;
}
set {
if(value < 0) {
throw new ArgumentOutOfRangeException("Attempt to set the position to a negative value");
}
if (value < 0) throw new ArgumentOutOfRangeException("value", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
Seek (value, SeekOrigin.Begin);
}
}