|
@@ -14,55 +14,55 @@ public class AddressLookupStore : Store<AddressLookup>
|
|
|
{
|
|
|
base.Init();
|
|
|
|
|
|
- // Load the cache file into memory
|
|
|
- string cachefile = Path.Combine(CoreUtils.GetPath(), "GNAF_CORE.psv");
|
|
|
- if (File.Exists(cachefile))
|
|
|
- {
|
|
|
- DateTime start = DateTime.Now;
|
|
|
- Logger.Send(LogType.Information,"",$"Loading Address Lookup File: {cachefile}");
|
|
|
- using (StreamReader sr = new(cachefile))
|
|
|
- {
|
|
|
- var headers = sr.ReadLine().Split('|').ToList();
|
|
|
- int streetfield = headers.IndexOf("ADDRESS_LABEL");
|
|
|
- int statefield = headers.IndexOf("STATE");
|
|
|
- int latfield = headers.IndexOf("LATITUDE");
|
|
|
- int lngfield = headers.IndexOf("LONGITUDE");
|
|
|
- while (!sr.EndOfStream)
|
|
|
- {
|
|
|
- var line = sr.ReadLine().Split('|').ToArray();
|
|
|
- if (string.Equals(line[statefield], "WA"))
|
|
|
- {
|
|
|
- _cache.Add(new AddressLookup()
|
|
|
- {
|
|
|
- Address = line[streetfield],
|
|
|
- Latitude = double.Parse(line[latfield]),
|
|
|
- Longitude = double.Parse(line[lngfield])
|
|
|
- });
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- Logger.Send(LogType.Information,"",$"Found {_cache.Count} addresses in {(DateTime.Now - start):g}");
|
|
|
- }
|
|
|
- else
|
|
|
- Logger.Send(LogType.Information,"",$"Address Lookup File: {cachefile} not found!");
|
|
|
+ // // Load the cache file into memory
|
|
|
+ // string cachefile = Path.Combine(CoreUtils.GetPath(), "GNAF_CORE.psv");
|
|
|
+ // if (File.Exists(cachefile))
|
|
|
+ // {
|
|
|
+ // DateTime start = DateTime.Now;
|
|
|
+ // Logger.Send(LogType.Information,"",$"Loading Address Lookup File: {cachefile}");
|
|
|
+ // using (StreamReader sr = new(cachefile))
|
|
|
+ // {
|
|
|
+ // var headers = sr.ReadLine().Split('|').ToList();
|
|
|
+ // int streetfield = headers.IndexOf("ADDRESS_LABEL");
|
|
|
+ // int statefield = headers.IndexOf("STATE");
|
|
|
+ // int latfield = headers.IndexOf("LATITUDE");
|
|
|
+ // int lngfield = headers.IndexOf("LONGITUDE");
|
|
|
+ // while (!sr.EndOfStream)
|
|
|
+ // {
|
|
|
+ // var line = sr.ReadLine().Split('|').ToArray();
|
|
|
+ // if (string.Equals(line[statefield], "WA"))
|
|
|
+ // {
|
|
|
+ // _cache.Add(new AddressLookup()
|
|
|
+ // {
|
|
|
+ // Address = line[streetfield],
|
|
|
+ // Latitude = double.Parse(line[latfield]),
|
|
|
+ // Longitude = double.Parse(line[lngfield])
|
|
|
+ // });
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // Logger.Send(LogType.Information,"",$"Found {_cache.Count} addresses in {(DateTime.Now - start):g}");
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // Logger.Send(LogType.Information,"",$"Address Lookup File: {cachefile} not found!");
|
|
|
}
|
|
|
|
|
|
- protected override CoreTable OnQuery(Filter<AddressLookup>? filter, Columns<AddressLookup>? columns, SortOrder<AddressLookup>? sort, CoreRange? range)
|
|
|
- {
|
|
|
- _queryProviderFactory ??= this.GetQueryProviderFactory();
|
|
|
- var result = new CoreTable();
|
|
|
- var cols = columns ?? Columns.All<AddressLookup>();
|
|
|
- result.Columns.AddRange(cols.Select(x => new CoreColumn(x.Property)));
|
|
|
- foreach (var lookup in _cache)
|
|
|
- {
|
|
|
- if (filter == null || filter.Match(lookup, _queryProviderFactory))
|
|
|
- {
|
|
|
- var row = result.NewRow();
|
|
|
- result.LoadRow(lookup);
|
|
|
- result.Rows.Add(row);
|
|
|
- }
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
+ // protected override CoreTable OnQuery(Filter<AddressLookup>? filter, Columns<AddressLookup>? columns, SortOrder<AddressLookup>? sort, CoreRange? range)
|
|
|
+ // {
|
|
|
+ // _queryProviderFactory ??= this.GetQueryProviderFactory();
|
|
|
+ // var result = new CoreTable();
|
|
|
+ // var cols = columns ?? Columns.All<AddressLookup>();
|
|
|
+ // result.Columns.AddRange(cols.Select(x => new CoreColumn(x.Property)));
|
|
|
+ // foreach (var lookup in _cache)
|
|
|
+ // {
|
|
|
+ // if (filter == null || filter.Match(lookup, _queryProviderFactory))
|
|
|
+ // {
|
|
|
+ // var row = result.NewRow();
|
|
|
+ // result.LoadRow(lookup);
|
|
|
+ // result.Rows.Add(row);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // return result;
|
|
|
+ // }
|
|
|
}
|