FileUnit.cs 586 B

12345678910111213141516171819202122
  1. using System.IO;
  2. using Utilty.Unit.Directory;
  3. namespace Utilty.Unit.File
  4. {
  5. public class FileUnit
  6. {
  7. public static FileStream CheckCreate(string filePath)
  8. {
  9. string directoryPath= System.IO.Path.GetDirectoryName(filePath);
  10. DirectoryUnit.CheckCreate(directoryPath);
  11. return System.IO.File.Create(filePath);
  12. }
  13. public static void CheckDelete(string filePath)
  14. {
  15. if (System.IO.File.Exists(filePath))
  16. System.IO.File.Delete(filePath);
  17. }
  18. }
  19. }