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);