Skip to content

Commit b1f63ee

Browse files
Drop support for older targets
1 parent d11d94c commit b1f63ee

File tree

7 files changed

+15
-114
lines changed

7 files changed

+15
-114
lines changed

src/TimeZoneNames.DataBuilder/TimeZoneNames.DataBuilder.csproj

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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

@@ -17,10 +17,9 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
21-
<PackageReference Include="NodaTime" Version="3.0.5" />
22-
<PackageReference Include="SharpCompress" Version="0.29.0" />
23-
<PackageReference Include="System.Xml.XPath.XDocument" Version="4.3.0" />
20+
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
21+
<PackageReference Include="NodaTime" Version="3.0.9" />
22+
<PackageReference Include="SharpCompress" Version="0.30.1" />
2423
</ItemGroup>
2524

2625
</Project>

src/TimeZoneNames/CultureAwareStringComparer.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/TimeZoneNames/TZNames.cs

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
using System;
2+
using System.Collections.Concurrent;
23
using System.Collections.Generic;
34
using System.Globalization;
45
using System.Linq;
56
using TimeZoneConverter;
67

7-
#if !NET35
8-
using System.Collections.Concurrent;
9-
#endif
10-
118
namespace TimeZoneNames
129
{
1310
/// <summary>
@@ -16,14 +13,7 @@ namespace TimeZoneNames
1613
public static class TZNames
1714
{
1815
private static readonly TimeZoneData Data = TimeZoneData.Load();
19-
20-
#if NET35
21-
private static readonly Dictionary<string, IComparer<string>> Comparers = new Dictionary<string, IComparer<string>>(StringComparer.OrdinalIgnoreCase);
22-
23-
private static readonly object SyncLock = new object();
24-
#else
2516
private static readonly ConcurrentDictionary<string, IComparer<string>> Comparers = new ConcurrentDictionary<string, IComparer<string>>(StringComparer.OrdinalIgnoreCase);
26-
#endif
2717

2818
/// <summary>
2919
/// Gets an array of IANA time zone identifiers for a specific country.
@@ -166,11 +156,7 @@ private static IDictionary<string, string> GetFixedTimeZoneNames(string language
166156

167157
private static string AppendCity(this string name, string city)
168158
{
169-
#if NET35
170-
return string.IsNullOrEmpty(city.Trim()) ? name : $"{name} ({city})";
171-
#else
172159
return string.IsNullOrWhiteSpace(city) ? name : $"{name} ({city})";
173-
#endif
174160
}
175161

176162
/// <summary>
@@ -292,38 +278,11 @@ public static ICollection<string> GetLanguageCodes()
292278

293279
private static IComparer<string> GetComparer(string langKey)
294280
{
295-
296-
#if NET35
297-
if (Comparers.TryGetValue(langKey, out IComparer<string> comparer))
298-
{
299-
return comparer;
300-
}
301-
302-
lock (SyncLock)
303-
{
304-
if (!Comparers.TryGetValue(langKey, out comparer))
305-
{
306-
var culture = new CultureInfo(langKey.Replace('_', '-'));
307-
comparer = StringComparer.Create(culture, true);
308-
}
309-
310-
return comparer;
311-
}
312-
313-
#elif NETSTANDARD1_1
314-
return Comparers.GetOrAdd(langKey, key =>
315-
{
316-
var culture = new CultureInfo(langKey.Replace('_', '-'));
317-
return new CultureAwareStringComparer(culture, CompareOptions.IgnoreCase);
318-
});
319-
320-
#else
321281
return Comparers.GetOrAdd(langKey, key =>
322282
{
323283
var culture = new CultureInfo(langKey.Replace('_', '-'));
324284
return StringComparer.Create(culture, true);
325285
});
326-
#endif
327286
}
328287

329288
private static string GetLanguageKey(string languageCode, bool forDisplayNames = false)

src/TimeZoneNames/TimeZoneData.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,7 @@ internal class TimeZoneData
2929
[SecuritySafeCritical]
3030
public static TimeZoneData Load()
3131
{
32-
33-
#if NET35 || NET40
34-
Assembly assembly = typeof(TimeZoneData).Assembly;
35-
#else
3632
Assembly assembly = typeof(TimeZoneData).GetTypeInfo().Assembly;
37-
#endif
3833
using Stream compressedStream = assembly.GetManifestResourceStream($"{assembly.GetName().Name}.data.json.gz");
3934
using var stream = new GZipStream(compressedStream!, CompressionMode.Decompress);
4035
using var reader = new StreamReader(stream);

src/TimeZoneNames/TimeZoneNames.csproj

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,17 @@
33
<PropertyGroup>
44
<Description>Provides localized time zone names.</Description>
55
<Authors>Matt Johnson-Pint</Authors>
6-
<TargetFrameworks>netstandard2.0;netstandard1.1;net471;net461;net45;net40;net35</TargetFrameworks>
7-
<LangVersion>8.0</LangVersion>
6+
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
7+
<LangVersion>latest</LangVersion>
88
<PackageId>TimeZoneNames</PackageId>
99
<PackageTags>timezone;time;zone;time zone;iana;tzdb;olson;timezoneinfo;globalization;international;localization</PackageTags>
10-
<PackageProjectUrl>https://github.com/mj1856/TimeZoneNames</PackageProjectUrl>
10+
<PackageProjectUrl>https://github.com/mattjohnsonpint/TimeZoneNames</PackageProjectUrl>
1111
<PackageLicenseExpression>MIT</PackageLicenseExpression>
12-
<IncludeSource>True</IncludeSource>
13-
<IncludeSymbols>True</IncludeSymbols>
14-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
15-
<Version>4.2.0</Version>
16-
</PropertyGroup>
17-
18-
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
19-
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
12+
<Version>5.0.0</Version>
2013
</PropertyGroup>
2114

2215
<PropertyGroup>
23-
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\TimeZoneNames.xml</DocumentationFile>
16+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
2417
<AssemblyOriginatorKeyFile>mj1856_oss.snk</AssemblyOriginatorKeyFile>
2518
<SignAssembly>true</SignAssembly>
2619
</PropertyGroup>
@@ -33,32 +26,12 @@
3326
<PackageReference Include="Newtonsoft.Json" Version="11.0.1" />
3427
</ItemGroup>
3528

36-
<ItemGroup Condition="'$(TargetFramework)'=='netstandard1.1'">
37-
<PackageReference Remove="NETStandard.Library" />
38-
<PackageReference Include="System.Collections.Concurrent" Version="4.3.0" />
39-
<PackageReference Include="System.Globalization" Version="4.3.0" />
40-
<PackageReference Include="System.Linq" Version="4.3.0" />
41-
<PackageReference Include="System.Reflection" Version="4.3.0" />
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-
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
46-
</ItemGroup>
47-
48-
<ItemGroup Condition="'$(TargetFramework)'=='net461' Or '$(TargetFramework)'=='net471'">
29+
<ItemGroup Condition="'$(TargetFramework)'=='net461'">
4930
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
5031
</ItemGroup>
5132

52-
<ItemGroup Condition="'$(TargetFramework)'=='net45' Or '$(TargetFramework)'=='net40' Or '$(TargetFramework)'=='net35'">
53-
<PackageReference Include="Newtonsoft.Json" Version="6.0.1" />
54-
</ItemGroup>
55-
56-
<PropertyGroup>
57-
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net35'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride>
58-
</PropertyGroup>
59-
6033
<ItemGroup>
61-
<PackageReference Include="TimeZoneConverter" Version="3.4.0" />
34+
<PackageReference Include="TimeZoneConverter" Version="4.0.0" />
6235
</ItemGroup>
6336

6437
</Project>

src/TimeZoneNames/data.json.gz

2.13 KB
Binary file not shown.

test/TimeZoneNames.Tests/TimeZoneNames.Tests.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>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<OutputType>Exe</OutputType>
66
</PropertyGroup>
77

@@ -10,12 +10,12 @@
1010
</ItemGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
13+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
1414
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
1515
<PrivateAssets>all</PrivateAssets>
1616
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1717
</PackageReference>
18-
<PackageReference Include="NodaTime" Version="3.0.5" />
18+
<PackageReference Include="NodaTime" Version="3.0.9" />
1919
<PackageReference Include="xunit" Version="2.4.1" />
2020
</ItemGroup>
2121

0 commit comments

Comments
 (0)