Imports/Trinet.Core.IO.Ntfs/Source/AlternateDataStreamInfo.cs
/// <summary>
/// Calculates the access to demand.
/// </summary>
/// <param name="mode">
/// The <see cref="FileMode"/>.
/// </param>
/// <param name="access">
/// The <see cref="FileAccess"/>.
/// </param>
/// <returns>
/// The <see cref="FileIOPermissionAccess"/>.
/// </returns>
Calculates the access to demand.
Calculates the access to demand .
private static FileIOPermissionAccess CalculateAccess(FileMode mode, FileAccess access)
		{
			FileIOPermissionAccess permAccess = FileIOPermissionAccess.NoAccess;
			switch (mode)
			{
				case FileMode.Append:
					permAccess = FileIOPermissionAccess.Append;
					break;
				case FileMode.Create:
				case FileMode.CreateNew:
				case FileMode.OpenOrCreate:
				case FileMode.Truncate:
					permAccess = FileIOPermissionAccess.Write;
					break;
				case FileMode.Open:
					permAccess = FileIOPermissionAccess.Read;
					break;
			}
			switch (access)
			{
				case FileAccess.ReadWrite:
					permAccess |= FileIOPermissionAccess.Write;
					permAccess |= FileIOPermissionAccess.Read;
					break;
				case FileAccess.Write:
					permAccess |= FileIOPermissionAccess.Write;
					break;
				case FileAccess.Read:
					permAccess |= FileIOPermissionAccess.Read;
					break;
			}
			return permAccess;
		}
private static FileIOPermissionAccess CalculateAccess ( FileMode mode , FileAccess access ) { FileIOPermissionAccess permAccess = FileIOPermissionAccess . NoAccess ; switch ( mode ) { case FileMode . Append : permAccess = FileIOPermissionAccess . Append ; break ; case FileMode . Create : case FileMode . CreateNew : case FileMode . OpenOrCreate : case FileMode . Truncate : permAccess = FileIOPermissionAccess . Write ; break ; case FileMode . Open : permAccess = FileIOPermissionAccess . Read ; break ; } switch ( access ) { case FileAccess . ReadWrite : permAccess |= FileIOPermissionAccess . Write ; permAccess |= FileIOPermissionAccess . Read ; break ; case FileAccess . Write : permAccess |= FileIOPermissionAccess . Write ; break ; case FileAccess . Read : permAccess |= FileIOPermissionAccess . Read ; break ; } return permAccess ; }
Calculates the access to demand.
Calculates the access to demand .
None
mode
FileMode
None
access
FileAccess
None