mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-05-31 12:14:44 -04:00
* Implemented methods to parse out the whole ComicInfo file and a mock ComicInfo from epub files. * Removed unused imports. ScanSeries needs to cleanup deleted chapters and call RefreshMetadata. Ensure after scan we cleanup tags without any series. * Random cleanup * Added some comments about data getting stale and not updating. * Removed old Summary methods in favor of the ComicInfo versions * Added a missing property * Fixed unit test
49 lines
1.8 KiB
C#
49 lines
1.8 KiB
C#
using System.Collections.Generic;
|
|
using API.DTOs.Settings;
|
|
using API.Entities;
|
|
using API.Entities.Enums;
|
|
using AutoMapper;
|
|
|
|
namespace API.Helpers.Converters
|
|
{
|
|
public class ServerSettingConverter : ITypeConverter<IEnumerable<ServerSetting>, ServerSettingDto>
|
|
{
|
|
public ServerSettingDto Convert(IEnumerable<ServerSetting> source, ServerSettingDto destination, ResolutionContext context)
|
|
{
|
|
destination ??= new ServerSettingDto();
|
|
foreach (var row in source)
|
|
{
|
|
switch (row.Key)
|
|
{
|
|
case ServerSettingKey.CacheDirectory:
|
|
destination.CacheDirectory = row.Value;
|
|
break;
|
|
case ServerSettingKey.TaskScan:
|
|
destination.TaskScan = row.Value;
|
|
break;
|
|
case ServerSettingKey.LoggingLevel:
|
|
destination.LoggingLevel = row.Value;
|
|
break;
|
|
case ServerSettingKey.TaskBackup:
|
|
destination.TaskBackup = row.Value;
|
|
break;
|
|
case ServerSettingKey.Port:
|
|
destination.Port = int.Parse(row.Value);
|
|
break;
|
|
case ServerSettingKey.AllowStatCollection:
|
|
destination.AllowStatCollection = bool.Parse(row.Value);
|
|
break;
|
|
case ServerSettingKey.EnableOpds:
|
|
destination.EnableOpds = bool.Parse(row.Value);
|
|
break;
|
|
case ServerSettingKey.EnableAuthentication:
|
|
destination.EnableAuthentication = bool.Parse(row.Value);
|
|
break;
|
|
}
|
|
}
|
|
|
|
return destination;
|
|
}
|
|
}
|
|
}
|