rework to Azaion.Suite, show tabs with annotator and dataset explorer

This commit is contained in:
Alex Bezdieniezhnykh
2024-11-23 08:53:12 +02:00
parent 490e90f239
commit 3b40bd601e
40 changed files with 374 additions and 284 deletions
+22
View File
@@ -0,0 +1,22 @@
using System.IO;
namespace Azaion.Common.Services;
public interface IResourceLoader
{
Task<MemoryStream> Load(string fileName, CancellationToken cancellationToken = default);
}
public class ResourceLoader(string email, string password, AzaionApiClient api, IHardwareService hardwareService) : IResourceLoader
{
public async Task<MemoryStream> Load(string fileName, CancellationToken cancellationToken = default)
{
var hardwareInfo = await hardwareService.GetHardware();
var encryptedStream = await api.GetResource(fileName, password, hardwareInfo);
var key = Security.MakeEncryptionKey(email, password, hardwareInfo.Hash);
var stream = new MemoryStream();
await encryptedStream.DecryptTo(stream, key, cancellationToken);
return stream;
}
}