Manga Redesign (#321)
* Code cleanup, refactored FileRepository into Unit of Work. * Added AutoCloseMenu and ReaderMode user perferences to match UI * Added extra information to ChapterInfo * Build changes * Updated the readme to have open collective information and thanks to sponsors * Fixed an issue with UnitOfWork refactor and how stats was bootsrapped. Replaced stats.kavitareader with a temp url to test out redirection bug.
This commit is contained in:
parent
b958342394
commit
be2b78fa5a
40 changed files with 1608 additions and 87 deletions
30
API/Configurations/CustomOptions/StatsOptions.cs
Normal file
30
API/Configurations/CustomOptions/StatsOptions.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
|
||||
namespace API.Configurations.CustomOptions
|
||||
{
|
||||
public class StatsOptions
|
||||
{
|
||||
public string ServerUrl { get; set; }
|
||||
public string ServerSecret { get; set; }
|
||||
public string SendDataAt { get; set; }
|
||||
|
||||
private const char Separator = ':';
|
||||
|
||||
public short SendDataHour => GetValueFromSendAt(0);
|
||||
public short SendDataMinute => GetValueFromSendAt(1);
|
||||
|
||||
// The expected SendDataAt format is: Hour:Minute. Ex: 19:45
|
||||
private short GetValueFromSendAt(int index)
|
||||
{
|
||||
var key = $"{nameof(StatsOptions)}:{nameof(SendDataAt)}";
|
||||
|
||||
if (string.IsNullOrEmpty(SendDataAt))
|
||||
throw new InvalidOperationException($"{key} is invalid. Check the app settings file");
|
||||
|
||||
if (short.TryParse(SendDataAt.Split(Separator)[index], out var parsedValue))
|
||||
return parsedValue;
|
||||
|
||||
throw new InvalidOperationException($"Could not parse {key}. Check the app settings file");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue