Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update projects to V2 netstandard #42

Open
wants to merge 6 commits into
base: v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
212 changes: 32 additions & 180 deletions BACnet.csproj
Original file line number Diff line number Diff line change
@@ -1,189 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{66832876-01FC-4B7C-8D92-54195773FABF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFrameworks>net40;net462;netstandard2.0;</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Company>Ela-compil sp. z o. o.</Company>
<Product>BACnet</Product>
<Authors>Morten Kvistgaard, Ela-compil</Authors>
<Copyright>Copyright (c) 2019 Jakub Bartkowiak, MIT License</Copyright>
<PackageTags>fce4c8e3-0d3a-4d90-9c26-349177129433</PackageTags>
<PackageProjectUrl>https://github.com/ela-compil/BACnet</PackageProjectUrl>
<PackageIconUrl>https://raw.githubusercontent.com/ela-compil/BACnet/master/logo.png</PackageIconUrl>
<PackageReleaseNotes>BACnet protocol library for .NET</PackageReleaseNotes>
<RootNamespace>System.IO.BACnet</RootNamespace>
<AssemblyName>BACnet</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>latest</LangVersion>
<LangVersion>7.3</LangVersion>
<Description>BACnet protocol library for .NET</Description>
</PropertyGroup>
<ItemGroup>
<Reference Include="Common.Logging, Version=3.4.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\Common.Logging.3.4.1\lib\net40\Common.Logging.dll</HintPath>
</Reference>
<Reference Include="Common.Logging.Core, Version=3.4.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\Common.Logging.Core.3.4.1\lib\net40\Common.Logging.Core.dll</HintPath>
</Reference>
<Reference Include="PacketDotNet, Version=0.13.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\PacketDotNet.0.13.0\lib\net\PacketDotNet.dll</HintPath>
</Reference>
<Reference Include="SharpPcap, Version=4.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\SharpPcap.4.2.0\lib\net\SharpPcap.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Compile Remove="packages\**" />
<Compile Remove="Tests\**" />
<EmbeddedResource Remove="packages\**" />
<EmbeddedResource Remove="Tests\**" />
<None Remove="packages\**" />
<None Remove="Tests\**" />
</ItemGroup>
<ItemGroup>
<Compile Include="BacnetAsyncResult.cs" />
<Compile Include="BacnetException.cs" />
<Compile Include="Base\BacnetAbortReason.cs" />
<Compile Include="Base\BacnetAddress.cs" />
<Compile Include="Base\BacnetAddressTypes.cs" />
<Compile Include="Base\BacnetAlarmSummaryData.cs" />
<Compile Include="Base\BacnetApplicationTags.cs" />
<Compile Include="Base\BacnetBinaryPv.cs" />
<Compile Include="Base\BacnetProgramError.cs" />
<Compile Include="Base\BacnetProgramRequest.cs" />
<Compile Include="Base\BacnetProgramState.cs" />
<Compile Include="Base\BacnetPrescale.cs" />
<Compile Include="Base\BacnetReinitializedStates.cs" />
<Compile Include="BACnetClient.cs" />
<Compile Include="Base\BacnetBitString.cs" />
<Compile Include="Base\BacnetBvlcFunctions.cs" />
<Compile Include="Base\BacnetBvlcResults.cs" />
<Compile Include="Base\BACnetCalendarEntry.cs" />
<Compile Include="Base\BacnetCharacterStringEncodings.cs" />
<Compile Include="Base\BacnetCOVSubscription.cs" />
<Compile Include="Base\BacnetDate.cs" />
<Compile Include="Base\BacnetDateRange.cs" />
<Compile Include="Base\BacnetDeviceObjectPropertyReference.cs" />
<Compile Include="Base\BacnetError.cs" />
<Compile Include="Base\Enums\EnumUtils.cs" />
<Compile Include="Base\EventNotification\EventValues\EventValuesBase.cs" />
<Compile Include="Base\EventNotification\EventValues\ChangeOfLifeSafety.cs" />
<Compile Include="Base\EventNotification\EventValues\UnsignedRange.cs" />
<Compile Include="Base\EventNotification\EventValues\ChangeOfState.cs" />
<Compile Include="Base\EventNotification\EventValues\OutOfRange.cs" />
<Compile Include="Base\EventNotification\EventValues\FloatingLimit.cs" />
<Compile Include="Base\EventNotification\EventValues\ChangeOfValue.cs" />
<Compile Include="Base\EventNotification\EventValues\BufferReady.cs" />
<Compile Include="Base\EventNotification\EventValues\ChangeOfBitString.cs" />
<Compile Include="Base\EventNotification\StateTransition.cs" />
<Compile Include="Base\EventNotification\NotificationData.cs" />
<Compile Include="Base\BacnetGenericTime.cs" />
<Compile Include="Base\BacnetGetEventInformationData.cs" />
<Compile Include="Base\BacnetLogRecord.cs" />
<Compile Include="Base\BacnetMaxAdpu.cs" />
<Compile Include="Base\BacnetMaxSegments.cs" />
<Compile Include="Base\BacnetConfirmedServices.cs" />
<Compile Include="Base\BacnetErrorCodes.cs" />
<Compile Include="Base\BacnetMstpFrameTypes.cs" />
<Compile Include="Base\BacnetNetworkMessageTypes.cs" />
<Compile Include="Base\BacnetNodeTypes.cs" />
<Compile Include="Base\BacnetNpduControls.cs" />
<Compile Include="Base\BacnetObjectDescription.cs" />
<Compile Include="Base\BacnetObjectId.cs" />
<Compile Include="Base\BacnetObjectTypes.cs" />
<Compile Include="Base\BacnetPolarity.cs" />
<Compile Include="Base\BacnetPropertyIds.cs" />
<Compile Include="Base\BacnetPropertyReference.cs" />
<Compile Include="Base\BacnetPropertyValue.cs" />
<Compile Include="Base\BacnetPropertyState.cs" />
<Compile Include="Base\BacnetPtpDisconnectReasons.cs" />
<Compile Include="Base\BacnetPtpFrameTypes.cs" />
<Compile Include="Base\BacnetReadAccessResult.cs" />
<Compile Include="Base\BacnetReadAccessSpecification.cs" />
<Compile Include="Base\BacnetReliability.cs" />
<Compile Include="Base\BacnetScale.cs" />
<Compile Include="Base\BacnetServicesSupported.cs" />
<Compile Include="Base\BacnetStatusFlags.cs" />
<Compile Include="Base\BacnetUnconfirmedServices.cs" />
<Compile Include="Base\BacnetTimestampTags.cs" />
<Compile Include="Base\BacnetTrendLogValueType.cs" />
<Compile Include="Base\BacnetUnitsId.cs" />
<Compile Include="Base\BacnetDeviceStatus.cs" />
<Compile Include="Base\BacnetErrorClasses.cs" />
<Compile Include="Base\BacnetPduTypes.cs" />
<Compile Include="Base\BacnetRejectReason.cs" />
<Compile Include="Base\BacnetRestartReason.cs" />
<Compile Include="Base\BacnetResultFlags.cs" />
<Compile Include="Base\BacnetSegmentations.cs" />
<Compile Include="Base\Enums\BacnetBackupState.cs" />
<Compile Include="Base\Enums\BacnetEventEnable.cs" />
<Compile Include="Base\Enums\BacnetEventStates.cs" />
<Compile Include="Base\Enums\BacnetEventTypes.cs" />
<Compile Include="Base\Enums\BacnetFileAccessMethod.cs" />
<Compile Include="Base\Enums\BacnetLifeSafetyModes.cs" />
<Compile Include="Base\Enums\BacnetLifeSafetyOperations.cs" />
<Compile Include="Base\Enums\BacnetLifeSafetyStates.cs" />
<Compile Include="Base\Enums\BacnetLimitEnable.cs" />
<Compile Include="Base\Enums\BacnetNotifyTypes.cs" />
<Compile Include="Base\Enums\BacnetCOVTypes.cs" />
<Compile Include="Helpers\BacnetValuesExtensions.cs" />
<Compile Include="Helpers\StringFormatterExtension.cs" />
<Compile Include="Base\BacnetBvlcV6Functions.cs" />
<Compile Include="Base\BacnetBvlcV6Results.cs" />
<Compile Include="Transport\BacnetTransportBase.cs" />
<Compile Include="Transport\IBacnetSerialTransport.cs" />
<Compile Include="Transport\IBacnetTransport.cs" />
<Compile Include="Transport\BacnetMstpProtocolTransport.cs" />
<Compile Include="Transport\BacnetPipeTransport.cs" />
<Compile Include="Transport\BacnetPtpProtocolTransport.cs" />
<Compile Include="Transport\BacnetSerialPortTransport.cs" />
<Compile Include="Transport\BacnetIpUdpProtocolTransport.cs" />
<Compile Include="Transport\BacnetTransportEthernet.cs" />
<Compile Include="Transport\BacnetIpV6UdpProtocolTransport.cs" />
<Compile Include="Transport\BVLCV6.cs" />
<Compile Include="Base\BacnetValue.cs" />
<Compile Include="Base\BacnetweekNDay.cs" />
<Compile Include="Base\BacnetWritePriority.cs" />
<Compile Include="Base\DeviceReportingRecipient.cs" />
<Compile Include="Serialize\APDU.cs" />
<Compile Include="Serialize\ASN1.cs" />
<Compile Include="Base\BacnetReadRangeRequestTypes.cs" />
<Compile Include="Serialize\BVLC.cs" />
<Compile Include="Serialize\EncodeBuffer.cs" />
<Compile Include="Serialize\EncodeResult.cs" />
<Compile Include="Serialize\MSTP.cs" />
<Compile Include="Serialize\NPDU.cs" />
<Compile Include="Serialize\PTP.cs" />
<Compile Include="Serialize\Services.cs" />
<Compile Include="Storage\DeviceStorage.cs" />
<Compile Include="Storage\Object.cs" />
<Compile Include="Storage\Property.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<PackageReference Include="Common.Logging" Version="3.4.1" />
<PackageReference Include="Common.Logging.Core" Version="3.4.1" />
</ItemGroup>
<ItemGroup>
<None Include="BACnet.nuspec" />
<None Include="packages.config" />
<ItemGroup Condition="'$(TargetFramework)' == 'net40'">
<PackageReference Include="PacketDotNet" Version="0.13.0" />
<PackageReference Include="SharpPcap" Version="4.2.0" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.IO.Ports" Version="4.5.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="PacketDotNet" Version="0.19.3" />
<PackageReference Include="SharpPcap" Version="4.5.0" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
14 changes: 0 additions & 14 deletions BACnet.nuspec

This file was deleted.

3 changes: 1 addition & 2 deletions BacnetAsyncResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class BacnetAsyncResult : IAsyncResult, IDisposable
private readonly int _transmitLength;
private readonly bool _waitForTransmit;
private readonly TimeSpan _transmitTimeout;
private ManualResetEvent _waitHandle;
private ManualResetEvent _waitHandle = new ManualResetEvent(false);

public bool Segmented { get; private set; }
public byte[] Result { get; private set; }
Expand Down Expand Up @@ -48,7 +48,6 @@ public BacnetAsyncResult(BacnetClient comm, BacnetAddress adr, byte invokeId,
_comm.OnReject += OnReject;
_comm.OnSimpleAck += OnSimpleAck;
_comm.OnSegment += OnSegment;
_waitHandle = new ManualResetEvent(false);
}

public BacnetAsyncResult Send()
Expand Down
4 changes: 4 additions & 0 deletions Base/BacnetAddress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public class BacnetAddress : ASN1.IEncode
// Modif FC
public BacnetAddress RoutedSource = null;

public BacnetAddress()
{
}

public BacnetAddress(BacnetAddressTypes addressType, ushort network = 0, byte[] address = null)
{
type = addressType;
Expand Down
15 changes: 0 additions & 15 deletions Properties/AssemblyInfo.cs

This file was deleted.

5 changes: 3 additions & 2 deletions Serialize/ASN1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ significant bit of the second octet is 1. */
buffer.Add((byte)(sbyte)value);
else if (value >= -32768 && value < 32768)
encode_signed16(buffer, (short)value);
else if (value > -8388608 && value < 8388608)
else if (value >= -8388608 && value < 8388608)
encode_signed24(buffer, value);
else
encode_signed32(buffer, value);
Expand Down Expand Up @@ -1176,6 +1176,7 @@ public static int decode_signed32(byte[] buffer, int offset, out int value)
public static int decode_signed24(byte[] buffer, int offset, out int value)
{
value = (buffer[offset + 0] << 16) & 0x00ff0000;
value = (value & 0x80_00_00) != 0 ? /*2's complement*/ value | (0xff << 24) : value;
value |= (buffer[offset + 1] << 8) & 0x0000ff00;
value |= buffer[offset + 2] & 0x000000ff;
return 3;
Expand Down Expand Up @@ -1983,7 +1984,7 @@ public static int bacapp_decode_context_application_data(BacnetAddress address,
{
tagLen = decode_device_obj_property_ref(buffer, offset, maxOffset, out var v);
if (tagLen < 0) return -1;
value.Tag = BacnetApplicationTags.BACNET_APPLICATION_TAG_OBJECT_PROPERTY_REFERENCE;
value.Tag = BacnetApplicationTags.BACNET_APPLICATION_TAG_DEVICE_OBJECT_PROPERTY_REFERENCE;
value.Value = v;
return tagLen;
}
Expand Down
19 changes: 10 additions & 9 deletions Tests/BACnet.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -29,16 +30,11 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework, Version=3.9.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.9.0\lib\net40\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.4.0\lib\portable-net40+sl4+win8+wp8\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
Expand All @@ -51,14 +47,19 @@
<Compile Include="Serialize\ServicesTests.cs" />
<Compile Include="Serialize\ASN1Tests.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BACnet.csproj">
<Project>{66832876-01FC-4B7C-8D92-54195773FABF}</Project>
<Name>BACnet</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="NUnit">
<Version>3.9.0</Version>
</PackageReference>
<PackageReference Include="System.ValueTuple">
<Version>4.4.0</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
2 changes: 1 addition & 1 deletion Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BACnet.Tests")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down
Loading