CacheFilePath.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace PDF_Office.Helper
  7. {
  8. public class CacheFilePath
  9. {
  10. private static readonly CacheFilePath instance = new CacheFilePath();
  11. private CacheFilePath()
  12. {
  13. }
  14. public static CacheFilePath Instance => instance;
  15. public string CustomStampPath
  16. {
  17. get
  18. {
  19. try
  20. {
  21. string Path = System.IO.Path.Combine(App.CurrentPath, "CustomStamp");
  22. System.IO.DirectoryInfo directoryInfo = System.IO.Directory.CreateDirectory(Path);
  23. if (directoryInfo.Exists
  24. &&(directoryInfo.Attributes & System.IO.FileAttributes.ReadOnly) != System.IO.FileAttributes.ReadOnly
  25. &&(directoryInfo.Attributes & System.IO.FileAttributes.Hidden) != System.IO.FileAttributes.Hidden
  26. )
  27. {
  28. return Path;
  29. }
  30. else
  31. {
  32. return "";
  33. }
  34. }
  35. catch (Exception)
  36. {
  37. return "";
  38. }
  39. }
  40. }
  41. }
  42. }