Program.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace Muchinfo.Client.Update.UpdateListFactory
  9. {
  10. internal class Program
  11. {
  12. private static void Main(string[] args)
  13. {
  14. try
  15. {
  16. string basePath = AppDomain.CurrentDomain.BaseDirectory;
  17. Console.Write("请输入主程序名称:");
  18. var info = new UpdateInfo();
  19. // info.StartAppName = "Muchinfo.ClientTerminal.exe";
  20. var tempStr = Console.ReadLine();
  21. info.StartAppName = tempStr;
  22. Console.Write("请输资源文件夹:");
  23. tempStr = Console.ReadLine();
  24. info.ResourceDir = tempStr;
  25. Console.Write("是否使用压缩文件升级 “Y/N”:");
  26. string code = Console.ReadLine();
  27. info.LastModifyTime = DateTime.Now;
  28. info.ReStart = true;
  29. if (code != null && "Y".Equals(code.ToUpper()))
  30. {
  31. info.IsCompress = true;
  32. }
  33. FilesHelper.SearchfileCompress(info, basePath);
  34. var fileVer = FileVersionInfo.GetVersionInfo(Path.Combine(basePath, info.StartAppName));
  35. info.Version = fileVer.FileVersion;
  36. FilesHelper.SaveUpdateXml(info, AppDomain.CurrentDomain.BaseDirectory + info.GetType().Name + ".xml");
  37. }
  38. catch (Exception ex)
  39. {
  40. Console.WriteLine(ex.ToString());
  41. }
  42. Console.WriteLine("操作完成!");
  43. Console.ReadLine();
  44. }
  45. }
  46. }