Skip to content

Commit fd21709

Browse files
author
Jurgen De Leon
committed
add DefineConstants NETFRAMEWORK, NETSTANDARD, NETCORE
1 parent d178b13 commit fd21709

8 files changed

Lines changed: 67 additions & 19 deletions

File tree

GMap.NET/GMap.NET.Avalonia/GMap.NET.Avalonia.csproj

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,18 @@
1515
History Release Notes
1616
https://github.com/judero01col/GMap.NET/blob/master/README.md#release-notes
1717
</PackageReleaseNotes>
18-
</PropertyGroup>
19-
18+
</PropertyGroup>
19+
20+
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^net\d'))">
21+
<DefineConstants>NETFRAMEWORK</DefineConstants>
22+
</PropertyGroup>
23+
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netstandard\d'))">
24+
<DefineConstants>NETSTANDARD</DefineConstants>
25+
</PropertyGroup>
26+
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netcoreapp\d'))">
27+
<DefineConstants>NETCORE</DefineConstants>
28+
</PropertyGroup>
29+
2030
<ItemGroup>
2131
<PackageReference Include="Avalonia" Version="0.10.6" />
2232
<PackageReference Include="Avalonia.Desktop" Version="0.10.6" />

GMap.NET/GMap.NET.Avalonia/GMapControl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1946,7 +1946,7 @@ public void ReloadMap()
19461946
_core.ReloadMap();
19471947
}
19481948

1949-
#if !NET46
1949+
#if !NETFRAMEWORK
19501950

19511951
public Task ReloadMapAsync()
19521952
{

GMap.NET/GMap.NET.Core/GMap.NET.Core.csproj

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
<Product>GMap.NET.Core</Product>
66
<AssemblyTitle>GMap.NET.Core</AssemblyTitle>
77
<RootNamespace>GMap.NET</RootNamespace>
8-
<TargetFrameworks>net46;net47;net48;netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
9-
<DefineConstants>MONO_disabled;SQLite;MySQL_disabled;PostgreSQL_disabled;$(DefineConstants)</DefineConstants>
8+
<TargetFrameworks>net46;net47;net48;netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
109

1110
<PackageReleaseNotes>
1211
- New Provider OpenStreetMapGraphHopper
@@ -18,7 +17,17 @@ History Release Notes
1817
https://github.com/judero01col/GMap.NET/blob/master/README.md#release-notes
1918
</PackageReleaseNotes>
2019
</PropertyGroup>
21-
20+
21+
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^net\d'))">
22+
<DefineConstants>NETFRAMEWORK;MONO_disabled;SQLite;MySQL_disabled;PostgreSQL_disabled;$(DefineConstants)</DefineConstants>
23+
</PropertyGroup>
24+
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netstandard\d'))">
25+
<DefineConstants>NETSTANDARD;MONO_disabled;SQLite;MySQL_disabled;PostgreSQL_disabled;$(DefineConstants)</DefineConstants>
26+
</PropertyGroup>
27+
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netcoreapp\d'))">
28+
<DefineConstants>NETCORE;MONO_disabled;SQLite;MySQL_disabled;PostgreSQL_disabled;$(DefineConstants)</DefineConstants>
29+
</PropertyGroup>
30+
2231
<ItemGroup>
2332
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
2433
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />

GMap.NET/GMap.NET.Core/Internals/Core.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using System.Threading.Tasks;
88
using GMap.NET.MapProviders;
99
using GMap.NET.Projections;
10-
#if NET46
10+
#if NETFRAMEWORK
1111
using System.Collections.Concurrent;
1212
#endif
1313

@@ -57,7 +57,7 @@ internal sealed class Core : IDisposable
5757
internal List<DrawTile> TileDrawingList = new List<DrawTile>();
5858
internal FastReaderWriterLock TileDrawingListLock = new FastReaderWriterLock();
5959

60-
#if !NET46
60+
#if !NETFRAMEWORK
6161
public readonly Stack<LoadTask> TileLoadQueue = new Stack<LoadTask>();
6262
#endif
6363

@@ -351,10 +351,9 @@ public bool SetZoomToFitRect(RectLatLng rect)
351351
public event MapTypeChanged OnMapTypeChanged;
352352

353353
readonly List<Thread> _gThreadPool = new List<Thread>();
354-
// ^
354+
355355
// should be only one pool for multiply controls, any ideas how to fix?
356356
//static readonly List<Thread> GThreadPool = new List<Thread>();
357-
358357
// windows forms or wpf
359358
internal string SystemType;
360359

@@ -615,7 +614,7 @@ public void ReloadMap()
615614
}
616615
}
617616

618-
#if !NET46
617+
#if !NETFRAMEWORK
619618
public Task ReloadMapAsync()
620619
{
621620
ReloadMap();
@@ -768,7 +767,7 @@ public void CancelAsyncTasks()
768767
{
769768
if (IsStarted)
770769
{
771-
#if NET46
770+
#if NETFRAMEWORK
772771
//TODO: clear loading
773772
#else
774773
Monitor.Enter(TileLoadQueue);
@@ -794,7 +793,7 @@ public void CancelAsyncTasks()
794793
volatile int _okZoom;
795794
volatile int _skipOverZoom;
796795

797-
#if NET46
796+
#if NETFRAMEWORK
798797
static readonly BlockingCollection<LoadTask> TileLoadQueue4 =
799798
new BlockingCollection<LoadTask>(new ConcurrentStack<LoadTask>());
800799

@@ -1208,7 +1207,7 @@ void UpdateBounds()
12081207
TileDrawingListLock.ReleaseWriterLock();
12091208
}
12101209

1211-
#if NET46
1210+
#if NETFRAMEWORK
12121211
Interlocked.Exchange(ref _loadWaitCount, 0);
12131212
#else
12141213
Monitor.Enter(TileLoadQueue);
@@ -1221,7 +1220,7 @@ void UpdateBounds()
12211220
foreach (var p in TileDrawingList)
12221221
{
12231222
var task = new LoadTask(p.PosXY, Zoom, this);
1224-
#if NET46
1223+
#if NETFRAMEWORK
12251224
AddLoadTask(task);
12261225
#else
12271226
{
@@ -1238,7 +1237,7 @@ void UpdateBounds()
12381237
TileDrawingListLock.ReleaseReaderLock();
12391238
}
12401239

1241-
#if !NET46
1240+
#if !NETFRAMEWORK
12421241
#region -- starts loader threads if needed --
12431242

12441243
lock (_gThreadPool)
@@ -1265,7 +1264,7 @@ void UpdateBounds()
12651264
_lastTileLoadStart = DateTime.Now;
12661265
Debug.WriteLine("OnTileLoadStart - at zoom " + Zoom + ", time: " + _lastTileLoadStart.TimeOfDay);
12671266
}
1268-
#if !NET46
1267+
#if !NETFRAMEWORK
12691268
_loadWaitCount = 0;
12701269
Monitor.PulseAll(TileLoadQueue);
12711270
}
@@ -1355,7 +1354,7 @@ void Dispose(bool disposing)
13551354
TileDrawingListLock.ReleaseWriterLock();
13561355
}
13571356

1358-
#if NET46
1357+
#if NETFRAMEWORK
13591358
//TODO: maybe
13601359
#else
13611360
// cancel waiting loaders

GMap.NET/GMap.NET.WindowsForms.Utils/GMap.NET.WindowsForms.Utils.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@
1313
Use .DumpMarkers() or .DumpRoute() to add markers or route lines to a map in a new result pane
1414
</PackageReleaseNotes>
1515
</PropertyGroup>
16+
17+
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^net\d'))">
18+
<DefineConstants>NETFRAMEWORK</DefineConstants>
19+
</PropertyGroup>
20+
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netstandard\d'))">
21+
<DefineConstants>NETSTANDARD</DefineConstants>
22+
</PropertyGroup>
23+
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netcoreapp\d'))">
24+
<DefineConstants>NETCORE</DefineConstants>
25+
</PropertyGroup>
1626

1727
<ItemGroup>
1828
<PackageReference Include="LINQPad" Version="5.40.0" />

GMap.NET/GMap.NET.WindowsForms/GMap.NET.WindowsForms.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ https://github.com/judero01col/GMap.NET/blob/master/README.md#release-notes
1919
</PackageReleaseNotes>
2020
</PropertyGroup>
2121

22+
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^net\d'))">
23+
<DefineConstants>NETFRAMEWORK;ContinuesMapNo;$(DefineConstants)</DefineConstants>
24+
</PropertyGroup>
25+
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netstandard\d'))">
26+
<DefineConstants>NETSTANDARD;ContinuesMapNo;$(DefineConstants)</DefineConstants>
27+
</PropertyGroup>
28+
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netcoreapp\d'))">
29+
<DefineConstants>NETCORE;ContinuesMapNo;$(DefineConstants)</DefineConstants>
30+
</PropertyGroup>
31+
2232
<ItemGroup>
2333
<ProjectReference Include="..\GMap.NET.Core\GMap.NET.Core.csproj" />
2434
</ItemGroup>

GMap.NET/GMap.NET.WindowsPresentation/GMap.NET.WindowsPresentation.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ https://github.com/judero01col/GMap.NET/blob/master/README.md#release-notes
1717
</PackageReleaseNotes>
1818
</PropertyGroup>
1919

20+
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^net\d'))">
21+
<DefineConstants>NETFRAMEWORK</DefineConstants>
22+
</PropertyGroup>
23+
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netstandard\d'))">
24+
<DefineConstants>NETSTANDARD</DefineConstants>
25+
</PropertyGroup>
26+
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netcoreapp\d'))">
27+
<DefineConstants>NETCORE</DefineConstants>
28+
</PropertyGroup>
29+
2030
<ItemGroup>
2131
<ProjectReference Include="..\GMap.NET.Core\GMap.NET.Core.csproj" />
2232
</ItemGroup>

GMap.NET/GMap.NET.WindowsPresentation/GMapControl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2529,7 +2529,7 @@ public void ReloadMap()
25292529
_core.ReloadMap();
25302530
}
25312531

2532-
#if !NET46
2532+
#if !NETFRAMEWORK
25332533
public Task ReloadMapAsync()
25342534
{
25352535
return _core.ReloadMapAsync();

0 commit comments

Comments
 (0)