Resolve path dialog
This commit is contained in:
@@ -39,6 +39,9 @@ namespace OpenSaveCloudClient
|
||||
logManager.NewMessage += LogManager_NewMessage;
|
||||
new Thread(() =>
|
||||
{
|
||||
this.Invoke((MethodInvoker)delegate {
|
||||
CheckPaths();
|
||||
});
|
||||
serverConnector.Reconnect();
|
||||
if (!serverConnector.Connected)
|
||||
{
|
||||
@@ -48,7 +51,14 @@ namespace OpenSaveCloudClient
|
||||
}
|
||||
else
|
||||
{
|
||||
saveManager.DetectChanges();
|
||||
try
|
||||
{
|
||||
saveManager.DetectChanges();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logManager.AddError(e);
|
||||
}
|
||||
this.Invoke((MethodInvoker)delegate {
|
||||
SetAdminControls();
|
||||
AboutButton.Enabled = true;
|
||||
@@ -62,6 +72,36 @@ namespace OpenSaveCloudClient
|
||||
});
|
||||
}
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private void CheckPaths()
|
||||
{
|
||||
List<GameSave> toDelete = new();
|
||||
foreach (GameSave save in saveManager.Saves)
|
||||
{
|
||||
if (!save.PathExist())
|
||||
{
|
||||
string message = String.Format("The path of '{0}' is not found\n\n{1}\n\nDo you want to locate the new path?", save.Name, save.FolderPath);
|
||||
DialogResult res = MessageBox.Show(message, "Missing path", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
|
||||
if (res == DialogResult.Yes)
|
||||
{
|
||||
FolderBrowserDialog dialog = new();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
save.FolderPath = dialog.SelectedPath;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
toDelete.Add(save);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (GameSave save in toDelete)
|
||||
{
|
||||
saveManager.Saves.Remove(save);
|
||||
}
|
||||
saveManager.Save();
|
||||
RefreshList();
|
||||
}
|
||||
|
||||
@@ -82,7 +122,14 @@ namespace OpenSaveCloudClient
|
||||
{
|
||||
new Thread(() =>
|
||||
{
|
||||
saveManager.DetectChanges();
|
||||
try
|
||||
{
|
||||
saveManager.DetectChanges();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logManager.AddError(e);
|
||||
}
|
||||
}).Start();
|
||||
SetAdminControls();
|
||||
Enabled = true;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace OpenSaveCloudClient.Models
|
||||
private long id;
|
||||
private string uuid;
|
||||
private readonly string name;
|
||||
private readonly string folderPath;
|
||||
private string folderPath;
|
||||
private readonly string description;
|
||||
private string hash;
|
||||
private string currentHash;
|
||||
@@ -28,7 +28,7 @@ namespace OpenSaveCloudClient.Models
|
||||
public string Uuid { get { return uuid; } }
|
||||
public string Name { get { return name; } }
|
||||
public string Description { get { return description; } }
|
||||
public string FolderPath { get { return folderPath; } }
|
||||
public string FolderPath { get { return folderPath; } set { folderPath = value; } }
|
||||
public string Hash { get { return hash; } }
|
||||
public string CurrentHash { get { return currentHash; } }
|
||||
public string? CoverPath { get { return coverPath; } }
|
||||
@@ -110,5 +110,10 @@ namespace OpenSaveCloudClient.Models
|
||||
{
|
||||
hash = currentHash;
|
||||
}
|
||||
|
||||
public bool PathExist()
|
||||
{
|
||||
return Directory.Exists(FolderPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user