Skip to content

Commit

Permalink
Add .NET 6
Browse files Browse the repository at this point in the history
  • Loading branch information
OgreTransporter committed Feb 4, 2022
1 parent 71c9555 commit 267f77c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
9 changes: 8 additions & 1 deletion PdfFileWriter/PdfDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1392,10 +1392,17 @@ int Length
)
{
byte[] ByteArray = new byte[Length];
using(RNGCryptoServiceProvider RandNumGen = new RNGCryptoServiceProvider())
#if NET6_0_OR_GREATER
using (RandomNumberGenerator RandNumGen = RandomNumberGenerator.Create())
{
RandNumGen.GetBytes(ByteArray);
}
#else
using (RNGCryptoServiceProvider RandNumGen = new RNGCryptoServiceProvider())
{
RandNumGen.GetBytes(ByteArray);
}
#endif
return ByteArray;
}

Expand Down
4 changes: 4 additions & 0 deletions PdfFileWriter/PdfEncryption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ public class PdfEncryption : PdfObject, IDisposable
internal EncryptionType EncryptionType;
internal byte[] MasterKey;
internal MD5 MD5 = MD5.Create();
#if NET6_0_OR_GREATER
internal Aes AES = Aes.Create();
#else
internal AesCryptoServiceProvider AES = new AesCryptoServiceProvider();
#endif

private static readonly byte[] PasswordPad =
{
Expand Down
14 changes: 2 additions & 12 deletions PdfFileWriter/PdfFileWriter.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1;net5.0-windows</TargetFrameworks>
<TargetFrameworks>net472;netcoreapp3.1;net5.0-windows;net6.0-windows</TargetFrameworks>
<AssemblyProduct>PdfFileWriter</AssemblyProduct>
<AssemblyName>PdfFileWriter</AssemblyName>
<AssemblyVersion>1.28.0</AssemblyVersion>
Expand All @@ -23,20 +23,10 @@
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net472' Or '$(TargetFramework)' == 'net48'">
<DefineConstants>$(DefineConstants);NET4</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<DefineConstants>$(DefineConstants);NETCORE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net5.0-windows'">
<DefineConstants>$(DefineConstants);NET5</DefineConstants>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net472' Or '$(TargetFramework)' == 'net48'">
<Reference Include="System.Windows.Forms.DataVisualization" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' Or '$(TargetFramework)' == 'net5.0-windows'">
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' Or '$(TargetFramework)' == 'net5.0-windows' Or '$(TargetFramework)' == 'net6.0-windows'">
<PackageReference Include="System.Windows.Forms.DataVisualization" Version="1.0.0-prerelease.20110.1" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions Samples/TestPdfFileWriter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net472;netcoreapp3.1;net5.0-windows</TargetFrameworks>
<TargetFrameworks>net472;netcoreapp3.1;net5.0-windows;net6.0-windows</TargetFrameworks>
<AssemblyTitle>TestPdfFileWriter</AssemblyTitle>
<AssemblyName>TestPdfFileWriter</AssemblyName>
<AssemblyVersion>1.28.0</AssemblyVersion>
Expand All @@ -26,7 +26,7 @@
<ItemGroup Condition="'$(TargetFramework)' == 'net472' Or '$(TargetFramework)' == 'net48'">
<Reference Include="System.Windows.Forms.DataVisualization" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' Or '$(TargetFramework)' == 'net5.0-windows'">
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' Or '$(TargetFramework)' == 'net5.0-windows' Or '$(TargetFramework)' == 'net6.0-windows'">
<PackageReference Include="System.Windows.Forms.DataVisualization" Version="1.0.0-prerelease.20110.1" />
</ItemGroup>

Expand Down

0 comments on commit 267f77c

Please sign in to comment.