public static void Wipe(Func <IDataSource> sourceFactory, string destinationPath, IProgress <int> progress, CancellationToken cancelToken) { using (var fileHandle = FileOpener.OpenPath(destinationPath, FileMode.Open, FileAccess.ReadWrite, FileShare.None)) using (var fileStream = new FileStream(fileHandle, FileAccess.ReadWrite)) { Wipe(sourceFactory, fileStream, progress, cancelToken); } }
static SafeFileHandle OpenDevice(string path) { return(FileOpener.OpenPath(path.TrimEnd('\\'), FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite)); }