Show startmessage and log settings

This commit is contained in:
glax 2023-09-19 16:06:56 +02:00
parent 88ca75e883
commit ba27adf255
2 changed files with 15 additions and 2 deletions

View File

@ -13,6 +13,8 @@ public partial class Tranga : GlobalBase
public Tranga(Logger? logger, TrangaSettings settings) : base(logger, settings)
{
Log("\n\n _______ \n|_ _|.----..---.-..-----..-----..---.-.\n | | | _|| _ || || _ || _ |\n |___| |__| |___._||__|__||___ ||___._|\n |_____| \n\n");
Log(settings.ToString());
keepRunning = true;
_connectors = new HashSet<MangaConnector>()
{

View File

@ -23,13 +23,13 @@ public class TrangaSettings
string lockFilePath = $"{settingsFilePath}.lock";
if (File.Exists(settingsFilePath) && !File.Exists(lockFilePath))
{//Load from settings file
FileStream lockFile = File.Create(lockFilePath,0, FileOptions.DeleteOnClose);
FileStream lockFile = File.Create(lockFilePath,0, FileOptions.DeleteOnClose); //lock settingsfile
string settingsStr = File.ReadAllText(settingsFilePath);
TrangaSettings settings = JsonConvert.DeserializeObject<TrangaSettings>(settingsStr)!;
this.downloadLocation = downloadLocation ?? settings.downloadLocation;
this.workingDirectory = workingDirectory ?? settings.workingDirectory;
this.apiPortNumber = apiPortNumber ?? settings.apiPortNumber;
lockFile.Close();
lockFile.Close(); //unlock settingsfile
}
else if(!File.Exists(settingsFilePath))
{//No settings file exists
@ -132,4 +132,15 @@ public class TrangaSettings
{
return Path.Join(this.coverImageCache, manga.coverFileNameInCache);
}
public override string ToString()
{
return $"TrangaSettings:\n" +
$"\tDownloadLocation: {downloadLocation}\n" +
$"\tworkingDirectory: {workingDirectory}\n" +
$"\tjobsFolderPath: {jobsFolderPath}\n" +
$"\tsettingsFilePath: {settingsFilePath}\n" +
$"\t\tnotificationConnectors: {notificationConnectorsFilePath}\n" +
$"\t\tlibraryConnectors: {libraryConnectorsFilePath}\n";
}
}