This commit is contained in:
skidoodle 2024-03-13 00:33:46 +01:00
commit e124a47765
19374 changed files with 9806149 additions and 0 deletions

View file

@ -0,0 +1,10 @@
using System.Configuration;
namespace Kreta.Core.FileService.Configuration
{
public class FileServiceConfiguration : ConfigurationSection, IFileServiceConfiguration
{
[ConfigurationProperty("", IsDefaultCollection = true)]
public StorageElementCollection Storages => (StorageElementCollection)base[string.Empty];
}
}

View file

@ -0,0 +1,7 @@
namespace Kreta.Core.FileService.Configuration
{
public interface IFileServiceConfiguration
{
StorageElementCollection Storages { get; }
}
}

View file

@ -0,0 +1,10 @@
using System.Configuration;
namespace Kreta.Core.FileService.Configuration
{
public class Path : ConfigurationElement
{
[ConfigurationProperty(nameof(Value), IsRequired = true, IsKey = true)]
public string Value => (string)this[nameof(Value)];
}
}

View file

@ -0,0 +1,15 @@
using System.Configuration;
namespace Kreta.Core.FileService.Configuration
{
public class PathElementCollection : ConfigurationElementCollection
{
protected override string ElementName => nameof(Path);
protected override ConfigurationElement CreateNewElement() => new Path();
protected override object GetElementKey(ConfigurationElement element) => ((Path)element).Value;
public override ConfigurationElementCollectionType CollectionType => ConfigurationElementCollectionType.BasicMap;
}
}

View file

@ -0,0 +1,19 @@
using System.Configuration;
namespace Kreta.Core.FileService.Configuration
{
public class Storage : ConfigurationElement
{
[ConfigurationProperty(nameof(Key), IsRequired = true, IsKey = true)]
public string Key => (string)this[nameof(Key)];
[ConfigurationProperty(nameof(MaxFileSizeInBytes), IsRequired = true)]
public int MaxFileSizeInBytes => (int)this[nameof(MaxFileSizeInBytes)];
[ConfigurationProperty(nameof(MinimumRequiredFreeSpaceInBytes), IsRequired = true)]
public int MinimumRequiredFreeSpaceInBytes => (int)this[nameof(MinimumRequiredFreeSpaceInBytes)];
[ConfigurationProperty(nameof(Paths), IsDefaultCollection = false)]
public PathElementCollection Paths => (PathElementCollection)base[nameof(Paths)];
}
}

View file

@ -0,0 +1,15 @@
using System.Configuration;
namespace Kreta.Core.FileService.Configuration
{
public class StorageElementCollection : ConfigurationElementCollection
{
protected override string ElementName => nameof(Storage);
protected override ConfigurationElement CreateNewElement() => new Storage();
protected override object GetElementKey(ConfigurationElement element) => ((Storage)element).Key;
public override ConfigurationElementCollectionType CollectionType => ConfigurationElementCollectionType.BasicMap;
}
}