mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 22:26:31 +00:00
0c66607ed7
add user config queue offsets throttle improvements
23 lines
766 B
C#
23 lines
766 B
C#
using Azaion.CommonSecurity.DTO.Commands;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace Azaion.CommonSecurity.Services;
|
|
|
|
public interface IResourceLoader
|
|
{
|
|
MemoryStream LoadFile(string fileName, string? folder = null);
|
|
}
|
|
|
|
public class ResourceLoader([FromKeyedServices(SecurityConstants.EXTERNAL_INFERENCE_PATH)] IInferenceClient inferenceClient) : IResourceLoader
|
|
{
|
|
public MemoryStream LoadFile(string fileName, string? folder = null)
|
|
{
|
|
inferenceClient.Send(RemoteCommand.Create(CommandType.Load, new LoadFileData(fileName, folder)));
|
|
var bytes = inferenceClient.GetBytes(2, 3);
|
|
if (bytes == null)
|
|
throw new Exception($"Unable to receive {fileName}");
|
|
|
|
return new MemoryStream(bytes);
|
|
}
|
|
}
|