Пример #1
0
        public Stream Open(string file, OpenMode mode)
        {
            var ret = _backend.Open(file, mode);

            WriteOperation?.Invoke(file);
            return(ret);
        }
Пример #2
0
        public Stream OpenWrite(string file)
        {
            var ret = new WriteOnlyStream(_backend.Open(file, OpenMode.OpenOrCreate));

            WriteOperation?.Invoke(file); // Won't fire if the stream is written to afterwards... FIXME?
            return(ret);
        }
Пример #3
0
 /// <inheritdoc cref="WriteAllBytes(string, byte[])"/>
 public async Task WriteAllBytesAsync(string path, byte[] bytes)
 {
     await Task.Run(() =>
     {
         _backend.WriteAllBytes(path, bytes);
         WriteOperation?.Invoke(path);
     });
 }
Пример #4
0
 /// <inheritdoc cref="CreateDirectory(string)"/>
 public async Task CreateDirectoryAsync(string path)
 {
     await Task.Run(() =>
     {
         _backend.CreateDirectory(path);
         WriteOperation?.Invoke(path);
     });
 }
Пример #5
0
 /// <summary>
 /// Delete a file or directory from the VFS
 /// </summary>
 /// <param name="path">A path to the file or directory to delete</param>
 public void Delete(string path)
 {
     if (IsOpenInProgram(path))
     {
         throw new IOException("The process cannot access the file because it is currently opened in another process.");
     }
     _backend.Delete(path);
     WriteOperation?.Invoke(path);
 }
Пример #6
0
 /// <summary>
 /// Write binary data to a file
 /// </summary>
 /// <param name="path">The path to a file to write to</param>
 /// <param name="data">The binary data to write</param>
 public void WriteAllBytes(string path, byte[] data)
 {
     if (data == null)
     {
         data = new byte[0];
     }
     _backend.WriteAllBytes(path, data);
     WriteOperation?.Invoke(path);
 }
Пример #7
0
 /// <inheritdoc cref="Delete(string)"/>
 public async Task DeleteAsync(string path)
 {
     if (IsOpenInProgram(path))
     {
         throw new IOException("The process cannot access the file because it is currently opened in another process.");
     }
     await Task.Run(() =>
     {
         _backend.Delete(path);
         WriteOperation?.Invoke(path);
     });
 }
Пример #8
0
 /// <summary>
 /// Create a directory.
 /// </summary>
 /// <param name="path">The path for the new directory.</param>
 public void CreateDirectory(string path)
 {
     _backend.CreateDirectory(path);
     WriteOperation?.Invoke(path);
 }