Skip to content

Commit

Permalink
winforms not successful
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Feb 6, 2025
1 parent 35bf9a6 commit 328a17d
Show file tree
Hide file tree
Showing 11 changed files with 612 additions and 49 deletions.
8 changes: 8 additions & 0 deletions AquaMai.Mods/AquaMai.Mods.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Runtime" />
<Reference Include="System.Security" />
<Reference Include="System.Xml" />
Expand Down Expand Up @@ -122,6 +123,7 @@
</ItemGroup>

<ItemGroup>
<Reference Include="System.Windows.Forms" Private="true" />
<Reference Include="System.Numerics" Private="true" />
</ItemGroup>

Expand All @@ -132,10 +134,16 @@
</PackageReference>
<PackageReference Include="hidlibrary" Version="3.3.40" />
<PackageReference Include="ILMerge.Fody" Version="1.24.0" />
<PackageReference Include="Matt.Encoding.Fountain" Version="1.1.5" />
<PackageReference Include="QRCoder" Version="1.6.0" />
</ItemGroup>

<ItemGroup>
<Content Include="FodyWeavers.xml" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Utils\CrashHandler\CrashForm.resx" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion AquaMai.Mods/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ILMerge>
<IncludeAssemblies>hidlibrary|Numerics</IncludeAssemblies>
<IncludeAssemblies>hidlibrary|Numerics|Windows\.Forms|QRCoder|Fountain</IncludeAssemblies>
<NamespacePrefix>$AquaMai.Mods$_</NamespacePrefix>
</ILMerge>
</Weavers>
29 changes: 29 additions & 0 deletions AquaMai.Mods/Utils/CrashHandler/ChecksumCalculator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
namespace AquaMai.ErrorReport;

public class ChecksumCalculator
{
private static readonly uint[] CrcTable = new uint[256];

static ChecksumCalculator()
{
for (uint i = 0; i < 256; i++)
{
uint crc = i;
for (int j = 0; j < 8; j++)
{
crc = (crc & 1) != 0 ? (0xEDB88320 ^ (crc >> 1)) : (crc >> 1);
}
CrcTable[i] = crc;
}
}

public static uint GetChecksum(byte[] data, uint k)
{
uint crc = 0xFFFFFFFF; // Initial value
foreach (byte b in data)
{
crc = (crc >> 8) ^ CrcTable[(crc ^ b) & 0xFF];
}
return (crc ^ k ^ 0xFFFFFFFF); // Final XOR value and ensure 32-bit unsigned
}
}
147 changes: 147 additions & 0 deletions AquaMai.Mods/Utils/CrashHandler/CrashForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 328a17d

Please sign in to comment.