Program.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace VersionTool
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. // args= new string[] { "-f","C:\\Codes\\NewServer\\WingCloudServer", "-v","1.0.0.1"};
  14. var argstr = string.Empty;
  15. foreach (var item in args)
  16. {
  17. argstr += item + " ";
  18. }
  19. Console.WriteLine("VersionTool starting ... args:" + argstr);
  20. var folder = string.Empty;
  21. var version = string.Empty;
  22. if (args.Contains("-f"))
  23. {
  24. var folderFlagIndex = Array.IndexOf(args, "-f");
  25. var folderIndex = folderFlagIndex + 1;
  26. if (folderIndex < args.Length)
  27. {
  28. folder = args[folderIndex];
  29. }
  30. }
  31. if (args.Contains("-v"))
  32. {
  33. var versionFlagIndex = Array.IndexOf(args, "-v");
  34. var versionIndex = versionFlagIndex + 1;
  35. if (versionIndex < args.Length)
  36. {
  37. version = args[versionIndex];
  38. }
  39. }
  40. Console.WriteLine("VersionTool folder:" + folder);
  41. Console.WriteLine("VersionTool version:" + version);
  42. if (!string.IsNullOrEmpty(folder) && !string.IsNullOrEmpty(version))
  43. {
  44. if (Directory.Exists(folder) && Version.TryParse(version, out _))
  45. {
  46. AssemblyUpdater.UpdateVersion(folder, version);
  47. Console.WriteLine("VersionTool versions updated.");
  48. }
  49. }
  50. Console.WriteLine("VersionTool end.");
  51. }
  52. }
  53. }