Guest User

Untitled

a guest
Feb 17th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. var riches = JObject.Parse(File.ReadAllText("riches.json"));
  2. int all = 0;
  3. int remaining = 0;
  4. string foundSystem = string.Empty;
  5. foreach (var sys in riches["result"])
  6. {
  7. all++;
  8. if (sys["visited"] != null && (bool)sys["visited"] == true)
  9. {
  10. continue;
  11. }
  12. else if (foundSystem == string.Empty)
  13. {
  14. sys["visited"] = true;
  15. foundSystem = (string)sys["name"];
  16. }
  17. remaining++;
  18. }
  19.  
  20. // VA.SetInt("TotalSystems", all);
  21. // VA.SetInt("RemainingSystems", remaining);
  22. // VA.SetText("NextSystem", foundSystem);
  23. Console.WriteLine("TotalSystems: " + all);
  24. Console.WriteLine("RemainingSystems: " + remaining);
  25. Console.WriteLine("NextSystem: " + foundSystem);
  26.  
  27. File.WriteAllText("riches.json", riches.ToString());
Add Comment
Please, Sign In to add comment