1
0

Program.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.IO;
  3. public class Program
  4. {
  5. static int Main(string[] args)
  6. {
  7. Console.WriteLine("SoftEther VPN Project");
  8. Console.WriteLine("STB File Multilanguage Full-Mesh Consistency Checker");
  9. Console.WriteLine("");
  10. if (args.Length != 1)
  11. {
  12. Console.WriteLine("Usage: dotnet run [hamcore_dir]");
  13. return -1;
  14. }
  15. else
  16. {
  17. string hamcore_dir = args[0];
  18. string[] stb_files = Directory.GetFiles(hamcore_dir, "*.stb", SearchOption.TopDirectoryOnly);
  19. if (stb_files.Length == 0)
  20. {
  21. Console.WriteLine("Error: There are no .stb files in the directory '" + hamcore_dir + "'.");
  22. return -1;
  23. }
  24. int total_num = 0;
  25. for (int i = 0; i < stb_files.Length; i++)
  26. {
  27. for (int j = 0; j < stb_files.Length; j++)
  28. {
  29. if (i != j)
  30. {
  31. Console.WriteLine("---\nComparing '{1}' to '{0}'...", Path.GetFileName(stb_files[i]), Path.GetFileName(stb_files[j]));
  32. total_num += Stb.Compare(stb_files[i], stb_files[j]);
  33. }
  34. }
  35. }
  36. Console.WriteLine("--- Results ---");
  37. if (total_num == 0)
  38. {
  39. Console.WriteLine("OK: Excellent! There are no errors between multilanguage stb files.");
  40. Console.WriteLine();
  41. Console.WriteLine(" - In Jurassic Park: \"It's a UNIX system! I know this!\"");
  42. return 0;
  43. }
  44. else
  45. {
  46. Console.WriteLine($"ERROR: There are {total_num} errors on multilanguage stb files. Please kindly correct them before submitting us Pull Requests.");
  47. return -3;
  48. }
  49. }
  50. }
  51. }