Fixed some bugs relating to new Filepath of Applicationdata
This commit is contained in:
parent
715cf1f4f3
commit
b5bd5d6126
@ -15,11 +15,17 @@ public static class Tranga_Cli
|
|||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
string applicationFolderPath = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Tranga");
|
string applicationFolderPath = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Tranga");
|
||||||
string logMessageFolderPath = Path.Join(applicationFolderPath, "logs");
|
string logsFolderPath = Path.Join(applicationFolderPath, "logs");
|
||||||
|
string logFilePath = Path.Join(logsFolderPath, $"log-{DateTime.Now:dd-M-yyyy-HH-mm-ss}.txt");
|
||||||
string settingsFilePath = Path.Join(applicationFolderPath, "data.json");
|
string settingsFilePath = Path.Join(applicationFolderPath, "data.json");
|
||||||
|
|
||||||
Logger logger = new(new[] { Logger.LoggerType.FileLogger }, null, null,
|
Directory.CreateDirectory(applicationFolderPath);
|
||||||
Path.Join(logMessageFolderPath, $"log-{DateTime.Now:dd-M-yyyy-HH-mm-ss}.txt"));
|
Directory.CreateDirectory(logsFolderPath);
|
||||||
|
|
||||||
|
Console.WriteLine($"Logfile-Path: {logFilePath}");
|
||||||
|
Console.WriteLine($"Settings-File-Path: {settingsFilePath}");
|
||||||
|
|
||||||
|
Logger logger = new(new[] { Logger.LoggerType.FileLogger }, null, null, logFilePath);
|
||||||
|
|
||||||
logger.WriteLine("Tranga_CLI", "Loading Taskmanager.");
|
logger.WriteLine("Tranga_CLI", "Loading Taskmanager.");
|
||||||
TaskManager.SettingsData settings;
|
TaskManager.SettingsData settings;
|
||||||
|
@ -34,9 +34,8 @@ public class TaskManager
|
|||||||
this.komga = new Komga(komgaBaseUrl, komgaUsername, komgaPassword, logger);
|
this.komga = new Komga(komgaBaseUrl, komgaUsername, komgaPassword, logger);
|
||||||
|
|
||||||
this.settings = new SettingsData(downloadFolderPath, settingsFilePath, this.komga, this._allTasks);
|
this.settings = new SettingsData(downloadFolderPath, settingsFilePath, this.komga, this._allTasks);
|
||||||
|
ExportData();
|
||||||
|
|
||||||
if (komgaBaseUrl != null && komgaUsername != null && komgaPassword != null)
|
|
||||||
this.komga = new Komga(komgaBaseUrl, komgaUsername, komgaPassword, logger);
|
|
||||||
this._connectors = new Connector[]{ new MangaDex(downloadFolderPath, logger) };
|
this._connectors = new Connector[]{ new MangaDex(downloadFolderPath, logger) };
|
||||||
foreach(Connector cConnector in this._connectors)
|
foreach(Connector cConnector in this._connectors)
|
||||||
_taskQueue.Add(cConnector, new List<TrangaTask>());
|
_taskQueue.Add(cConnector, new List<TrangaTask>());
|
||||||
@ -50,6 +49,8 @@ public class TaskManager
|
|||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this._connectors = new Connector[]{ new MangaDex(settings.downloadLocation, logger) };
|
this._connectors = new Connector[]{ new MangaDex(settings.downloadLocation, logger) };
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
|
ExportData();
|
||||||
|
|
||||||
foreach(Connector cConnector in this._connectors)
|
foreach(Connector cConnector in this._connectors)
|
||||||
_taskQueue.Add(cConnector, new List<TrangaTask>());
|
_taskQueue.Add(cConnector, new List<TrangaTask>());
|
||||||
this.komga = settings.komga;
|
this.komga = settings.komga;
|
||||||
@ -289,7 +290,7 @@ public class TaskManager
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void ExportData()
|
private void ExportData()
|
||||||
{
|
{
|
||||||
logger?.WriteLine(this.GetType().ToString(), $"Exporting data to data.json");
|
logger?.WriteLine(this.GetType().ToString(), $"Exporting data to {settings.settingsFilePath}");
|
||||||
|
|
||||||
string serializedData = JsonConvert.SerializeObject(settings);
|
string serializedData = JsonConvert.SerializeObject(settings);
|
||||||
File.WriteAllText(settings.settingsFilePath, serializedData);
|
File.WriteAllText(settings.settingsFilePath, serializedData);
|
||||||
|
Loading…
Reference in New Issue
Block a user