|
|
|
|
@ -4,6 +4,9 @@ |
|
|
|
|
|
|
|
|
|
using System.Threading; |
|
|
|
|
using System.Threading.Tasks; |
|
|
|
|
using GBase.DataHandling.Factories; |
|
|
|
|
using GBase.Interfaces.DataHandling; |
|
|
|
|
using GBase.Interfaces.DataHandling.Xml; |
|
|
|
|
using GBase.Interfaces.FileHandling; |
|
|
|
|
|
|
|
|
|
namespace GBase.FileHandling |
|
|
|
|
@ -13,6 +16,22 @@ namespace GBase.FileHandling |
|
|
|
|
/// </summary> |
|
|
|
|
public class FileHandler : IFileHandler |
|
|
|
|
{ |
|
|
|
|
private readonly IXmlDataHandlerFactory _dataHandlerFactory; |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Internal file handler |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="xmlDataHandlerFactory">Factory for the <see cref="IXmlDataHandler"/></param> |
|
|
|
|
public FileHandler(IXmlDataHandlerFactory xmlDataHandlerFactory) |
|
|
|
|
{ |
|
|
|
|
_dataHandlerFactory = xmlDataHandlerFactory; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// The <see cref="IDataHandler"/> of this <see cref="IFileHandler"/> |
|
|
|
|
/// </summary> |
|
|
|
|
private IDataHandler DataHandler { get; set; } |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// Initialize this <see cref="IFileHandler"/> |
|
|
|
|
/// </summary> |
|
|
|
|
@ -21,7 +40,10 @@ namespace GBase.FileHandling |
|
|
|
|
/// <returns>True if successful, false if not</returns> |
|
|
|
|
public async Task<bool> Init(string path, CancellationToken cancellationToken) |
|
|
|
|
{ |
|
|
|
|
throw new System.NotImplementedException(); |
|
|
|
|
DataHandler = _dataHandlerFactory.Create(); |
|
|
|
|
|
|
|
|
|
bool success = await DataHandler.Init(false, cancellationToken); |
|
|
|
|
return success; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
@ -30,7 +52,7 @@ namespace GBase.FileHandling |
|
|
|
|
/// <returns>A <see cref="ValueTask"/> to await</returns> |
|
|
|
|
public async ValueTask DisposeAsync() |
|
|
|
|
{ |
|
|
|
|
throw new System.NotImplementedException(); |
|
|
|
|
await DataHandler.DisposeAsync(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |