Skip to content

Commit 2f56c76

Browse files
committed
#89 Bug Fixes
1 parent 98938f8 commit 2f56c76

File tree

6 files changed

+51
-15
lines changed

6 files changed

+51
-15
lines changed

src/ReaLTaiizor/Manager/MetroStyleManager.cs

+21-12
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public MetroStyleManager(Form ownerForm)
3434

3535
public MetroStyleManager()
3636
{
37+
Style = Style.Light;
38+
3739
if (_customTheme == null)
3840
{
3941
string themePath = Properties.Settings.Default.ThemeFile;
@@ -54,7 +56,7 @@ public MetroStyleManager()
5456
_customTheme = ThemeFilePath(Properties.Resources.Metro_Theme);
5557
}
5658
}
57-
Style = Style.Light;
59+
5860
EvaluateDicts();
5961
}
6062

@@ -220,19 +222,19 @@ public string CustomTheme
220222
get => _customTheme;
221223
set
222224
{
223-
if (!string.IsNullOrEmpty(value))
225+
if (!string.IsNullOrEmpty(value) && File.Exists(value))
224226
{
225227
Properties.Settings.Default.ThemeFile = value;
226228
Properties.Settings.Default.Save();
227229
ControlProperties(value);
228230
Style = Style.Custom;
231+
_customTheme = value;
229232
}
230233
else
231234
{
232235
Style = Style.Light;
236+
_customTheme = null;
233237
}
234-
235-
_customTheme = value;
236238
}
237239
}
238240

@@ -428,17 +430,24 @@ private void ControlProperties(string path)
428430

429431
private void ThemeDetailsReader(string path)
430432
{
431-
foreach (KeyValuePair<string, object> item in GetValues(path, "Theme"))
433+
try
432434
{
433-
if (item.Key == "Name")
434-
{
435-
ThemeName = item.Value.ToString();
436-
}
437-
else if (item.Key == "Author")
435+
foreach (KeyValuePair<string, object> item in GetValues(path, "Theme"))
438436
{
439-
ThemeAuthor = item.Value.ToString();
437+
if (item.Key == "Name")
438+
{
439+
ThemeName = item.Value.ToString();
440+
}
441+
else if (item.Key == "Author")
442+
{
443+
ThemeAuthor = item.Value.ToString();
444+
}
440445
}
441446
}
447+
catch
448+
{
449+
return;
450+
}
442451
}
443452

444453
private static Dictionary<string, object> GetValues(string path, string nodename)
@@ -468,7 +477,7 @@ private static Dictionary<string, object> GetValues(string path, string nodename
468477
}
469478
catch
470479
{
471-
return null;
480+
return new();
472481
}
473482
}
474483

src/ReaLTaiizor/Properties/Settings.Designer.cs

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ReaLTaiizor/ReaLTaiizor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// Creator: Taiizor
1414
// Website: www.Vegalya.com
1515
// Created: 15.May.2019
16-
// Changed: 08.Dec.2022
16+
// Changed: 23.Dec.2022
1717
// Version: 3.7.8.9
1818
//
1919
// |---------DO-NOT-REMOVE---------|

src/ReaLTaiizor/ReaLTaiizor.csproj

+15
Original file line numberDiff line numberDiff line change
@@ -294,4 +294,19 @@ Changes are detailed at https://github.com/Taiizor/ReaLTaiizor/releases</Package
294294
<EmbeddedResource Include="Localization\Poison\zh\PoisonToggle.xml" />
295295
</ItemGroup>
296296

297+
<ItemGroup>
298+
<Compile Update="Properties\Settings.Designer.cs">
299+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
300+
<AutoGen>True</AutoGen>
301+
<DependentUpon>Settings.settings</DependentUpon>
302+
</Compile>
303+
</ItemGroup>
304+
305+
<ItemGroup>
306+
<None Update="Properties\Settings.settings">
307+
<Generator>SettingsSingleFileGenerator</Generator>
308+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
309+
</None>
310+
</ItemGroup>
311+
297312
</Project>

src/ReaLTaiizor_CR/Properties/Settings.Designer.cs

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ReaLTaiizor_CR/ReaLTaiizor_CR.csproj

+12
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
<AutoGen>True</AutoGen>
4141
<DependentUpon>Resources.resx</DependentUpon>
4242
</Compile>
43+
<Compile Update="Properties\Settings.Designer.cs">
44+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
45+
<AutoGen>True</AutoGen>
46+
<DependentUpon>Settings.settings</DependentUpon>
47+
</Compile>
4348
</ItemGroup>
4449

4550
<ItemGroup>
@@ -49,4 +54,11 @@
4954
</EmbeddedResource>
5055
</ItemGroup>
5156

57+
<ItemGroup>
58+
<None Update="Properties\Settings.settings">
59+
<Generator>SettingsSingleFileGenerator</Generator>
60+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
61+
</None>
62+
</ItemGroup>
63+
5264
</Project>

0 commit comments

Comments
 (0)