2025-07-27 17:51:50 -05:00
|
|
|
using LANCommander.Server.ImportExport.Importers;
|
2025-04-12 20:05:32 -05:00
|
|
|
|
2025-07-27 17:51:50 -05:00
|
|
|
namespace LANCommander.Server.ImportExport.Services;
|
2025-04-12 20:05:32 -05:00
|
|
|
|
2025-07-25 17:57:33 -05:00
|
|
|
public class ImportService : IDisposable
|
2025-04-12 20:05:32 -05:00
|
|
|
{
|
2025-07-25 17:57:33 -05:00
|
|
|
private Dictionary<Guid, ImportContext> ImportContexts = new();
|
2025-04-12 20:05:32 -05:00
|
|
|
|
2025-07-25 17:57:33 -05:00
|
|
|
public Guid EnqueueContext(ImportContext context)
|
2025-04-12 20:05:32 -05:00
|
|
|
{
|
2025-07-25 17:57:33 -05:00
|
|
|
var id = Guid.NewGuid();
|
2025-04-12 20:05:32 -05:00
|
|
|
|
2025-07-25 17:57:33 -05:00
|
|
|
ImportContexts.Add(id, context);
|
|
|
|
|
|
|
|
|
|
return id;
|
2025-04-12 20:05:32 -05:00
|
|
|
}
|
|
|
|
|
|
2025-07-25 17:57:33 -05:00
|
|
|
public ImportContext GetContext(Guid id)
|
2025-04-12 20:05:32 -05:00
|
|
|
{
|
2025-07-25 17:57:33 -05:00
|
|
|
if (ImportContexts.TryGetValue(id, out var context))
|
|
|
|
|
return context;
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-12 20:05:32 -05:00
|
|
|
public void Dispose()
|
|
|
|
|
{
|
|
|
|
|
// TODO release managed resources here
|
|
|
|
|
}
|
|
|
|
|
}
|