using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; using System.Linq; namespace Breda_Tour.Data { class RouteDatabase { public List Routes; public RouteDatabase() { Routes = new List(); readRoutes(); } private void readRoutes() { string json = File.ReadAllText("Storage/Routes/routes.json"); JObject JsonObject = JObject.Parse(json); IList JsonList = JsonObject["Routes"].ToList(); foreach (JToken route in JsonList) { Routes.Add(JsonConvert.DeserializeObject(route.ToString())); } } public ObservableCollection GetCurrentRoutes() { ObservableCollection routes = new ObservableCollection(); foreach (var route in Routes) { if (route.Language == App.Language) routes.Add(route); } return routes; } } }