mirror of
https://github.com/dotMorten/NmeaParser.git
synced 2026-01-29 03:44:25 +01:00
Added .NET 6 support
This commit is contained in:
parent
91d0a73cd2
commit
f4aacf70ee
|
|
@ -52,9 +52,9 @@ namespace NmeaParser
|
|||
public static IEnumerable<Android.Bluetooth.BluetoothDevice> GetBluetoothSerialDevices()
|
||||
{
|
||||
var adapter = Android.Bluetooth.BluetoothAdapter.DefaultAdapter;
|
||||
if (adapter != null && adapter.IsEnabled)
|
||||
if (adapter != null && adapter.IsEnabled && adapter.BondedDevices is not null)
|
||||
{
|
||||
foreach (var b in adapter.BondedDevices.Where(d => d.GetUuids().Any(t => SERIAL_UUID.CompareTo(t.Uuid) == 0)))
|
||||
foreach (var b in adapter.BondedDevices.Where(d => d.GetUuids()?.Any(t => SERIAL_UUID.CompareTo(t.Uuid) == 0) == true))
|
||||
yield return b;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace NmeaParser
|
|||
return m_stream;
|
||||
}
|
||||
|
||||
private void OnEndOfStreamReached(object sender, EventArgs e)
|
||||
private void OnEndOfStreamReached(object? sender, EventArgs e)
|
||||
{
|
||||
EndOfStreamReached?.Invoke(this, e);
|
||||
if (m_stream is BufferedStream stream && !stream.CanRewind && IsOpen)
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ namespace NmeaParser.Gnss
|
|||
/// </summary>
|
||||
public NmeaDevice Device { get; }
|
||||
|
||||
private void NmeaMessageReceived(object sender, NmeaParser.NmeaMessageReceivedEventArgs e)
|
||||
private void NmeaMessageReceived(object? sender, NmeaParser.NmeaMessageReceivedEventArgs e)
|
||||
{
|
||||
OnMessageReceived(e.Message);
|
||||
}
|
||||
|
|
@ -448,7 +448,7 @@ namespace NmeaParser.Gnss
|
|||
{
|
||||
SynchronizationContext.Post((d) =>
|
||||
{
|
||||
foreach (string propertyName in (IEnumerable<string>)d)
|
||||
foreach (string propertyName in (IEnumerable<string>)d!)
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}, properties);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ namespace NmeaParser.Gnss.Ntrip
|
|||
|
||||
private void ReceiveCallback(IAsyncResult ar)
|
||||
{
|
||||
TaskCompletionSource<int> tcs = (TaskCompletionSource<int>)ar.AsyncState;
|
||||
TaskCompletionSource<int> tcs = (TaskCompletionSource<int>)ar.AsyncState!;
|
||||
if (tcs.Task.IsCanceled) return;
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ namespace NmeaParser.Messages
|
|||
if (pinfo.Length == 2 && pinfo[0].ParameterType == typeof(string) && pinfo[1].ParameterType == typeof(string[]))
|
||||
{
|
||||
if (!replace && messageTypes.ContainsKey(nmeaType))
|
||||
throw new InvalidOperationException($"Message type {nmeaType} declared in {typeInfo.FullName} is already registered by {messageTypes[nmeaType].DeclaringType.FullName}");
|
||||
throw new InvalidOperationException($"Message type {nmeaType} declared in {typeInfo.FullName} is already registered by {messageTypes[nmeaType].DeclaringType?.FullName}");
|
||||
messageTypes[nmeaType] = c;
|
||||
return;
|
||||
}
|
||||
|
|
@ -309,8 +309,9 @@ namespace NmeaParser.Messages
|
|||
/// </summary>
|
||||
/// <param name="other">An object to compare with this object.</param>
|
||||
/// <returns><c>true</c> if the current object is equal to the other parameter; otherwise, <c>false</c>.</returns>
|
||||
public bool Equals(NmeaMessage other)
|
||||
public bool Equals(NmeaMessage? other)
|
||||
{
|
||||
if (other is null) return false;
|
||||
if (other.MessageType != MessageType)
|
||||
return false;
|
||||
if (other.MessageParts.Count != MessageParts.Count)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<Sdk Name="Microsoft.DotNet.PackageValidation" Version="1.0.0-preview.7.21379.12" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.0;netstandard1.4;netcoreapp2.1;net452;monoandroid50;monoandroid70;xamarinios10;uap10.0.18362</TargetFrameworks>
|
||||
<TargetFrameworks>netstandard2.0;netstandard1.4;netcoreapp2.1;net452;monoandroid50;monoandroid70;xamarinios10;uap10.0.18362;net6.0;net6.0-ios;net6.0-android;net6.0-windows10.0.19041.0</TargetFrameworks>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
|
|
@ -12,20 +12,20 @@
|
|||
<Description>An NMEA stream parser for serial port, bluetooth and file-based nmea simulation.</Description>
|
||||
<PackageTags>NMEA GPS GNSS Serialport Bluetooth Navigation NTRIP RTCM Galileo GLONASS BeiDou Garmin Trimble</PackageTags>
|
||||
<PackageId>SharpGIS.NmeaParser</PackageId>
|
||||
<Version Condition="'$(Version)'==''">2.2.2</Version> <!-- Note: Also update PackageValidationBaselineVersion -->
|
||||
<Version Condition="'$(Version)'==''">2.3.0</Version> <!-- Note: Also update PackageValidationBaselineVersion -->
|
||||
<Product>NMEA Parser</Product>
|
||||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
|
||||
<PackageProjectUrl>https://dotmorten.github.io/NmeaParser/</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/dotMorten/NmeaParser</RepositoryUrl>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<Copyright>Copyright © Morten Nielsen 2015-2020</Copyright>
|
||||
<Copyright>Copyright © Morten Nielsen 2015-2023</Copyright>
|
||||
<OutputPath>$(MSBuildThisFileDirectory)..\..\artifacts\NmeaParser\$(Configuration)</OutputPath>
|
||||
<PackageOutputPath>..\..\artifacts\NuGet\$(Configuration)\</PackageOutputPath>
|
||||
<PackageReleaseNotes></PackageReleaseNotes>
|
||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
||||
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
<TreatWarningsAsErrors Condition="'$(Configuration)'=='Release'">true</TreatWarningsAsErrors>
|
||||
<CodeAnalysisTreatWarningsAsErrors Condition="'$(Configuration)'=='Release'">true</CodeAnalysisTreatWarningsAsErrors>
|
||||
<Nullable>enable</Nullable>
|
||||
|
|
@ -48,26 +48,31 @@
|
|||
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
|
||||
<DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0'">
|
||||
<DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'net452'">
|
||||
<DefineConstants>$(DefineConstants);NETFX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'monoandroid50'">
|
||||
<DesignTimeBuild>false</DesignTimeBuild> <!-- workaround for MSBuildSdkExtras issue in VS16.2 -->
|
||||
<DefineConstants>$(DefineConstants);XAMARIN;API_LEVEL_21</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);API_LEVEL_21</DefineConstants>
|
||||
<NoWarn>$(NoWarn);XA0113;XA0114</NoWarn>
|
||||
<AndroidEnableGooglePlayStoreChecks>false</AndroidEnableGooglePlayStoreChecks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'monoandroid70'">
|
||||
<DesignTimeBuild>false</DesignTimeBuild> <!-- workaround for MSBuildSdkExtras issue in VS16.2 -->
|
||||
<DefineConstants>$(DefineConstants);XAMARIN;API_LEVEL_24</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);API_LEVEL_24</DefineConstants>
|
||||
<NoWarn>$(NoWarn);XA0113;XA0114</NoWarn>
|
||||
<AndroidEnableGooglePlayStoreChecks>false</AndroidEnableGooglePlayStoreChecks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0-android'">
|
||||
<DefineConstants>$(DefineConstants);API_LEVEL_24</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'xamarinios10'">
|
||||
<DefineConstants>$(DefineConstants);XAMARIN</DefineConstants>
|
||||
<NoWarn>$(NoWarn);VSX1000</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
@ -87,7 +92,7 @@
|
|||
<None Include="logo.png" Pack="true" PackagePath="" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1' OR '$(TargetFramework)'=='net6.0-windows10.0.19041.0'">
|
||||
<PackageReference Include="System.IO.Ports" Version="4.7.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
// * limitations under the License.
|
||||
// ******************************************************************************
|
||||
|
||||
#if NETFX || NETCOREAPP
|
||||
#if NETFX || NETCOREAPP && WINDOWS
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net5.0-windows10.0.18362.0</TargetFramework>
|
||||
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
|
||||
<UseWPF>true</UseWPF>
|
||||
<RootNamespace>SampleApp.WinDesktop</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
<Link>NmeaSampleData.txt</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<PackageReference Include="Esri.ArcGISRuntime.WPF" Version="100.12.0" />
|
||||
<PackageReference Include="Esri.ArcGISRuntime.WPF" Version="100.15.2" />
|
||||
<Content Include="car.glb">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="MSBuild.Sdk.Extras/3.0.22">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net452;netcoreapp3.1</TargetFrameworks>
|
||||
<TargetFrameworks>net472;net6.0</TargetFrameworks>
|
||||
<IsPackable>false</IsPackable>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
Loading…
Reference in a new issue