RWELabs / Stardew-Valley-Mod-Manager

[Passion Project] The Stardew Valley Mod Manager is a powerful tool that is designed to be used alongside SMAPI to help you install and manage mods, automatically install modpacks and manage your game saves.
Other
26 stars 1 forks source link

[Issue] Theme doesn't carry over after updating. #103

Closed RyanWalpole closed 1 year ago

RyanWalpole commented 1 year ago

The Issue or Bug

Whatever theme the user has selected does not carry over after updating the application, often not even selecting "Colourful - Pink" as the default.

Version

220901 (observed), 220802 (assumed)

Operating System

Windows 11

Steps to reproduce the behavior

  1. Update to a newer version of the mod manager.
  2. Observe that the theme choice is completely wiped.

Log Files

No response

Screenshots

No response

Additional Context

No response

Suggested Resolution

No response

RyanWalpole commented 1 year ago

Found the issue in the code that is executed when the application is exited.

DoApplicationSettingSave( );

FileWrite.AppendText("$CheckSMAPIUpdateOnStartup=" + Properties.Settings.Default.CheckSMAPIUpdateOnStartup);
FileWrite.AppendText("$ColorProfile=" + Properties.Settings.Default.ColorProfile);

Issue actually extends to the "CheckSMAPIUpdateOnStartup" setting as well. Results in the file being saved as follows:

Broken Settings.INI

$StardewDir=C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\
$ModsDir=C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\\Mods\
$InactiveModsDir=C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\\inactive-mods\
$PresetsDir=C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\\mod-presets\
$CheckUpdateOnStartup=TRUE
$IsManuallyReset=FALSE
$CheckSMAPIUpdateOnStartup=====FALSE$ColorProfile=PINK$ColorProfile====FALSE=PINK$ColorProfile=PINK

Correct Settings.INI

$StardewDir=C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\
$ModsDir=C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\\Mods\
$InactiveModsDir=C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\\inactive-mods\
$PresetsDir=C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\\mod-presets\
$CheckUpdateOnStartup=FALSE
$IsManuallyReset=FALSE
$CheckSMAPIUpdateOnStartup=FALSE
$ColorProfile=PINK
RyanWalpole commented 1 year ago

Issue Overview The issue is that the DoApplicationSettingSave(); function does not separate the FileWrite.AppendText(); for the SMAPI Update and Color Profile with an Environment.NewLine;.

For example:

Existing Code (Not Working)

FileWrite.AppendText("$CheckSMAPIUpdateOnStartup=" + Properties.Settings.Default.CheckSMAPIUpdateOnStartup);
FileWrite.AppendText("$ColorProfile=" + Properties.Settings.Default.ColorProfile);

Updated Code (Fixes Issue)

FileWrite.AppendText("$CheckSMAPIUpdateOnStartup=" + 
Properties.Settings.Default.CheckSMAPIUpdateOnStartup + Environment.NewLine);
FileWrite.AppendText("$ColorProfile=" + Properties.Settings.Default.ColorProfile + Environment.NewLine);