Program.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using FlutterCodeGenerator.Helper;
  2. using System;
  3. using System.IO;
  4. namespace FlutterCodeGenerator
  5. {
  6. internal class Program
  7. {
  8. private static void Main(string[] args)
  9. {
  10. try
  11. {
  12. var generatedFolderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "GeneratedCode");
  13. var dllPath = AppDomain.CurrentDomain.BaseDirectory;
  14. if (args.Length == 2)
  15. {
  16. dllPath = args[0];
  17. generatedFolderPath = args[1];
  18. }
  19. if (string.IsNullOrWhiteSpace(dllPath) || string.IsNullOrWhiteSpace(generatedFolderPath))
  20. {
  21. throw new ArgumentException("The argments are invalid!");
  22. }
  23. var codeGenerator = new CodeGenerator(dllPath, generatedFolderPath);
  24. codeGenerator.GeneratedCode();
  25. Console.WriteLine($"The code has already generated! The path is {generatedFolderPath}");
  26. }
  27. catch (Exception ex)
  28. {
  29. Console.WriteLine($"An Error occured when generated!!! Error Message : {ex}");
  30. }
  31. Console.ReadLine();
  32. }
  33. }
  34. }