[BUG] "Store config at the assembly location" not working for "protected folder locations" (#321), version 1.2.6.2

This commit is contained in:
Markus Hofknecht 2022-02-07 20:22:38 +01:00
parent 37355bdfe1
commit 3def2f40c0
4 changed files with 21 additions and 9 deletions

View file

@ -39,5 +39,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.6.1")]
[assembly: AssemblyFileVersion("1.2.6.1")]
[assembly: AssemblyVersion("1.2.6.2")]
[assembly: AssemblyFileVersion("1.2.6.2")]

View file

@ -43,6 +43,10 @@ namespace SystemTrayMenu.Properties
$"SystemTrayMenu"),
$"user-{Environment.MachineName}.config");
public static string ConfigPathAssembly => Path.Combine(
Directory.GetParent(Assembly.GetEntryAssembly().Location).FullName,
$"user.config");
/// <summary>
/// Gets or sets override.
/// </summary>
@ -56,10 +60,6 @@ namespace SystemTrayMenu.Properties
}
}
private static string ConfigPathAssembly => Path.Combine(
Directory.GetParent(Assembly.GetEntryAssembly().Location).FullName,
$"user.config");
/// <summary>
/// Gets or sets in memory storage of the settings values.
/// </summary>

View file

@ -114,7 +114,7 @@ namespace SystemTrayMenu.Helper
aboutBox.AppMoreInfo += "#235 #242 243 #247, #271 Tom, #237 Torsten S., #240 video Patrick, #244 Gunter D., #246 MACE4GITHUB, #259 #310 vanjac, ";
aboutBox.AppMoreInfo += "#262 terencemcdonnell, #269 petersnows25, #272 Peter M., #273 #274 ParasiteDelta, #275 #276 #278 donaldaken, ";
aboutBox.AppMoreInfo += "#277 Jan S., #282 akuznets, #283 #284 #289 RuSieg, #285 #286 dao-net, #288 William P., #294 #295 #296 Stefan Mahrer, ";
aboutBox.AppMoreInfo += "#225 #297 #299 #317 chip33, #298 phanirithvij, #306 wini2" + Environment.NewLine;
aboutBox.AppMoreInfo += "#225 #297 #299 #317 #321 chip33, #298 phanirithvij, #306 wini2" + Environment.NewLine;
aboutBox.AppMoreInfo += @"
Sponsors - Thank you!
------------------

View file

@ -865,14 +865,26 @@ namespace SystemTrayMenu.UserInterface
if (checkBoxStoreConfigAtAssemblyLocation.Checked)
{
CustomSettingsProvider.ActivateConfigPathAssembly();
Settings.Default.Save();
TrySettingsDefaultSave();
}
else
{
Settings.Default.Save();
TrySettingsDefaultSave();
CustomSettingsProvider.DeactivateConfigPathAssembly();
}
static void TrySettingsDefaultSave()
{
try
{
Settings.Default.Save();
}
catch (Exception ex)
{
Log.Warn($"Failed to store config at assembly location {CustomSettingsProvider.ConfigPathAssembly}", ex);
}
}
DialogResult = DialogResult.OK;
AppRestart.ByConfigChange();
Close();