Program.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using CommandLine;
  2. using Newtonsoft.Json;
  3. using System.Data;
  4. using System.Text;
  5. namespace etoy
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. Console.ForegroundColor = ConsoleColor.White;
  12. Console.WriteLine("*********************************");
  13. Console.WriteLine(" 欢迎来到EToy配置表工具");
  14. Console.WriteLine("*********************************");
  15. Console.WriteLine();
  16. Console.WriteLine($"Path:{System.Environment.CurrentDirectory}");
  17. Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
  18. //Parser.Default.ParseArguments<Option>(args).WithParsed(option =>
  19. //{
  20. // var blackboard = new Blackboard();
  21. // var context = new Context(option, blackboard);
  22. // var commands = CommandGroupFactory.Create(context);
  23. // var pileLine = new ConfigurePileline(commands);
  24. // pileLine.Run();
  25. //});
  26. //Console.ReadLine();
  27. var option = ReadOption();
  28. var blackboard = new Blackboard();
  29. var context = new Context(option, blackboard);
  30. var commands = CommandGroupFactory.Create(context);
  31. var pileLine = new ConfigurePileline(commands);
  32. pileLine.Run();
  33. }
  34. private static Option ReadOption()
  35. {
  36. var path = Path.Combine(System.Environment.CurrentDirectory, "Configs/Option.json");
  37. var text = File.ReadAllText(path);
  38. Console.WriteLine($"Option Path:{path}");
  39. Console.WriteLine($"Option Text:{text}");
  40. var option = JsonConvert.DeserializeObject<Option>(text);
  41. return option;
  42. }
  43. }
  44. }