48 lines
1.2 KiB
C#
48 lines
1.2 KiB
C#
using skyscraper8.Skyscraper.Scraper.Storage;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Voile.Common.Reflection;
|
|
using Voile.Patchouli.Data;
|
|
using Voile.Patchouli.Reflection;
|
|
|
|
namespace Voile.Persistence
|
|
{
|
|
[VoilePlugin]
|
|
[VoilePluginId(1)]
|
|
[Voile.Patchouli.Reflection.DisplayName("File-system folder")]
|
|
class DirectoryStorageFactory : IVoileDataStorageFactory, IVoileObjectStorageFactory
|
|
{
|
|
public override bool Equals(object? obj)
|
|
{
|
|
DirectoryStorageFactory dsf = obj as DirectoryStorageFactory
|
|
if (dsf == null)
|
|
return false;
|
|
|
|
return dsf.Directory.Equals(this.Directory);
|
|
}
|
|
|
|
IVoileDataStorage IVoileDataStorageFactory.CreateDataStorage()
|
|
{
|
|
return new DirectoryStorage(Directory);
|
|
}
|
|
|
|
IVoileObjectStorage IVoileObjectStorageFactory.CreateObjectStorage()
|
|
{
|
|
return new DirectoryStorage(Directory);
|
|
}
|
|
|
|
public bool IsEquipvalentDataStorageFactory(IVoileDataStorageFactory dataStorageFactory)
|
|
{
|
|
return Equals(dataStorageFactory);
|
|
}
|
|
|
|
[System.ComponentModel.DisplayName("Path")]
|
|
[System.ComponentModel.Description("The Path in which data should be stored.")]
|
|
public DirectoryInfo Directory { get; set; }
|
|
}
|
|
}
|