/// <summary> /// Opens the stream with specified mode, access, and sharing mode. /// </summary> /// <param name="mode">Mode to open this stream with.</param> /// <param name="access">Access mode for the opened stream.</param> /// <param name="share">Sharing mode for the stream.</param> /// <returns><see cref="FileStream"/> instance to use for IO operations.</returns> public FileStream Open(FileMode mode, FileAccess access, FileShare share) => InteropWrapper.Open(this, mode, access, share);
/// <summary> /// Creates a new alternate data stream within specified file. If a stream with this name exists, an exception is thrown. /// </summary> /// <param name="file">File to create the data stream for.</param> /// <param name="name">Name of the data stream to create.</param> /// <returns><see cref="FileStream"/> instance for IO operations.</returns> public static FileStream CreateDataStream(this FileInfo file, string name) => InteropWrapper.Open(new FileDataStream(file, name, 0, FileDataStreamType.Data), FileMode.CreateNew, FileAccess.Write, FileShare.None);
/// <summary> /// Deletes the specified stream. /// </summary> public void Delete() => InteropWrapper.Delete(this);
/// <summary> /// Enumerates all data streams contained within specified file. /// </summary> /// <param name="file">File to query data streams for.</param> /// <returns>An enumerator over data streams contained within the file.</returns> public static IEnumerable <FileDataStream> EnumerateDataStreams(this FileInfo file) => InteropWrapper.EnumerateDataStreams(file);