DebugHelper.cs 959 B

123456789101112131415161718192021222324252627
  1. using Newtonsoft.Json.Linq;
  2. using System;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows.Forms;
  6. namespace Optimizer {
  7. // Collection of useful debugging methods and utilities
  8. internal sealed class DebugHelper {
  9. // For comparing and detecting missing keys between two translation JSON files
  10. internal static void FindDifferenceInTwoJsons() {
  11. JObject file1 = JObject.Parse(Properties.Resources.EN);
  12. JObject file2 = JObject.Parse(Properties.Resources.RU);
  13. var p1 = file1.Properties().ToList();
  14. var p2 = file2.Properties().ToList();
  15. var missingProps = p1.Where(expected => !p2.Where(actual => actual.Name == expected.Name).Any());
  16. StringBuilder sb = new StringBuilder();
  17. foreach (var x in missingProps) {
  18. sb.Append(x.Name + Environment.NewLine);
  19. }
  20. MessageBox.Show(sb.ToString());
  21. }
  22. }
  23. }