Skip to content

Commit 91445c1

Browse files
committed
Spore ModAPI Easy Installer: don't create an empty ModSettings file
1 parent 319a6f2 commit 91445c1

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

Spore ModAPI Easy Installer/XmlInstallerWindow.xaml.cs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -321,15 +321,10 @@ private void GetComponents()
321321
checkBox.MouseLeave += Component_MouseLeave;
322322

323323
checkBox.IsChecked = false;
324-
//if (_isConfigurator && (enabledList.Contains(ComponentInfoToQuestionMarkSeparatedString(info)/*info.ComponentFileName + "?" + info.ComponentGame*/)))
324+
325325
string storedValue = GetSettingValueFromStorageString(info.ComponentUniqueName);
326-
if (storedValue != null)
327-
{
328-
if (bool.TryParse(storedValue, out bool valueBool))
329-
checkBox.IsChecked = valueBool;
330-
else
331-
checkBox.IsChecked = info.defaultChecked;
332-
}
326+
if (storedValue != null && bool.TryParse(storedValue, out bool valueBool))
327+
checkBox.IsChecked = valueBool;
333328
else
334329
checkBox.IsChecked = info.defaultChecked;
335330

@@ -784,14 +779,11 @@ await Task.Run(() =>
784779
File.Delete(Path.Combine(ModConfigPath, "EnabledComponents.txt"));
785780
}
786781

787-
/*using (StreamWriter enabledComponentsListFile = new StreamWriter(/*Path.Combine(ModConfigPath, "EnabledComponents.txt")*ModSettingsStoragePath))
782+
// only write settings if they exist
783+
if (storedSettings.Count > 0)
788784
{
789-
foreach (string s in storedSettings)
790-
{
791-
enabledComponentsListFile.WriteLine(s);
792-
}
793-
}*/
794-
File.WriteAllLines(ModSettingsStoragePath, storedSettings.ToArray());
785+
File.WriteAllLines(ModSettingsStoragePath, storedSettings.ToArray());
786+
}
795787

796788
if (_installerMode == 0)
797789
{
@@ -931,10 +923,6 @@ string GetSettingValueFromStorageString(string setting)
931923
break;
932924
}
933925
}
934-
/*if (returnValue != null)
935-
MessageBox.Show(returnValue, "setting value");
936-
else
937-
MessageBox.Show("NULL", "setting value is null");*/
938926

939927
return returnValue;
940928
}

0 commit comments

Comments
 (0)