internal static extern SafeFileHandle CreateFileW( string lpFileName, FileAccessEx dwDesiredAccess, FileShareEx dwShareMode, IntPtr SecurityAttributes, CreationDisposition dwCreationDisposition, FileAttributes dwFlagsAndAttributes, IntPtr hTemplateFile );
public static extern SafeFileHandle CreateFile( string fileName, [MarshalAs(UnmanagedType.U4)] FileAccessEx fileAccess, [MarshalAs(UnmanagedType.U4)] FileShare fileShare, IntPtr securityAttributes, [MarshalAs(UnmanagedType.U4)] FileMode creationDisposition, FileOptions flags, IntPtr template );
/// <summary> /// Opens a FileStream on the specified path. /// </summary> /// <param name="path">The file to open.</param> /// <param name="mode">A FileMode value that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten.</param> /// <param name="access">A FileAccess value that specifies the operations that can be performed on the file.</param> /// <param name="share">A FileShare value specifying the type of access other threads have to the file. </param> /// <returns>A FileStream on the specified path, having the specified mode with read, write, or read/write access and the specified sharing option.</returns> public static FileStream Open(string path, FileMode mode, FileAccessEx access, FileShare share) { return(File.Open(path, mode, (System.IO.FileAccess)access, (System.IO.FileShare)share)); }
/// <summary> /// Opens a FileStream on the specified path. /// </summary> /// <param name="path">The file to open.</param> /// <param name="mode">A FileMode value that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten.</param> /// <param name="access">A FileAccess value that specifies the operations that can be performed on the file.</param> /// <param name="share">A FileShare value specifying the type of access other threads have to the file. </param> /// <returns>A FileStream on the specified path, having the specified mode with read, write, or read/write access and the specified sharing option.</returns> public static FileStream Open(string path, FileMode mode, FileAccessEx access, FileShare share) { return File.Open(path, mode, (System.IO.FileAccess) access, (System.IO.FileShare) share); }