华恒Mes鼎捷代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.0 KiB

5 months ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Windows.Forms;
  5. using System.IO;
  6. namespace ICSSoft.AutoUpdate.Edition.DownLoad
  7. {
  8. static class Program
  9. {
  10. public static System.Threading.Mutex Run;
  11. /// <summary>
  12. /// 应用程序的主入口点。
  13. /// </summary>
  14. [STAThread]
  15. static void Main()
  16. {
  17. bool noRun = false;
  18. Run = new System.Threading.Mutex(true, Application.ProductName, out noRun);
  19. //if (!noRun)
  20. {
  21. MessageBox.Show("本程序已经启动,无法再次启动");
  22. }
  23. Application.EnableVisualStyles();
  24. Application.SetCompatibleTextRenderingDefault(false);
  25. Run.ReleaseMutex();
  26. string WebUrl = "";
  27. DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在加载更新文件中...请稍等....");
  28. _wait.Show();
  29. if (!Directory.Exists(Application.StartupPath + "\\BaseServiceConfig"))
  30. {
  31. Directory.CreateDirectory(Application.StartupPath + "\\BaseServiceConfig");
  32. }
  33. if (!File.Exists(Application.StartupPath + "\\BaseServiceConfig\\baseserviceurl.ini"))
  34. {
  35. using (File.Create(Application.StartupPath + "\\BaseServiceConfig\\baseserviceurl.ini"))
  36. {
  37. }
  38. }
  39. using (StreamReader sr = new StreamReader(Application.StartupPath + "\\BaseServiceConfig\\baseserviceurl.ini"))
  40. {
  41. while (sr.Peek() > -1)
  42. {
  43. string value = sr.ReadLine();
  44. if (!string.IsNullOrEmpty(value))
  45. {
  46. WebUrl = value;
  47. }
  48. }
  49. }
  50. _wait.Close();
  51. if (WebUrl.Trim() != "")
  52. {
  53. Application.Run(new FormAutoUpdate(WebUrl));
  54. }
  55. }
  56. }
  57. }