Imports/Trinet.Core.IO.Ntfs/Source/AlternateDataStreamInfo.cs
/// <summary>
/// Opens this alternate data stream.
/// </summary>
/// <param name="mode">
/// A <see cref="FileMode"/> value that specifies whether a stream is created if one does not exist, 
/// and determines whether the contents of existing streams are retained or overwritten.
/// </param>
/// <param name="access">
/// A <see cref="FileAccess"/> value that specifies the operations that can be performed on the stream. 
/// </param>
/// <param name="share">
/// A <see cref="FileShare"/> value specifying the type of access other threads have to the file. 
/// </param>
/// <param name="bufferSize">
/// The size of the buffer to use.
/// </param>
/// <param name="useAsync">
/// <see langword="true"/> to enable async-IO;
/// otherwise, <see langword="false"/>.
/// </param>
/// <returns>
/// A <see cref="FileStream"/> for this alternate data stream.
/// </returns>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="bufferSize"/> is less than or equal to zero.
/// </exception>
/// <exception cref="SecurityException">
/// The caller does not have the required permission. 
/// </exception>
/// <exception cref="UnauthorizedAccessException">
/// The caller does not have the required permission, or the file is read-only.
/// </exception>
/// <exception cref="IOException">
/// The specified file is in use. 
/// </exception>
/// <exception cref="ArgumentException">
/// The path of the stream is invalid.
/// </exception>
/// <exception cref="Win32Exception">
/// There was an error opening the stream.
/// </exception>
Opens this alternate data stream.
Opens this alternate data stream .
public FileStream Open(FileMode mode, FileAccess access, FileShare share, int bufferSize, bool useAsync)
		{
			if (0 >= bufferSize) throw new ArgumentOutOfRangeException("bufferSize", bufferSize, null);
			FileIOPermissionAccess permAccess = CalculateAccess(mode, access);
			new FileIOPermission(permAccess, _filePath).Demand();
			SafeNativeMethods.NativeFileFlags flags = useAsync ? SafeNativeMethods.NativeFileFlags.Overlapped : 0;
			var handle = SafeNativeMethods.SafeCreateFile(this.FullPath, SafeNativeMethods.ToNative(access), share, IntPtr.Zero, mode, flags, IntPtr.Zero);
			if (handle.IsInvalid) SafeNativeMethods.ThrowLastWin32Error();
			return new FileStream(handle, access, bufferSize, useAsync);
		}
public FileStream Open ( FileMode mode , FileAccess access , FileShare share , int bufferSize , bool useAsync ) { if ( 0 >= bufferSize ) throw new ArgumentOutOfRangeException ( " " , bufferSize , null ) ; FileIOPermissionAccess permAccess = CalculateAccess ( mode , access ) ; new FileIOPermission ( permAccess , _filePath ) . Demand ( ) ; SafeNativeMethods . NativeFileFlags flags = useAsync ? SafeNativeMethods . NativeFileFlags . Overlapped : 0 ; var handle = SafeNativeMethods . SafeCreateFile ( this . FullPath , SafeNativeMethods . ToNative ( access ) , share , IntPtr . Zero , mode , flags , IntPtr . Zero ) ; if ( handle . IsInvalid ) SafeNativeMethods . ThrowLastWin32Error ( ) ; return new FileStream ( handle , access , bufferSize , useAsync ) ; }
Opens this alternate data stream.
Opens this alternate data stream .
A  for this alternate data stream.
A for this alternate data stream .
None
The caller does not have the required permission.
The caller does not have the required permission .
The caller does not have the required permission, or the file is read-only.
The caller does not have the required permission or the file is read - only .
The specified file is in use.
The specified file is in use .
The path of the stream is invalid.
The path of the stream is invalid .
There was an error opening the stream.
There was an error opening the stream .
mode
FileMode
A  value that specifies whether a stream is created if one does not exist,
and determines whether the contents of existing streams are retained or overwritten.
A value that specifies whether a stream is created if one does not exist and determines whether the contents of existing streams are retained or overwritten .
access
FileAccess
A  value that specifies the operations that can be performed on the stream.
A value that specifies the operations that can be performed on the stream .
share
FileShare
A  value specifying the type of access other threads have to the file.
A value specifying the type of access other threads have to the file .
bufferSize
int
The size of the buffer to use.
The size of the buffer to use .
useAsync
bool
to enable async-IO;
otherwise, .
to enable async - IO ; otherwise .