12345678910111213141516171819202122232425 |
- using Newtonsoft.Json.Linq;
- using System.Text;
- namespace HTEX.Complex.Service
- {
- 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);
- }
- }
- }
|