add intro UI for first time registration, add FileCacheManager to scan and rescan for file changes, fix namings, polish UI for normal usage

This commit is contained in:
Stanley Dimant
2022-06-21 01:07:57 +02:00
parent b7b2005dcb
commit 4a12d667f1
11 changed files with 1074 additions and 534 deletions

View File

@@ -2,6 +2,9 @@
using Dalamud.Plugin;
using System;
using System.Collections.Generic;
using System.IO;
using MareSynchronos.WebAPI;
using Newtonsoft.Json;
namespace MareSynchronos
{
@@ -11,23 +14,49 @@ namespace MareSynchronos
public int Version { get; set; } = 0;
public string CacheFolder { get; set; } = string.Empty;
public Dictionary<string, string> ClientSecret { get; internal set; } = new();
public string ApiUri { get; internal set; } = string.Empty;
public bool UseCustomService { get; internal set; }
public Dictionary<string, string> ClientSecret { get; set; } = new();
public Dictionary<string, string> UidComments { get; set; } = new();
private string _apiUri = string.Empty;
public string ApiUri
{
get => string.IsNullOrEmpty(_apiUri) ? ApiController.MainServiceUri : _apiUri;
set => _apiUri = value;
}
public bool UseCustomService { get; set; }
public bool InitialScanComplete { get; set; }
public bool AcceptedAgreement { get; set; }
private int _maxParallelScan = 10;
public int MaxParallelScan
{
get => _maxParallelScan;
set
{
_maxParallelScan = value switch
{
< 0 => 1,
> 20 => 10,
_ => value
};
}
}
[JsonIgnore]
public bool HasValidSetup => AcceptedAgreement && InitialScanComplete && !string.IsNullOrEmpty(CacheFolder) &&
Directory.Exists(CacheFolder) && ClientSecret.ContainsKey(ApiUri);
// the below exist just to make saving less cumbersome
[NonSerialized]
private DalamudPluginInterface? pluginInterface;
private DalamudPluginInterface? _pluginInterface;
public void Initialize(DalamudPluginInterface pluginInterface)
{
this.pluginInterface = pluginInterface;
this._pluginInterface = pluginInterface;
}
public void Save()
{
this.pluginInterface!.SavePluginConfig(this);
this._pluginInterface!.SavePluginConfig(this);
}
}
}