Show startmessage and log settings
This commit is contained in:
parent
88ca75e883
commit
ba27adf255
@ -13,6 +13,8 @@ public partial class Tranga : GlobalBase
|
|||||||
|
|
||||||
public Tranga(Logger? logger, TrangaSettings settings) : base(logger, settings)
|
public Tranga(Logger? logger, TrangaSettings settings) : base(logger, settings)
|
||||||
{
|
{
|
||||||
|
Log("\n\n _______ \n|_ _|.----..---.-..-----..-----..---.-.\n | | | _|| _ || || _ || _ |\n |___| |__| |___._||__|__||___ ||___._|\n |_____| \n\n");
|
||||||
|
Log(settings.ToString());
|
||||||
keepRunning = true;
|
keepRunning = true;
|
||||||
_connectors = new HashSet<MangaConnector>()
|
_connectors = new HashSet<MangaConnector>()
|
||||||
{
|
{
|
||||||
|
@ -23,13 +23,13 @@ public class TrangaSettings
|
|||||||
string lockFilePath = $"{settingsFilePath}.lock";
|
string lockFilePath = $"{settingsFilePath}.lock";
|
||||||
if (File.Exists(settingsFilePath) && !File.Exists(lockFilePath))
|
if (File.Exists(settingsFilePath) && !File.Exists(lockFilePath))
|
||||||
{//Load from settings file
|
{//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);
|
string settingsStr = File.ReadAllText(settingsFilePath);
|
||||||
TrangaSettings settings = JsonConvert.DeserializeObject<TrangaSettings>(settingsStr)!;
|
TrangaSettings settings = JsonConvert.DeserializeObject<TrangaSettings>(settingsStr)!;
|
||||||
this.downloadLocation = downloadLocation ?? settings.downloadLocation;
|
this.downloadLocation = downloadLocation ?? settings.downloadLocation;
|
||||||
this.workingDirectory = workingDirectory ?? settings.workingDirectory;
|
this.workingDirectory = workingDirectory ?? settings.workingDirectory;
|
||||||
this.apiPortNumber = apiPortNumber ?? settings.apiPortNumber;
|
this.apiPortNumber = apiPortNumber ?? settings.apiPortNumber;
|
||||||
lockFile.Close();
|
lockFile.Close(); //unlock settingsfile
|
||||||
}
|
}
|
||||||
else if(!File.Exists(settingsFilePath))
|
else if(!File.Exists(settingsFilePath))
|
||||||
{//No settings file exists
|
{//No settings file exists
|
||||||
@ -132,4 +132,15 @@ public class TrangaSettings
|
|||||||
{
|
{
|
||||||
return Path.Join(this.coverImageCache, manga.coverFileNameInCache);
|
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";
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user