Skip to content

Commit

Permalink
Fixed various issues.
Browse files Browse the repository at this point in the history
includs:
- Adding back reference assemblies to the packages.
- syntax fixes to code.
- Adding ValueTuple package for .NET Framework.
- xml docs now should be fixed to pernamently never cause build errors.

Signed-off-by: AraHaan <[email protected]>
  • Loading branch information
AraHaan authored and Elskom-gitsync committed Mar 12, 2021
1 parent f434ac5 commit 97f7349
Show file tree
Hide file tree
Showing 28 changed files with 149 additions and 253 deletions.
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ updates:
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "nuget"
directory: "/"
schedule:
interval: "daily"
25 changes: 5 additions & 20 deletions BlowFish/BlowFish.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="PublishRefAssemblies.Sdk/1.0.3">

<PropertyGroup>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<TargetFrameworks>netcoreapp2.0;net5.0;netstandard2.0;netstandard2.1;net40</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0;net5.0;net40</TargetFrameworks>
<AssemblyName>BlowFish</AssemblyName>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<LangVersion>latest</LangVersion>
<Company>Els_kom org.</Company>
<Authors>Els_kom org.</Authors>
Expand All @@ -18,8 +17,6 @@
<PackageReleaseNotes>Reduced supported TargetFrameworks.</PackageReleaseNotes>
<Version>1.0.3</Version>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
<PublishDocumentationFile>true</PublishDocumentationFile>
<NeutralLanguage>en-US</NeutralLanguage>
<NoWarn>$(NoWarn);NU5104;NU5118</NoWarn>
<SignAssembly>true</SignAssembly>
Expand All @@ -42,21 +39,13 @@
<!-- <SymbolPackageFormat>snupkg</SymbolPackageFormat> -->
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
<RootNamespace>Elskom.Generic.Libs</RootNamespace>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
<OutputPath>bin\Any CPU\Debug\</OutputPath>
<DocumentationFile>bin\Any CPU\Debug\BlowFish.xml</DocumentationFile>
<OutputPath>bin\Any CPU\$(Configuration)\</OutputPath>
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>bin\Any CPU\Release\</OutputPath>
<DocumentationFile>bin\Any CPU\Release\BlowFish.xml</DocumentationFile>
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -90,10 +79,6 @@
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<Folder Include="BlowFish\" />
</ItemGroup>

<Import Project="../CommonPackages.props" />
<Import Project="../Sdk/GitBuildInfo.Task.targets" />

Expand Down
4 changes: 2 additions & 2 deletions BlowFish/BlowFish/BlowFish.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public string DecryptCBC(string ct)
}

this.IV = HexToByte(ct.Substring(0, 16));
#if NETCOREAPP || NETSTANDARD2_1 || NET5_0
#if !NETFRAMEWORK
return Encoding.ASCII.GetString(this.DecryptCBC(HexToByte(ct.Substring(16)))).Replace("\0", string.Empty, StringComparison.Ordinal);
#else
return Encoding.ASCII.GetString(this.DecryptCBC(HexToByte(ct.Substring(16)))).Replace("\0", string.Empty);
Expand Down Expand Up @@ -230,7 +230,7 @@ public string DecryptECB(string ct)
throw new ArgumentNullException(nameof(ct));
}

#if NETCOREAPP || NETSTANDARD2_1 || NET5_0
#if !NETFRAMEWORK
return Encoding.ASCII.GetString(this.Decrypt_ECB(HexToByte(ct))).Replace("\0", string.Empty, StringComparison.Ordinal);
#else
return Encoding.ASCII.GetString(this.Decrypt_ECB(HexToByte(ct))).Replace("\0", string.Empty);
Expand Down
6 changes: 6 additions & 0 deletions CommonPackages.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<Project>

<PropertyGroup>
<!-- suppress message when using the .NET Preview SDKs. -->
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
</PropertyGroup>

<ItemGroup>
<!-- Common Analyzers -->
<PackageReference Include="SecurityCodeScan.VS2019" Version="*-*">
Expand Down Expand Up @@ -27,6 +32,7 @@
<PackageReference Include="System.CommandLine" Version="*-*" Condition="'$(UseCommandLine)' != '' AND '$(UseCommandLine)' == 'true'" />
<PackageReference Include="System.Text.Json" Version="*-*" Condition="'$(UseJsonPackage)' != '' AND '$(UseJsonPackage)' == 'true'" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="*-*" Condition="'$(UseDependencyInjection)' != '' AND '$(UseDependencyInjection)' == 'true'" />
<PackageReference Include="System.ValueTuple" Version="*-*" Condition="$(TargetFramework.StartsWith('net4')) AND '$(UseValueTuple)' == 'true'" />
<!-- .NET Framework references. -->
<Reference Include="System.IO.Compression" Condition="$(TargetFramework.StartsWith('net4')) AND '$(TargetFramework)' != 'net40'" />
<Reference Include="System.Net.Http" Condition="$(TargetFramework.StartsWith('net4')) AND '$(TargetFramework)' != 'net40'" />
Expand Down
19 changes: 4 additions & 15 deletions GenericPluginLoader/GenericPluginLoader.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="PublishRefAssemblies.Sdk/1.0.3">

<PropertyGroup>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<TargetFrameworks>net5.0;net45</TargetFrameworks>
<AssemblyName>GenericPluginLoader</AssemblyName>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<LangVersion>latest</LangVersion>
<Company>Els_kom org.</Company>
<Authors>Els_kom org.</Authors>
Expand All @@ -18,8 +17,6 @@
<PackageReleaseNotes>Removed ability to force load pdbs as it was not needed. Also loads each plugin into a separate AppDomain on .NET Framework builds, while using AssemblyLoadContexts for .NET 5 or newer builds.</PackageReleaseNotes>
<Version>2.0.0</Version>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
<PublishDocumentationFile>true</PublishDocumentationFile>
<NeutralLanguage>en-US</NeutralLanguage>
<NoWarn>$(NoWarn);NU5104;NU5118</NoWarn>
<SignAssembly>true</SignAssembly>
Expand All @@ -41,21 +38,13 @@
<!-- <IncludeBuildOutput>true</IncludeBuildOutput> -->
<!-- <SymbolPackageFormat>snupkg</SymbolPackageFormat> -->
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
<OutputPath>bin\Any CPU\Debug\</OutputPath>
<DocumentationFile>bin\Any CPU\Debug\GenericPluginLoader.xml</DocumentationFile>
<OutputPath>bin\Any CPU\$(Configuration)\</OutputPath>
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>bin\Any CPU\Release\</OutputPath>
<DocumentationFile>bin\Any CPU\Release\GenericPluginLoader.xml</DocumentationFile>
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand Down
50 changes: 40 additions & 10 deletions GenericPluginLoader/GenericPluginLoader/GenericPluginLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,41 +123,71 @@ public ICollection<T> LoadPlugins(string path, out List<AppDomain> domains, bool
catch (BadImageFormatException)
{
// ignore the error and load the other files.
#if NET5_0_OR_GREATER
context.Unload();
#else
AppDomain.Unload(domain);
#endif
}
catch (FileLoadException)
{
#if NET5_0_OR_GREATER
var assembly = context.LoadFromAssemblyPath(dllFile);
contexts.Add(context);
assemblies.Add(assembly);
#elif NET45
var assembly = domain.Load(File.ReadAllBytes(dllFile));
#else
try
{
var assembly = domain.Load(AssemblyName.GetAssemblyName(dllFile));
domains.Add(domain);
assemblies.Add(assembly);
}
catch (Exception)
{
// ignore the error and load the other files.
AppDomain.Unload(domain);
}
#elif !NET45
var assembly = Assembly.LoadFrom(dllFile);
#endif
domains.Add(domain);
assemblies.Add(assembly);
#endif
}
catch (FileNotFoundException)
{
// ignore the error and load other files.
#if NET5_0_OR_GREATER
context.Unload();
#else
AppDomain.Unload(domain);
#endif
}
}
}

if (saveToZip && File.Exists(zippath))
{
using var zipFile = ZipFile.OpenRead(zippath);
foreach (var entry in zipFile.Entries)
var filesInZip = new Dictionary<string, int>();
using (var zipFile = ZipFile.OpenRead(zippath))
{
foreach (var entry in zipFile.Entries)
{
filesInZip.Add(entry.FullName, zipFile.Entries.IndexOf(entry));
}
}

foreach (var entry in filesInZip.Keys)
{
// just lookup the dlls here. The LoadFromZip method will load the pdb’s if they are deemed needed.
if (entry.FullName.EndsWith(".dll", StringComparison.Ordinal))
if (entry.EndsWith(".dll", StringComparison.Ordinal))
{
#if NET5_0_OR_GREATER
var context = new PluginLoadContext($"ZipPlugin#{zipFile.Entries.IndexOf(entry)}", path);
var assembly = ZipAssembly.LoadFromZip(zippath, entry.FullName, context);
var context = new PluginLoadContext($"ZipPlugin#{filesInZip[entry]}", path);
var assembly = ZipAssembly.LoadFromZip(zippath, entry, context);
contexts.Add(context);
#else
var domain = AppDomain.CreateDomain($"ZipPlugin#{zipFile.Entries.IndexOf(entry)}");
var assembly = ZipAssembly.LoadFromZip(zippath, entry.FullName, domain);
var domain = AppDomain.CreateDomain($"ZipPlugin#{filesInZip[entry]}");
var assembly = ZipAssembly.LoadFromZip(zippath, entry, domain);
domains.Add(domain);
#endif
if (assembly != null)
Expand Down
21 changes: 5 additions & 16 deletions GitInformation/src/GitInformation/Elskom.GitInformation.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="PublishRefAssemblies.Sdk/1.0.3">

<PropertyGroup>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<TargetFrameworks>netstandard2.0;netcoreapp2.0;net5.0;net40</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0;net5.0;net40</TargetFrameworks>
<AssemblyName>Elskom.GitInformation</AssemblyName>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<LangVersion>latest</LangVersion>
<Company>Els_kom org.</Company>
<Authors>Els_kom org.</Authors>
Expand All @@ -19,8 +18,6 @@
<PackageReleaseNotes>Initial Release.</PackageReleaseNotes>
<Version>1.0.0</Version>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
<PublishDocumentationFile>true</PublishDocumentationFile>
<NeutralLanguage>en-US</NeutralLanguage>
<NoWarn>$(NoWarn);NU5104;NU5118</NoWarn>
<SignAssembly>true</SignAssembly>
Expand All @@ -41,21 +38,13 @@
<!-- <IncludeBuildOutput>true</IncludeBuildOutput> -->
<!-- <SymbolPackageFormat>snupkg</SymbolPackageFormat> -->
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>$(DefineConstants);DEBUG;TRACE</DefineConstants>
<OutputPath>bin\Any CPU\Debug\</OutputPath>
<DocumentationFile>bin\Any CPU\Debug\Elskom.GitInformation.xml</DocumentationFile>
<OutputPath>bin\Any CPU\$(Configuration)\</OutputPath>
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>bin\Any CPU\Release\</OutputPath>
<DocumentationFile>bin\Any CPU\Release\Elskom.GitInformation.xml</DocumentationFile>
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>$(DefineConstants);DEBUG;TRACE</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class MessageEventArgs : EventArgs
/// </summary>
/// <param name="text">The text for the message.</param>
/// <param name="caption">The title (caption) for the message.</param>
/// <param name="errorlevel">The error level for the message, or None for no error level information.</param>
/// <param name="errorlevel">The error level for the message, or <see cref="ErrorLevel.None"/> for no error level information.</param>
public MessageEventArgs(string text, string caption, ErrorLevel errorlevel)
{
this.Text = text;
Expand Down
19 changes: 4 additions & 15 deletions MessageManager/MessageManager.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="PublishRefAssemblies.Sdk/1.0.3">

<PropertyGroup>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<TargetFrameworks>net40;netcoreapp3.0;netcoreapp3.1;net5.0-windows</TargetFrameworks>
<AssemblyName>MessageManager</AssemblyName>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<LangVersion>latest</LangVersion>
<Company>Els_kom org.</Company>
<Authors>Els_kom org.</Authors>
Expand All @@ -18,8 +17,6 @@
<PackageReleaseNotes>Reduced supported TargetFrameworks and changed a few methods from static to non-static.</PackageReleaseNotes>
<Version>2.0.0</Version>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
<PublishDocumentationFile>true</PublishDocumentationFile>
<NeutralLanguage>en-US</NeutralLanguage>
<NoWarn>$(NoWarn);NU5104;NU5118</NoWarn>
<SignAssembly>true</SignAssembly>
Expand All @@ -42,21 +39,13 @@
<!-- <SymbolPackageFormat>snupkg</SymbolPackageFormat> -->
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>$(DefineConstants);DEBUG;TRACE</DefineConstants>
<OutputPath>bin\Any CPU\Debug\</OutputPath>
<DocumentationFile>bin\Any CPU\Debug\MessageManager.xml</DocumentationFile>
<OutputPath>bin\Any CPU\$(Configuration)\</OutputPath>
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>bin\Any CPU\Release\</OutputPath>
<DocumentationFile>bin\Any CPU\Release\MessageManager.xml</DocumentationFile>
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>$(DefineConstants);DEBUG;TRACE</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand Down
19 changes: 4 additions & 15 deletions MiniDump/MiniDump.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="PublishRefAssemblies.Sdk/1.0.3">

<PropertyGroup>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<TargetFrameworks>netcoreapp2.0;net5.0;net471</TargetFrameworks>
<AssemblyName>MiniDump</AssemblyName>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<LangVersion>latest</LangVersion>
<Company>Els_kom org.</Company>
<Authors>Els_kom org.</Authors>
Expand All @@ -18,8 +17,6 @@
<PackageReleaseNotes>Removed usage of Windows Forms entirely.</PackageReleaseNotes>
<Version>2.0.0</Version>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
<PublishDocumentationFile>true</PublishDocumentationFile>
<NeutralLanguage>en-US</NeutralLanguage>
<NoWarn>$(NoWarn);NU5104;NU5118</NoWarn>
<SignAssembly>true</SignAssembly>
Expand All @@ -41,21 +38,13 @@
<!-- <IncludeBuildOutput>true</IncludeBuildOutput> -->
<!-- <SymbolPackageFormat>snupkg</SymbolPackageFormat> -->
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>$(DefineConstants);DEBUG;TRACE</DefineConstants>
<OutputPath>bin\Any CPU\Debug\</OutputPath>
<DocumentationFile>bin\Any CPU\Debug\MiniDump.xml</DocumentationFile>
<OutputPath>bin\Any CPU\$(Configuration)\</OutputPath>
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>bin\Any CPU\Release\</OutputPath>
<DocumentationFile>bin\Any CPU\Release\MiniDump.xml</DocumentationFile>
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>$(DefineConstants);DEBUG;TRACE</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="($(TargetFramework.StartsWith('net4')) OR $(TargetFramework.EndsWith('app3.0')) OR $(TargetFramework.EndsWith('app3.1')) OR '$(TargetFramework)' == 'net5.0') AND !$(TargetFramework.StartsWith('netstandard'))">
Expand Down
Loading

0 comments on commit 97f7349

Please sign in to comment.