@@ -12,15 +12,13 @@ public class DataExtractor
12
12
{
13
13
private readonly string _cldrPath ;
14
14
private readonly string _nzdPath ;
15
- private readonly string _tzresPath ;
16
15
17
16
private readonly TimeZoneData _data = new ( ) ;
18
17
19
18
private DataExtractor ( string dataPath )
20
19
{
21
20
_cldrPath = Path . Combine ( dataPath , "cldr" ) ;
22
21
_nzdPath = Path . Combine ( dataPath , "nzd" ) ;
23
- _tzresPath = Path . Combine ( dataPath , "tzres" ) ;
24
22
}
25
23
26
24
public static DataExtractor Load ( string dataPath , bool overwrite )
@@ -75,8 +73,7 @@ private void DownloadData(bool overwrite)
75
73
{
76
74
Task . WaitAll (
77
75
DownloadCldrAsync ( overwrite ) ,
78
- DownloadNzdAsync ( overwrite ) ,
79
- DownloadTZResAsync ( overwrite ) ) ;
76
+ DownloadNzdAsync ( overwrite ) ) ;
80
77
}
81
78
82
79
private async Task DownloadCldrAsync ( bool overwrite )
@@ -107,20 +104,6 @@ private async Task DownloadNzdAsync(bool overwrite)
107
104
}
108
105
}
109
106
110
- private async Task DownloadTZResAsync ( bool overwrite )
111
- {
112
- var exists = Directory . Exists ( _tzresPath ) ;
113
- if ( overwrite || ! exists )
114
- {
115
- if ( exists )
116
- {
117
- Directory . Delete ( _tzresPath , true ) ;
118
- }
119
-
120
- await Downloader . DownloadTZResAsync ( _tzresPath ) ;
121
- }
122
- }
123
-
124
107
private void LoadZoneCountries ( )
125
108
{
126
109
foreach ( var location in _tzdbSource . ZoneLocations ! . OrderBy ( x => GetStandardOffset ( x . ZoneId ) ) . ThenBy ( x => GetDaylightOffset ( x . ZoneId ) ) )
@@ -237,7 +220,13 @@ private IList<string> GetSelectionZones(Instant fromInstant, string[] precedence
237
220
}
238
221
239
222
// use the zone-precedence.txt file when we need a tiebreaker
240
- return precedence . Intersect ( ids ) . First ( ) ;
223
+ var s = precedence . Intersect ( ids ) . FirstOrDefault ( ) ;
224
+ if ( s != null )
225
+ {
226
+ return s ;
227
+ } else {
228
+ throw new InvalidOperationException ( "No tiebreaker found for " + string . Join ( ", " , ids ) ) ;
229
+ }
241
230
} )
242
231
. ToList ( ) ;
243
232
@@ -510,7 +499,7 @@ private static TimeZoneValues GetTimeZoneValues(XContainer element)
510
499
511
500
private void LoadDisplayNames ( )
512
501
{
513
- using var stream = File . OpenRead ( Path . Combine ( _tzresPath , "tzinfo .json" ) ) ;
502
+ using var stream = File . OpenRead ( Path . Combine ( "data" , "windows-displaynames .json" ) ) ;
514
503
var data = JsonNode . Parse ( stream ) ! ;
515
504
var languages = data [ "Languages" ] ;
516
505
if ( languages == null )
@@ -607,4 +596,4 @@ private IList<Instant> GetAllZoneSplitPoints()
607
596
608
597
return list ;
609
598
}
610
- }
599
+ }
0 commit comments