IIOService.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. using System.IO;
  3. namespace BestHTTP.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. Open,
  18. /// <summary>
  19. /// Open an existing file for writing to the end.
  20. /// </summary>
  21. Append
  22. }
  23. public interface IIOService
  24. {
  25. /// <summary>
  26. /// Create a directory for the given path.
  27. /// </summary>
  28. void DirectoryCreate(string path);
  29. /// <summary>
  30. /// Return true if the directory exists for the given path.
  31. /// </summary>
  32. /// <param name="path"></param>
  33. /// <returns></returns>
  34. bool DirectoryExists(string path);
  35. /// <summary>
  36. /// Return with the file names for the given path.
  37. /// </summary>
  38. /// <param name="path"></param>
  39. /// <returns></returns>
  40. string[] GetFiles(string path);
  41. /// <summary>
  42. /// Delete the file for the given path.
  43. /// </summary>
  44. void FileDelete(string path);
  45. /// <summary>
  46. /// Return true if the file exists on the given path.
  47. /// </summary>
  48. bool FileExists(string path);
  49. /// <summary>
  50. /// Create a stream that can read and/or write a file on the given path.
  51. /// </summary>
  52. Stream CreateFileStream(string path, FileStreamModes mode);
  53. }
  54. }