IIOService.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. 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. public interface IIOService
  28. {
  29. /// <summary>
  30. /// Create a directory for the given path.
  31. /// </summary>
  32. void DirectoryCreate(string path);
  33. /// <summary>
  34. /// Return true if the directory exists for the given path.
  35. /// </summary>
  36. /// <param name="path"></param>
  37. /// <returns></returns>
  38. bool DirectoryExists(string path);
  39. /// <summary>
  40. /// Return with the file names for the given path.
  41. /// </summary>
  42. /// <param name="path"></param>
  43. /// <returns></returns>
  44. string[] GetFiles(string path);
  45. /// <summary>
  46. /// Delete the file for the given path.
  47. /// </summary>
  48. void FileDelete(string path);
  49. /// <summary>
  50. /// Return true if the file exists on the given path.
  51. /// </summary>
  52. bool FileExists(string path);
  53. /// <summary>
  54. /// Create a stream that can read and/or write a file on the given path.
  55. /// </summary>
  56. Stream CreateFileStream(string path, FileStreamModes mode);
  57. }
  58. }