mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 19:47:21 +01:00
rework a lot of stuff: downloads, how to watch a player
This commit is contained in:
parent
eb39429777
commit
3618540402
18 changed files with 319 additions and 233 deletions
|
|
@ -32,6 +32,7 @@ namespace MareSynchronos.UI
|
|||
_fileDialogManager = fileDialogManager;
|
||||
_pluginConfiguration = pluginConfiguration;
|
||||
_dalamudUtil = dalamudUtil;
|
||||
isDirectoryWritable = IsDirectoryWritable(_pluginConfiguration.CacheFolder);
|
||||
}
|
||||
|
||||
public bool DrawOtherPluginState()
|
||||
|
|
@ -58,11 +59,6 @@ namespace MareSynchronos.UI
|
|||
return true;
|
||||
}
|
||||
|
||||
public void ForceRescan()
|
||||
{
|
||||
Task.Run(() => _ = _fileCacheManager.RescanTask(true));
|
||||
}
|
||||
|
||||
public void DrawFileScanState()
|
||||
{
|
||||
ImGui.Text("File Scanner Status");
|
||||
|
|
@ -300,7 +296,9 @@ namespace MareSynchronos.UI
|
|||
if (ImGui.InputText("Cache Folder##cache", ref cacheDirectory, 255))
|
||||
{
|
||||
_pluginConfiguration.CacheFolder = cacheDirectory;
|
||||
if (!string.IsNullOrEmpty(_pluginConfiguration.CacheFolder) && Directory.Exists(_pluginConfiguration.CacheFolder))
|
||||
if (!string.IsNullOrEmpty(_pluginConfiguration.CacheFolder)
|
||||
&& Directory.Exists(_pluginConfiguration.CacheFolder)
|
||||
&& (isDirectoryWritable = IsDirectoryWritable(_pluginConfiguration.CacheFolder)))
|
||||
{
|
||||
_pluginConfiguration.Save();
|
||||
_fileCacheManager.StartWatchers();
|
||||
|
|
@ -317,20 +315,26 @@ namespace MareSynchronos.UI
|
|||
if (!success) return;
|
||||
|
||||
_pluginConfiguration.CacheFolder = path;
|
||||
_pluginConfiguration.Save();
|
||||
_fileCacheManager.StartWatchers();
|
||||
isDirectoryWritable = IsDirectoryWritable(_pluginConfiguration.CacheFolder);
|
||||
if (isDirectoryWritable)
|
||||
{
|
||||
_pluginConfiguration.Save();
|
||||
_fileCacheManager.StartWatchers();
|
||||
}
|
||||
});
|
||||
}
|
||||
ImGui.PopFont();
|
||||
|
||||
if (!Directory.Exists(cacheDirectory) || !IsDirectoryWritable(cacheDirectory))
|
||||
if (!Directory.Exists(cacheDirectory) || !isDirectoryWritable)
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
|
||||
TextWrapped("The folder you selected does not exist. Please provide a valid path.");
|
||||
TextWrapped("The folder you selected does not exist or cannot be written to. Please provide a valid path.");
|
||||
ImGui.PopStyleColor();
|
||||
}
|
||||
}
|
||||
|
||||
private bool isDirectoryWritable = false;
|
||||
|
||||
public bool IsDirectoryWritable(string dirPath, bool throwIfFails = false)
|
||||
{
|
||||
try
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue