Skip to content

Commit b91b02a

Browse files
Updates (#112)
1 parent 5c533d2 commit b91b02a

File tree

623 files changed

+277274
-47460
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

623 files changed

+277274
-47460
lines changed

.github/workflows/build.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@ jobs:
1717

1818
steps:
1919
- name: Checkout
20-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
21+
22+
- name: Install .NET SDKs
23+
uses: actions/setup-dotnet@v4
24+
with:
25+
dotnet-version: |
26+
6.0.x
27+
8.0.x
28+
9.0.x
2129
2230
- name: Restore
2331
run: dotnet restore --nologo

.github/workflows/pack-for-release.yaml renamed to .github/workflows/release.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,15 @@ jobs:
1313

1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
17+
18+
- name: Install .NET SDKs
19+
uses: actions/setup-dotnet@v4
20+
with:
21+
dotnet-version: |
22+
6.0.x
23+
8.0.x
24+
9.0.x
1725
1826
- name: Restore
1927
run: dotnet restore --nologo
@@ -30,8 +38,11 @@ jobs:
3038
- name: Pack
3139
run: dotnet pack -c Release --nologo --no-build
3240

41+
- name: Push to NuGet
42+
run: dotnet nuget push -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} **/*.nupkg
43+
3344
- name: Archive Artifacts
34-
uses: actions/upload-artifact@v3
45+
uses: actions/upload-artifact@v4
3546
with:
3647
name: nuget-packages
3748
path: src/**/Release/*.*nupkg

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Roslynator.Analyzers" Version="4.2.0" PrivateAssets="All" />
14+
<PackageReference Include="Roslynator.Analyzers" Version="4.12.10" PrivateAssets="All" />
1515
<PackageReference Include="Nullable" Version="1.3.1" PrivateAssets="All" />
1616
</ItemGroup>
1717

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Nuget Installation
1515
PM> Install-Package TimeZoneNames
1616
```
1717

18-
As of version 6.0.0, *TimeZoneConverter* works with all of the following:
18+
As of version 7.0.0, *TimeZoneConverter* works with all of the following:
1919

20-
- .NET 5 or greater
20+
- .NET 6 or greater
2121
- .NET Core 2.0 or greater
2222
- .NET Framework 4.6.2 and greater
2323

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "6.0.100",
3+
"version": "9.0.100",
44
"rollForward": "latestMinor"
55
}
66
}

src/TimeZoneNames.DataBuilder/DataExtractor.cs

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ public class DataExtractor
1212
{
1313
private readonly string _cldrPath;
1414
private readonly string _nzdPath;
15-
private readonly string _tzresPath;
1615

1716
private readonly TimeZoneData _data = new();
1817

1918
private DataExtractor(string dataPath)
2019
{
2120
_cldrPath = Path.Combine(dataPath, "cldr");
2221
_nzdPath = Path.Combine(dataPath, "nzd");
23-
_tzresPath = Path.Combine(dataPath, "tzres");
2422
}
2523

2624
public static DataExtractor Load(string dataPath, bool overwrite)
@@ -75,8 +73,7 @@ private void DownloadData(bool overwrite)
7573
{
7674
Task.WaitAll(
7775
DownloadCldrAsync(overwrite),
78-
DownloadNzdAsync(overwrite),
79-
DownloadTZResAsync(overwrite));
76+
DownloadNzdAsync(overwrite));
8077
}
8178

8279
private async Task DownloadCldrAsync(bool overwrite)
@@ -107,20 +104,6 @@ private async Task DownloadNzdAsync(bool overwrite)
107104
}
108105
}
109106

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-
124107
private void LoadZoneCountries()
125108
{
126109
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
237220
}
238221

239222
// 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+
}
241230
})
242231
.ToList();
243232

@@ -510,7 +499,7 @@ private static TimeZoneValues GetTimeZoneValues(XContainer element)
510499

511500
private void LoadDisplayNames()
512501
{
513-
using var stream = File.OpenRead(Path.Combine(_tzresPath, "tzinfo.json"));
502+
using var stream = File.OpenRead(Path.Combine("data", "windows-displaynames.json"));
514503
var data = JsonNode.Parse(stream)!;
515504
var languages = data["Languages"];
516505
if (languages == null)
@@ -607,4 +596,4 @@ private IList<Instant> GetAllZoneSplitPoints()
607596

608597
return list;
609598
}
610-
}
599+
}

src/TimeZoneNames.DataBuilder/Downloader.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ public static async Task DownloadNzdAsync(string dir)
2525
await DownloadAsync(dataUrl, dir);
2626
}
2727

28-
public static async Task DownloadTZResAsync(string dir)
29-
{
30-
const string url = "https://raw.githubusercontent.com/tomkludy/TimeZoneWindowsResourceExtractor/master/TZResScraper/tzinfo.json";
31-
await DownloadAsync(url, dir);
32-
}
33-
3428
private static async Task DownloadAsync(string url, string dir)
3529
{
3630
if (!Directory.Exists(dir))
@@ -61,7 +55,7 @@ private static async Task DownloadAndExtractAsync(string url, string dir)
6155
continue;
6256
}
6357

64-
var subPath = entry.Key;
58+
var subPath = entry.Key!;
6559
if (Path.DirectorySeparatorChar != '/')
6660
{
6761
subPath = subPath.Replace('/', Path.DirectorySeparatorChar);
@@ -84,4 +78,4 @@ private static async Task DownloadAndExtractAsync(string url, string dir)
8478
await stream.CopyToAsync(fs);
8579
}
8680
}
87-
}
81+
}

src/TimeZoneNames.DataBuilder/TimeZoneNames.DataBuilder.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<OutputType>Exe</OutputType>
66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
@@ -19,8 +19,8 @@
1919
</ItemGroup>
2020

2121
<ItemGroup>
22-
<PackageReference Include="NodaTime" Version="3.1.5" />
23-
<PackageReference Include="SharpCompress" Version="0.32.2" />
22+
<PackageReference Include="NodaTime" Version="3.2.1" />
23+
<PackageReference Include="SharpCompress" Version="0.39.0" />
2424
</ItemGroup>
2525

2626
</Project>

0 commit comments

Comments
 (0)