IIOService.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using System;
  2. using System.IO;
  3. namespace Best.HTTP.Shared.PlatformSupport.FileSystem
  4. {
  5. /// <summary>
  6. /// These are the different modes that the plugin want's to use a filestream.
  7. /// </summary>
  8. public enum FileStreamModes
  9. {
  10. /// <summary>
  11. /// Create a new file.
  12. /// </summary>
  13. Create,
  14. /// <summary>
  15. /// Open an existing file for reading.
  16. /// </summary>
  17. OpenRead,
  18. /// <summary>
  19. /// Open or create a file for read and write.
  20. /// </summary>
  21. OpenReadWrite,
  22. /// <summary>
  23. /// Open an existing file for writing to the end.
  24. /// </summary>
  25. Append
  26. }
  27. /// <summary>
  28. /// Interface for file-system abstraction.
  29. /// </summary>
  30. public interface IIOService
  31. {
  32. /// <summary>
  33. /// Create a directory for the given path.
  34. /// </summary>
  35. void DirectoryCreate(string path);
  36. /// <summary>
  37. /// Return true if the directory exists for the given path.
  38. /// </summary>
  39. bool DirectoryExists(string path);
  40. /// <summary>
  41. /// Delete the directory.
  42. /// </summary>
  43. void DirectoryDelete(string path);
  44. /// <summary>
  45. /// Return with the file names for the given path.
  46. /// </summary>
  47. /// <param name="path"></param>
  48. /// <returns></returns>
  49. string[] GetFiles(string path);
  50. /// <summary>
  51. /// Delete the file for the given path.
  52. /// </summary>
  53. void FileDelete(string path);
  54. /// <summary>
  55. /// Return true if the file exists on the given path.
  56. /// </summary>
  57. bool FileExists(string path);
  58. /// <summary>
  59. /// Create a stream that can read and/or write a file on the given path.
  60. /// </summary>
  61. Stream CreateFileStream(string path, FileStreamModes mode);
  62. }
  63. }