Skip to content

Commit ce352b5

Browse files
committed
* Fix errors
1 parent 1fdd103 commit ce352b5

6 files changed

Lines changed: 44 additions & 7 deletions

File tree

Source/Krypton Toolkit/Krypton.Toolkit.Suite.Extended.Buttons/Krypton.Toolkit.Suite.Extended.Buttons 2022.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@
102102
</Otherwise>
103103
</Choose>
104104

105+
<ItemGroup>
106+
<Compile Include="..\Krypton.Toolkit.Suite.Extended.Common\Utilities\AllowNullAttribute.cs" Link="General\AllowNullAttribute.cs" />
107+
</ItemGroup>
108+
105109
<ItemGroup>
106110
<PackageReference Include="WindowsAPICodePackShell" Version="8.0.15.2" />
107111

Source/Krypton Toolkit/Krypton.Toolkit.Suite.Extended.CheckSum.Tools/Classes/HashingHelpers.cs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ public static SafeNETCoreAndNewerSupportedHashAlgorithims ReturnHashType(string
9191

9292
public static string BuildMD5HashString(byte[]? hashBytes)
9393
{
94-
ArgumentNullException.ThrowIfNull(hashBytes);
94+
if (hashBytes is null)
95+
{
96+
throw new ArgumentNullException(nameof(hashBytes));
97+
}
9598

9699
// Set aside 32 bits in memory, for the total string length of the MD5 hash
97100
StringBuilder builder = new StringBuilder(32);
@@ -106,7 +109,10 @@ public static string BuildMD5HashString(byte[]? hashBytes)
106109

107110
public static string BuildSHA1HashString(byte[]? hashBytes)
108111
{
109-
ArgumentNullException.ThrowIfNull(hashBytes);
112+
if (hashBytes is null)
113+
{
114+
throw new ArgumentNullException(nameof(hashBytes));
115+
}
110116

111117
// Set aside 40 bits in memory, for the total string length of the SHA-1 hash
112118
StringBuilder builder = new StringBuilder(40);
@@ -121,7 +127,10 @@ public static string BuildSHA1HashString(byte[]? hashBytes)
121127

122128
public static string BuildSHA256HashString(byte[]? hashBytes)
123129
{
124-
ArgumentNullException.ThrowIfNull(hashBytes);
130+
if (hashBytes is null)
131+
{
132+
throw new ArgumentNullException(nameof(hashBytes));
133+
}
125134

126135
// Set aside 64 bits in memory, for the total string length of the SHA-256 hash
127136
StringBuilder builder = new StringBuilder(64);
@@ -136,7 +145,10 @@ public static string BuildSHA256HashString(byte[]? hashBytes)
136145

137146
public static string BuildSHA384HashString(byte[]? hashBytes)
138147
{
139-
ArgumentNullException.ThrowIfNull(hashBytes);
148+
if (hashBytes is null)
149+
{
150+
throw new ArgumentNullException(nameof(hashBytes));
151+
}
140152

141153
// Set aside 96 bits in memory, for the total string length of the SHA-384 hash
142154
StringBuilder builder = new StringBuilder(96);
@@ -151,7 +163,10 @@ public static string BuildSHA384HashString(byte[]? hashBytes)
151163

152164
public static string BuildSHA512HashString(byte[]? hashBytes)
153165
{
154-
ArgumentNullException.ThrowIfNull(hashBytes);
166+
if (hashBytes is null)
167+
{
168+
throw new ArgumentNullException(nameof(hashBytes));
169+
}
155170

156171
// Set aside 128 bits in memory, for the total string length of the SHA-512 hash
157172
StringBuilder builder = new StringBuilder(128);
@@ -166,7 +181,10 @@ public static string BuildSHA512HashString(byte[]? hashBytes)
166181

167182
public static string BuildRIPEMD160HashString(byte[]? hashBytes)
168183
{
169-
ArgumentNullException.ThrowIfNull(hashBytes);
184+
if (hashBytes is null)
185+
{
186+
throw new ArgumentNullException(nameof(hashBytes));
187+
}
170188

171189
// Set aside 40 bits in memory, for the total string length of the RIPEMD-160 hash
172190
StringBuilder builder = new StringBuilder(40);

Source/Krypton Toolkit/Krypton.Toolkit.Suite.Extended.Core/Classes/Security/RandomPassword.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,14 @@ public class RandomPassword
144144
byte[] randomBytes = new byte[4];
145145

146146
// Generate 4 random bytes.
147+
#if NETCOREAPP2_1_OR_GREATER
147148
System.Security.Cryptography.RandomNumberGenerator.Fill(randomBytes);
149+
#else
150+
using (var rng = System.Security.Cryptography.RandomNumberGenerator.Create())
151+
{
152+
rng.GetBytes(randomBytes);
153+
}
154+
#endif
148155

149156
// Convert 4 bytes into a 32-bit integer value.
150157
int seed = BitConverter.ToInt32(randomBytes, 0);

Source/Krypton Toolkit/Krypton.Toolkit.Suite.Extended.Error.Reporting/Krypton.Toolkit.Suite.Extended.Error.Reporting 2022.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
<PackageReference Include="System.Management" Version="11.0.0-preview.5.26302.115" />
118118
</ItemGroup>
119119

120-
<ItemGroup Condition="'$(TargetFramework)' == 'net462' Or '$(TargetFramework)' == 'net48' Or '$(TargetFramework)' == 'net481'">
120+
<ItemGroup Condition="'$(TargetFramework)' == 'net462' Or '$(TargetFramework)' == 'net472' Or '$(TargetFramework)' == 'net48' Or '$(TargetFramework)' == 'net481'">
121121
<Reference Include="System.Deployment" />
122122
<Reference Include="System.Net.Http">
123123
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.Net.Http.dll</HintPath>

Source/Krypton Toolkit/Krypton.Toolkit.Suite.Extended.Messagebox/Krypton.Toolkit.Suite.Extended.Messagebox 2022.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@
117117
<Nullable>enable</Nullable>
118118
</PropertyGroup>
119119

120+
<ItemGroup>
121+
<Compile Include="..\Krypton.Toolkit.Suite.Extended.Common\Utilities\AllowNullAttribute.cs" Link="General\AllowNullAttribute.cs" />
122+
</ItemGroup>
123+
120124
<ItemGroup>
121125
<Compile Update="Properties\Resources.Designer.cs">
122126
<DesignTime>True</DesignTime>

Source/Krypton Toolkit/Krypton.Toolkit.Suite.Extended.VirtualTreeColumnView/Krypton.Toolkit.Suite.Extended.VirtualTreeColumnView 2022.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@
117117
<Nullable>enable</Nullable>
118118
</PropertyGroup>
119119

120+
<ItemGroup>
121+
<Compile Include="..\Krypton.Toolkit.Suite.Extended.Common\Utilities\AllowNullAttribute.cs" Link="General\AllowNullAttribute.cs" />
122+
</ItemGroup>
123+
120124
<ItemGroup>
121125
<EditorConfigFiles Remove=".editorconfig" />
122126
</ItemGroup>

0 commit comments

Comments
 (0)