Add MCDO (#31)

* rudimentary charadata first impl

* update submodule

* update properly

* some fixes etc

* add cascade and some other fixes

* most of charadata impl

* dotnet 9

* net9 and migration to k4os

* bum papi

---------

Co-authored-by: Stanley Dimant <root.darkarchon@outlook.com>
This commit is contained in:
rootdarkarchon
2025-01-11 22:42:55 +01:00
committed by GitHub
parent 1379ced836
commit cc89882bbc
30 changed files with 6895 additions and 99 deletions

View File

@@ -1,4 +1,4 @@
using LZ4;
using K4os.Compression.LZ4.Legacy;
using MareSynchronos.API.Dto.Files;
using MareSynchronos.API.Routes;
using MareSynchronos.API.SignalR;
@@ -216,7 +216,7 @@ public class ServerFilesController : ControllerBase
await Request.Body.CopyToAsync(compressedFileStream, requestAborted).ConfigureAwait(false);
// decompress and copy the decompressed stream to memory
var data = LZ4Codec.Unwrap(compressedFileStream.ToArray());
var data = LZ4Wrapper.Unwrap(compressedFileStream.ToArray());
// reset streams
compressedFileStream.Seek(0, SeekOrigin.Begin);
@@ -323,7 +323,7 @@ public class ServerFilesController : ControllerBase
MungeBuffer(unmungedFile.AsSpan());
// decompress and copy the decompressed stream to memory
var data = LZ4Codec.Unwrap(unmungedFile);
var data = LZ4Wrapper.Unwrap(unmungedFile);
// compute hash to verify
var hashString = BitConverter.ToString(SHA1.HashData(data))
@@ -442,7 +442,7 @@ public class ServerFilesController : ControllerBase
// save file
var path = FilePathUtil.GetFilePath(_basePath, hash);
using var fileStream = new FileStream(path, FileMode.Create);
var lz4 = LZ4Codec.WrapHC(rawFileStream.ToArray(), 0, (int)rawFileStream.Length);
var lz4 = LZ4Wrapper.WrapHC(rawFileStream.ToArray(), 0, (int)rawFileStream.Length);
using var compressedStream = new MemoryStream(lz4);
await compressedStream.CopyToAsync(fileStream).ConfigureAwait(false);

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
@@ -22,12 +22,12 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="lz4net" Version="1.0.15.93" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.176">
<PackageReference Include="K4os.Compression.LZ4.Legacy" Version="1.3.8" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.184">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="9.0.0" />
</ItemGroup>
<ItemGroup>

View File

@@ -1,5 +1,5 @@
using ByteSizeLib;
using LZ4;
using K4os.Compression.LZ4.Legacy;
using MareSynchronosShared.Data;
using MareSynchronosShared.Metrics;
using MareSynchronosShared.Models;
@@ -270,7 +270,7 @@ public class MainFileCleanupService : IHostedService
{
try
{
var length = LZ4Codec.Unwrap(File.ReadAllBytes(file.FullName)).LongLength;
var length = LZ4Wrapper.Unwrap(File.ReadAllBytes(file.FullName)).LongLength;
_logger.LogInformation("Setting Raw File Size of " + fileCache.Hash + " to " + length);
fileCache.RawSize = length;
if (fileCounter % 1000 == 0)