Skip to content

Commit e09d09e

Browse files
Drop older targets and update dependencies
1 parent ce55725 commit e09d09e

File tree

7 files changed

+30
-90
lines changed

7 files changed

+30
-90
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<OutputType>Exe</OutputType>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="SharpCompress" Version="0.29.0" />
9+
<PackageReference Include="SharpCompress" Version="0.30.1" />
1010
</ItemGroup>
1111

1212
</Project>

src/TimeZoneConverter.Posix/TimeZoneConverter.Posix.csproj

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,23 @@
33
<PropertyGroup>
44
<Description>Generates a POSIX time zone string from standard time zone identifiers.</Description>
55
<Authors>Matt Johnson-Pint</Authors>
6-
<TargetFrameworks>netstandard2.0;netstandard1.3;net471;net461;net45</TargetFrameworks>
6+
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
77
<PackageId>TimeZoneConverter.Posix</PackageId>
88
<PackageTags>timezone;time;zone;time zone;iana;tzdb;olson;timezoneinfo,posix</PackageTags>
9-
<PackageProjectUrl>https://github.com/mj1856/TimeZoneConverter</PackageProjectUrl>
9+
<PackageProjectUrl>https://github.com/mattjohnsonpint/TimeZoneConverter</PackageProjectUrl>
1010
<PackageLicenseExpression>MIT</PackageLicenseExpression>
11-
<IncludeSource>True</IncludeSource>
12-
<IncludeSymbols>True</IncludeSymbols>
13-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
14-
<Version>2.3.0</Version>
15-
</PropertyGroup>
16-
17-
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
18-
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
11+
<Version>3.0.0</Version>
1912
</PropertyGroup>
2013

2114
<PropertyGroup>
22-
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\TimeZoneConverter.Posix.xml</DocumentationFile>
15+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
2316
<SignAssembly>true</SignAssembly>
2417
<AssemblyOriginatorKeyFile>mj1856_oss.snk</AssemblyOriginatorKeyFile>
2518
</PropertyGroup>
2619

2720
<ItemGroup>
28-
<PackageReference Include="TimeZoneConverter" Version="3.5.0" />
29-
</ItemGroup>
30-
31-
<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
32-
<PackageReference Include="NodaTime" Version="3.0.5" />
33-
</ItemGroup>
34-
35-
<ItemGroup Condition="'$(TargetFramework)'!='netstandard2.0'">
36-
<PackageReference Include="NodaTime" Version="2.4.13" />
21+
<PackageReference Include="NodaTime" Version="3.0.9" />
22+
<PackageReference Include="TimeZoneConverter" Version="4.0.0" />
3723
</ItemGroup>
3824

3925
</Project>

src/TimeZoneConverter/DataLoader.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,7 @@ public static void Populate(IDictionary<string, string> ianaMap, IDictionary<str
136136

137137
private static IEnumerable<string> GetEmbeddedData(string resourceName)
138138
{
139-
#if NET35 || NET40
140-
Assembly assembly = typeof(DataLoader).Assembly;
141-
#else
142139
Assembly assembly = typeof(DataLoader).GetTypeInfo().Assembly;
143-
#endif
144140
using (Stream compressedStream = assembly.GetManifestResourceStream(resourceName) ?? throw new MissingManifestResourceException())
145141
using (var stream = new GZipStream(compressedStream, CompressionMode.Decompress))
146142
using (var reader = new StreamReader(stream))

src/TimeZoneConverter/TZConvert.cs

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Collections.Generic;
33
using System.Linq;
44

5-
#if NETSTANDARD2_0 || NETSTANDARD1_3
5+
#if NETSTANDARD
66
using System.Runtime.InteropServices;
77
#endif
88

@@ -18,17 +18,14 @@ public static class TZConvert
1818
private static readonly IDictionary<string, string> RailsMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
1919
private static readonly IDictionary<string, IList<string>> InverseRailsMap = new Dictionary<string, IList<string>>(StringComparer.OrdinalIgnoreCase);
2020

21-
#if NETSTANDARD2_0 || NETSTANDARD1_3
21+
#if NETSTANDARD
2222
private static readonly bool IsWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
2323
#else
2424
private const bool IsWindows = true;
2525
#endif
2626

27-
#if !NETSTANDARD1_1
2827
private static readonly Dictionary<string, TimeZoneInfo> SystemTimeZones;
2928

30-
#endif
31-
3229
static TZConvert()
3330
{
3431
DataLoader.Populate(IanaMap, WindowsMap, RailsMap, InverseRailsMap);
@@ -50,9 +47,7 @@ static TZConvert()
5047
KnownWindowsTimeZoneIds.Remove("Kamchatka Standard Time");
5148
KnownWindowsTimeZoneIds.Remove("Mid-Atlantic Standard Time");
5249

53-
#if !NETSTANDARD1_1
5450
SystemTimeZones = GetSystemTimeZones();
55-
#endif
5651
}
5752

5853
/// <summary>
@@ -144,8 +139,6 @@ public static bool TryWindowsToIana(string windowsTimeZoneId, string territoryCo
144139
return territoryCode != "001" && WindowsMap.TryGetValue($"001|{windowsTimeZoneId}", out ianaTimeZoneName);
145140
}
146141

147-
#if !NETSTANDARD1_1
148-
149142
/// <summary>
150143
/// Retrieves a <see cref="TimeZoneInfo"/> object given a valid Windows or IANA time zone identifier,
151144
/// regardless of which platform the application is running on.
@@ -157,12 +150,7 @@ public static TimeZoneInfo GetTimeZoneInfo(string windowsOrIanaTimeZoneId)
157150
if (TryGetTimeZoneInfo(windowsOrIanaTimeZoneId, out TimeZoneInfo timeZoneInfo))
158151
return timeZoneInfo;
159152

160-
#if !NETSTANDARD1_3
161153
throw new TimeZoneNotFoundException();
162-
#else
163-
// this will also throw, but we can't throw directly because TimeZoneNotFoundException is not available in .NET Standard 1.3
164-
return TimeZoneInfo.FindSystemTimeZoneById(windowsOrIanaTimeZoneId);
165-
#endif
166154
}
167155

168156
/// <summary>
@@ -189,7 +177,6 @@ public static bool TryGetTimeZoneInfo(string windowsOrIanaTimeZoneId, out TimeZo
189177
TryWindowsToIana(windowsOrIanaTimeZoneId, out tzid)) &&
190178
SystemTimeZones.TryGetValue(tzid, out timeZoneInfo);
191179
}
192-
#endif
193180

194181
/// <summary>
195182
/// Converts an IANA time zone name to one or more equivalent Rails time zone names.
@@ -328,20 +315,26 @@ public static bool TryWindowsToRails(string windowsTimeZoneId, string territoryC
328315
return false;
329316
}
330317

331-
#if !NETSTANDARD1_1
332318
private static Dictionary<string, TimeZoneInfo> GetSystemTimeZones()
333319
{
334-
#if NETSTANDARD2_0 || NETSTANDARD1_3
320+
IEnumerable<TimeZoneInfo> systemTimeZones;
321+
#if NETFRAMEWORK
322+
systemTimeZones = TimeZoneInfo.GetSystemTimeZones();
323+
#else
324+
#endif
325+
326+
#if NETSTANDARD
335327
if (IsWindows)
336-
return TimeZoneInfo.GetSystemTimeZones().ToDictionary(x => x.Id, x => x, StringComparer.OrdinalIgnoreCase);
328+
systemTimeZones = TimeZoneInfo.GetSystemTimeZones();
337329

338-
return GetSystemTimeZonesLinux().ToDictionary(x => x.Id, x => x, StringComparer.OrdinalIgnoreCase);
330+
systemTimeZones = GetSystemTimeZonesLinux();
339331
#else
340-
return TimeZoneInfo.GetSystemTimeZones().ToDictionary(x => x.Id, x => x, StringComparer.OrdinalIgnoreCase);
332+
systemTimeZones = TimeZoneInfo.GetSystemTimeZones();
341333
#endif
334+
return systemTimeZones.ToDictionary(x => x.Id, x => x, StringComparer.OrdinalIgnoreCase);
342335
}
343336

344-
#if NETSTANDARD2_0 || NETSTANDARD1_3
337+
#if NETSTANDARD
345338
private static IEnumerable<TimeZoneInfo> GetSystemTimeZonesLinux()
346339
{
347340
// Don't trust TimeZoneInfo.GetSystemTimeZones on Non-Windows
@@ -364,7 +357,6 @@ private static IEnumerable<TimeZoneInfo> GetSystemTimeZonesLinux()
364357
yield return tzi;
365358
}
366359
}
367-
#endif
368360
#endif
369361
}
370362
}

src/TimeZoneConverter/TimeZoneConverter.csproj

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,16 @@
33
<PropertyGroup>
44
<Description>Lightweight library to convert quickly between IANA, Windows, and Rails time zone names.</Description>
55
<Authors>Matt Johnson-Pint</Authors>
6-
<TargetFrameworks>netstandard2.0;netstandard1.3;netstandard1.1;net471;net461;net45;net40;net35</TargetFrameworks>
6+
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
77
<PackageId>TimeZoneConverter</PackageId>
88
<PackageTags>timezone;time;zone;time zone;iana;tzdb;olson;timezoneinfo,rails</PackageTags>
9-
<PackageProjectUrl>https://github.com/mj1856/TimeZoneConverter</PackageProjectUrl>
9+
<PackageProjectUrl>https://github.com/mattjohnsonpint/TimeZoneConverter</PackageProjectUrl>
1010
<PackageLicenseExpression>MIT</PackageLicenseExpression>
11-
<IncludeSource>True</IncludeSource>
12-
<IncludeSymbols>True</IncludeSymbols>
13-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
14-
<Version>3.5.0</Version>
15-
</PropertyGroup>
16-
17-
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
18-
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
11+
<Version>4.0.0</Version>
1912
</PropertyGroup>
2013

2114
<PropertyGroup>
22-
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\TimeZoneConverter.xml</DocumentationFile>
15+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
2316
<SignAssembly>true</SignAssembly>
2417
<AssemblyOriginatorKeyFile>mj1856_oss.snk</AssemblyOriginatorKeyFile>
2518
</PropertyGroup>
@@ -28,31 +21,4 @@
2821
<EmbeddedResource Include="Data\*" />
2922
</ItemGroup>
3023

31-
<PropertyGroup>
32-
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net35'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride>
33-
</PropertyGroup>
34-
35-
<ItemGroup Condition="'$(TargetFramework)'=='netstandard1.3'">
36-
<PackageReference Remove="NETStandard.Library" />
37-
<PackageReference Include="System.Collections" Version="4.3.0" />
38-
<PackageReference Include="System.Linq" Version="4.3.0" />
39-
<PackageReference Include="System.Reflection" Version="4.3.0" />
40-
<PackageReference Include="System.Resources.ResourceManager" Version="4.3.0" />
41-
<PackageReference Include="System.Runtime" Version="4.3.1" />
42-
<PackageReference Include="System.Runtime.Extensions" Version="4.3.1" />
43-
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
44-
<PackageReference Include="System.IO.Compression" Version="4.3.0" />
45-
</ItemGroup>
46-
47-
<ItemGroup Condition="'$(TargetFramework)'=='netstandard1.1'">
48-
<PackageReference Remove="NETStandard.Library" />
49-
<PackageReference Include="System.Collections" Version="4.3.0" />
50-
<PackageReference Include="System.Linq" Version="4.3.0" />
51-
<PackageReference Include="System.Reflection" Version="4.3.0" />
52-
<PackageReference Include="System.Resources.ResourceManager" Version="4.3.0" />
53-
<PackageReference Include="System.Runtime" Version="4.3.1" />
54-
<PackageReference Include="System.Runtime.Extensions" Version="4.3.1" />
55-
<PackageReference Include="System.IO.Compression" Version="4.3.0" />
56-
</ItemGroup>
57-
5824
</Project>

test/TimeZoneConverter.Posix.Tests/TimeZoneConverter.Posix.Tests.csproj

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

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
88
<ProjectReference Include="..\..\src\TimeZoneConverter.Posix\TimeZoneConverter.Posix.csproj" />
99
</ItemGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
1313
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
1414
<PrivateAssets>all</PrivateAssets>
1515
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

test/TimeZoneConverter.Tests/TimeZoneConverter.Tests.csproj

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

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
88
<ProjectReference Include="..\..\src\TimeZoneConverter\TimeZoneConverter.csproj" />
99
</ItemGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
1313
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
1414
<PrivateAssets>all</PrivateAssets>
1515
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

0 commit comments

Comments
 (0)