using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TEAMModelOS.SDK.DI { public class Region2LongitudeLatitudeTranslator { public readonly JArray regionJson; public Region2LongitudeLatitudeTranslator(string configPath) { if (configPath == null) throw new ArgumentNullException(nameof(configPath)); StreamReader streamReader = new StreamReader(new FileStream(Path.Combine(configPath , "latlng.json"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite), Encoding.UTF8); StringBuilder stringBuilder = new StringBuilder(); string text; while ((text = streamReader.ReadLine()) != null) { stringBuilder.Append(text.ToString()); } streamReader.Close(); string input = stringBuilder.ToString(); regionJson= JArray.Parse(input); } } }