Update UI & Syncshell Public & MCDF Share
This commit is contained in:
@@ -11,6 +11,7 @@ using MareSynchronos.Services.CharaData.Models;
|
||||
using MareSynchronos.Utils;
|
||||
using MareSynchronos.WebAPI.Files;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Threading;
|
||||
|
||||
namespace MareSynchronos.Services;
|
||||
|
||||
@@ -295,6 +296,32 @@ public sealed class CharaDataFileHandler : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
internal async Task<byte[]?> CreateCharaFileBytesAsync(string description, CancellationToken token = default)
|
||||
{
|
||||
var tempFilePath = Path.Combine(Path.GetTempPath(), "umbra_mcdfshare_" + Guid.NewGuid().ToString("N") + ".mcdf");
|
||||
try
|
||||
{
|
||||
await SaveCharaFileAsync(description, tempFilePath).ConfigureAwait(false);
|
||||
if (!File.Exists(tempFilePath)) return null;
|
||||
token.ThrowIfCancellationRequested();
|
||||
return await File.ReadAllBytesAsync(tempFilePath, token).ConfigureAwait(false);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(tempFilePath))
|
||||
{
|
||||
File.Delete(tempFilePath);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal async Task<List<string>> UploadFiles(List<string> fileList, ValueProgress<string> uploadProgress, CancellationToken token)
|
||||
{
|
||||
return await _fileUploadManager.UploadFiles(fileList, uploadProgress, token).ConfigureAwait(false);
|
||||
|
||||
Reference in New Issue
Block a user