Skip to content

Commit bea7392

Browse files
committed
Fixed first startup: missing settings file
1 parent 56ad4f0 commit bea7392

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

BabboSettings/Resources/Info.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"Id": "BabboSettings",
33
"DisplayName": "BabboSettings",
44
"Author": "Babbo Elu",
5-
"Version": "0.6.5",
5+
"Version": "0.6.6",
66
"ManagerVersion": "0.15.0",
77
"Requirements": [ "blendermf.XLShredMenu-0.0.5" ],
88
"AssemblyName": "BabboSettings.dll",

BabboSettings/Settings.cs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class Settings : UnityModManager.ModSettings
2727
public int SCREEN_MODE = 0;
2828

2929
// AA
30-
public PostProcessLayer.Antialiasing AA_MODE = new PostProcessLayer.Antialiasing();
30+
public PostProcessLayer.Antialiasing AA_MODE = PostProcessLayer.Antialiasing.SubpixelMorphologicalAntialiasing;
3131
public float TAA_sharpness = new TemporalAntialiasing().sharpness;
3232
public float TAA_jitter = new TemporalAntialiasing().jitterSpread;
3333
public float TAA_stationary = new TemporalAntialiasing().stationaryBlending;
@@ -67,30 +67,36 @@ public override void Save(UnityModManager.ModEntry modEntry) {
6767

6868
public Task Save() {
6969
return Task.Run(() => {
70-
var filepath = Main.modEntry.Path;
70+
var filepath = $"{Main.modEntry.Path}Settings.xml";
7171
try {
72-
using (var writer = new StreamWriter($"{filepath}Settings.xml")) {
72+
using (var writer = new StreamWriter(filepath)) {
7373
XmlSerializer xmlSerializer = new XmlSerializer(typeof(Settings));
7474
xmlSerializer.Serialize(writer, this);
7575
}
7676
}
7777
catch (Exception e) {
78-
Logger.Log($"Can't save {filepath}Settings.xml. ex: {e}");
78+
Logger.Log($"Can't save {filepath}. ex: {e}");
7979
}
8080
});
8181
}
8282

8383
public static Settings Load() {
84-
var filepath = Main.modEntry.Path;
84+
var filepath = $"{Main.modEntry.Path}Settings.xml";
8585
Settings settings = null;
86-
try {
87-
using (var reader = new StreamReader($"{filepath}Settings.xml")) {
88-
XmlSerializer xmlSerializer = new XmlSerializer(typeof(Settings));
89-
settings = (Settings)xmlSerializer.Deserialize(reader);
86+
if (File.Exists(filepath)) {
87+
try {
88+
using (var reader = new StreamReader(filepath)) {
89+
XmlSerializer xmlSerializer = new XmlSerializer(typeof(Settings));
90+
settings = (Settings)xmlSerializer.Deserialize(reader);
91+
}
92+
}
93+
catch (Exception e) {
94+
Logger.Log($"Can't read {filepath}. ex: {e}");
9095
}
9196
}
92-
catch (Exception e) {
93-
Logger.Log($"Can't read {filepath}Settings.xml. ex: {e}");
97+
else {
98+
Logger.Log($"No settings found, using defaults");
99+
settings = new Settings();
94100
}
95101
return settings;
96102
}

repository.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"Releases": [
33
{
44
"Id": "BabboSettings",
5-
"Version": "0.6.5",
6-
"DownloadUrl": "https://github.com/andreamatt/BabboSettings/releases/download/v0.6.5/BabboSettings-0.6.5.zip"
5+
"Version": "0.6.6",
6+
"DownloadUrl": "https://github.com/andreamatt/BabboSettings/releases/download/v0.6.6/BabboSettings-0.6.6.zip"
77
}
88
]
99
}

0 commit comments

Comments
 (0)