Remove "advanced settings". Too error prone
This commit is contained in:
parent
206890b8f3
commit
c2c6a31716
@ -275,19 +275,8 @@ namespace FileManager
|
|||||||
return valueFinal;
|
return valueFinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TrySetLibationFiles(string directory)
|
public void SetLibationFiles(string directory)
|
||||||
{
|
{
|
||||||
// this is WRONG. need to MOVE settings; not DELETE them
|
|
||||||
|
|
||||||
//// if moving from default, delete old settings file and dir (if empty)
|
|
||||||
//if (LibationFiles.EqualsInsensitive(AppDir))
|
|
||||||
//{
|
|
||||||
// File.Delete(SettingsFilePath);
|
|
||||||
// System.Threading.Thread.Sleep(100);
|
|
||||||
// if (!Directory.EnumerateDirectories(AppDir).Any() && !Directory.EnumerateFiles(AppDir).Any())
|
|
||||||
// Directory.Delete(AppDir);
|
|
||||||
//}
|
|
||||||
|
|
||||||
libationFilesPathCache = null;
|
libationFilesPathCache = null;
|
||||||
|
|
||||||
var startingContents = File.ReadAllText(APPSETTINGS_JSON);
|
var startingContents = File.ReadAllText(APPSETTINGS_JSON);
|
||||||
@ -297,7 +286,7 @@ namespace FileManager
|
|||||||
|
|
||||||
var endingContents = JsonConvert.SerializeObject(jObj, Formatting.Indented);
|
var endingContents = JsonConvert.SerializeObject(jObj, Formatting.Indented);
|
||||||
if (startingContents == endingContents)
|
if (startingContents == endingContents)
|
||||||
return true;
|
return;
|
||||||
|
|
||||||
// now it's set in the file again but no settings have moved yet
|
// now it's set in the file again but no settings have moved yet
|
||||||
File.WriteAllText(APPSETTINGS_JSON, endingContents);
|
File.WriteAllText(APPSETTINGS_JSON, endingContents);
|
||||||
@ -307,13 +296,6 @@ namespace FileManager
|
|||||||
Log.Logger.Information("Libation files changed {@DebugInfo}", new { APPSETTINGS_JSON, LIBATION_FILES_KEY, directory });
|
Log.Logger.Information("Libation files changed {@DebugInfo}", new { APPSETTINGS_JSON, LIBATION_FILES_KEY, directory });
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
//// attempting this will try to change the settings file which has not yet been moved
|
|
||||||
//// after this is fixed, can remove it from Program.configureLogging()
|
|
||||||
// var logPath = Path.Combine(LibationFiles, "Log.log");
|
|
||||||
// SetWithJsonPath("Serilog.WriteTo[1].Args", "path", logPath, true);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
<!-- <PublishSingleFile>true</PublishSingleFile> -->
|
<!-- <PublishSingleFile>true</PublishSingleFile> -->
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
|
|
||||||
<Version>5.3.2.1</Version>
|
<Version>5.3.3.1</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -81,7 +81,7 @@ namespace LibationLauncher
|
|||||||
// check for existing settigns in default location
|
// check for existing settigns in default location
|
||||||
var defaultSettingsFile = Path.Combine(defaultLibationFilesDir, "Settings.json");
|
var defaultSettingsFile = Path.Combine(defaultLibationFilesDir, "Settings.json");
|
||||||
if (Configuration.SettingsFileIsValid(defaultSettingsFile))
|
if (Configuration.SettingsFileIsValid(defaultSettingsFile))
|
||||||
config.TrySetLibationFiles(defaultLibationFilesDir);
|
config.SetLibationFiles(defaultLibationFilesDir);
|
||||||
|
|
||||||
if (config.LibationSettingsAreValid)
|
if (config.LibationSettingsAreValid)
|
||||||
return;
|
return;
|
||||||
@ -94,7 +94,7 @@ namespace LibationLauncher
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (setupDialog.IsNewUser)
|
if (setupDialog.IsNewUser)
|
||||||
config.TrySetLibationFiles(defaultLibationFilesDir);
|
config.SetLibationFiles(defaultLibationFilesDir);
|
||||||
else if (setupDialog.IsReturningUser)
|
else if (setupDialog.IsReturningUser)
|
||||||
{
|
{
|
||||||
var libationFilesDialog = new LibationFilesDialog();
|
var libationFilesDialog = new LibationFilesDialog();
|
||||||
@ -105,7 +105,7 @@ namespace LibationLauncher
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
config.TrySetLibationFiles(libationFilesDialog.SelectedDirectory);
|
config.SetLibationFiles(libationFilesDialog.SelectedDirectory);
|
||||||
if (config.LibationSettingsAreValid)
|
if (config.LibationSettingsAreValid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
16
LibationWinForms/Form1.Designer.cs
generated
16
LibationWinForms/Form1.Designer.cs
generated
@ -51,7 +51,6 @@
|
|||||||
this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.accountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.accountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.basicSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.basicSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.advancedSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||||
this.visibleCountLbl = new System.Windows.Forms.ToolStripStatusLabel();
|
this.visibleCountLbl = new System.Windows.Forms.ToolStripStatusLabel();
|
||||||
this.springLbl = new System.Windows.Forms.ToolStripStatusLabel();
|
this.springLbl = new System.Windows.Forms.ToolStripStatusLabel();
|
||||||
@ -232,8 +231,7 @@
|
|||||||
//
|
//
|
||||||
this.settingsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.settingsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.accountsToolStripMenuItem,
|
this.accountsToolStripMenuItem,
|
||||||
this.basicSettingsToolStripMenuItem,
|
this.basicSettingsToolStripMenuItem});
|
||||||
this.advancedSettingsToolStripMenuItem});
|
|
||||||
this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem";
|
this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem";
|
||||||
this.settingsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
|
this.settingsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
|
||||||
this.settingsToolStripMenuItem.Text = "&Settings";
|
this.settingsToolStripMenuItem.Text = "&Settings";
|
||||||
@ -241,24 +239,17 @@
|
|||||||
// accountsToolStripMenuItem
|
// accountsToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.accountsToolStripMenuItem.Name = "accountsToolStripMenuItem";
|
this.accountsToolStripMenuItem.Name = "accountsToolStripMenuItem";
|
||||||
this.accountsToolStripMenuItem.Size = new System.Drawing.Size(181, 22);
|
this.accountsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
this.accountsToolStripMenuItem.Text = "&Accounts...";
|
this.accountsToolStripMenuItem.Text = "&Accounts...";
|
||||||
this.accountsToolStripMenuItem.Click += new System.EventHandler(this.accountsToolStripMenuItem_Click);
|
this.accountsToolStripMenuItem.Click += new System.EventHandler(this.accountsToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// basicSettingsToolStripMenuItem
|
// basicSettingsToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.basicSettingsToolStripMenuItem.Name = "basicSettingsToolStripMenuItem";
|
this.basicSettingsToolStripMenuItem.Name = "basicSettingsToolStripMenuItem";
|
||||||
this.basicSettingsToolStripMenuItem.Size = new System.Drawing.Size(181, 22);
|
this.basicSettingsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||||
this.basicSettingsToolStripMenuItem.Text = "&Settings...";
|
this.basicSettingsToolStripMenuItem.Text = "&Settings...";
|
||||||
this.basicSettingsToolStripMenuItem.Click += new System.EventHandler(this.basicSettingsToolStripMenuItem_Click);
|
this.basicSettingsToolStripMenuItem.Click += new System.EventHandler(this.basicSettingsToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// advancedSettingsToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.advancedSettingsToolStripMenuItem.Name = "advancedSettingsToolStripMenuItem";
|
|
||||||
this.advancedSettingsToolStripMenuItem.Size = new System.Drawing.Size(181, 22);
|
|
||||||
this.advancedSettingsToolStripMenuItem.Text = "&Move settings files...";
|
|
||||||
this.advancedSettingsToolStripMenuItem.Click += new System.EventHandler(this.advancedSettingsToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// statusStrip1
|
// statusStrip1
|
||||||
//
|
//
|
||||||
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
@ -359,7 +350,6 @@
|
|||||||
private System.Windows.Forms.ToolStripMenuItem editQuickFiltersToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem editQuickFiltersToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||||
private System.Windows.Forms.ToolStripMenuItem basicSettingsToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem basicSettingsToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem advancedSettingsToolStripMenuItem;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem accountsToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem accountsToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem scanLibraryOfAllAccountsToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem scanLibraryOfAllAccountsToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem scanLibraryOfSomeAccountsToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem scanLibraryOfSomeAccountsToolStripMenuItem;
|
||||||
|
|||||||
@ -395,31 +395,6 @@ namespace LibationWinForms
|
|||||||
private void accountsToolStripMenuItem_Click(object sender, EventArgs e) => new AccountsDialog(this).ShowDialog();
|
private void accountsToolStripMenuItem_Click(object sender, EventArgs e) => new AccountsDialog(this).ShowDialog();
|
||||||
|
|
||||||
private void basicSettingsToolStripMenuItem_Click(object sender, EventArgs e) => new SettingsDialog().ShowDialog();
|
private void basicSettingsToolStripMenuItem_Click(object sender, EventArgs e) => new SettingsDialog().ShowDialog();
|
||||||
|
|
||||||
private void advancedSettingsToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var libationFilesDialog = new LibationFilesDialog();
|
|
||||||
if (libationFilesDialog.ShowDialog() != DialogResult.OK)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// no change
|
|
||||||
if (System.IO.Path.GetFullPath(libationFilesDialog.SelectedDirectory).EqualsInsensitive(System.IO.Path.GetFullPath(Configuration.Instance.LibationFiles)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!Configuration.Instance.TrySetLibationFiles(libationFilesDialog.SelectedDirectory))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Not saving change to Libation Files location. This folder does not exist:\r\n" + libationFilesDialog.SelectedDirectory, "Error saving change", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageBox.Show(
|
|
||||||
"You have changed a file path important for this program. All files will remain in their original location; nothing will be moved. Libation must be restarted so these changes are handled correctly.",
|
|
||||||
"Closing Libation",
|
|
||||||
MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Exclamation);
|
|
||||||
Application.Exit();
|
|
||||||
Environment.Exit(0);
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user