Skip to content

Commit

Permalink
Settings Bug Fixes
Browse files Browse the repository at this point in the history
- Player/Opponent Location #29
- Opponent Location Reset #30
- Player Display Reset #31
  • Loading branch information
batstyx committed Feb 19, 2024
2 parents 5c2d738 + a18a770 commit 58a8c0b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Graveyard/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Graveyard")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,5 +32,5 @@
// 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.13.0.0")]
[assembly: AssemblyFileVersion("1.13.0.0")]
[assembly: AssemblyVersion("1.13.1.0")]
[assembly: AssemblyFileVersion("1.13.1.0")]
5 changes: 3 additions & 2 deletions Graveyard/Settings.Default.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows.Controls;
using System;
using System.Windows.Controls;

namespace HDT.Plugins.Graveyard
{
Expand All @@ -12,7 +13,7 @@ public sealed partial class Settings
public double DefaultEnemyTop => GetDefaultDblValue(nameof(EnemyTop));
public double DefaultFriendlyOpacity => GetDefaultDblValue(nameof(FriendlyOpacity));
public double DefaultFriendlyScale => GetDefaultDblValue(nameof(FriendlyScale));
public Orientation DefaultFriendlyOrientation => (Orientation)Properties[nameof(FriendlyOrientation)].DefaultValue;
public Orientation DefaultFriendlyOrientation => (Orientation)Enum.Parse(typeof(Orientation), Properties[nameof(FriendlyOrientation)].DefaultValue.ToString());
public double DefaultEnemyOpacity => GetDefaultDblValue(nameof(EnemyOpacity));
public double DefaultEnemyScale => GetDefaultDblValue(nameof(EnemyScale));

Expand Down
7 changes: 4 additions & 3 deletions Graveyard/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Globalization;
using System.IO;
using System.Linq;

Expand Down Expand Up @@ -72,7 +73,7 @@ private void SettingsLoadedEventHandler(object sender, System.Configuration.Sett
if (Properties[setting.Name].PropertyType.IsEnum)
this[setting.Name] = Enum.Parse(Properties[setting.Name].PropertyType, setting.Value);
else
this[setting.Name] = Convert.ChangeType(setting.Value, Properties[setting.Name].PropertyType);
this[setting.Name] = Convert.ChangeType(setting.Value, Properties[setting.Name].PropertyType, CultureInfo.InvariantCulture);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -101,8 +102,8 @@ private void SettingsSavingEventHandler(object sender, System.ComponentModel.Can
try
{
var saveFormat = PropertyValues.Cast<SettingsPropertyValue>()
.Where(p => p.SerializedValue.ToString() != p.Property.DefaultValue.ToString())
.Select(p => new Setting(p.Name, p.SerializedValue.ToString()))
.Where(p => !p.SerializedValue.Equals(p.Property.DefaultValue))
.Select(p => new Setting(p.Name, string.Format(CultureInfo.InvariantCulture, "{0}", p.SerializedValue)))
.ToList();

XmlManager<List<Setting>>.Save(SettingsPath, saveFormat);
Expand Down
2 changes: 1 addition & 1 deletion Graveyard/SettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@
IsChecked="{Binding OpponentDeathrattleEnabled, Source={x:Static local:Settings.Default}}"
Style="{StaticResource ToggleStyle}"
ToolTip="{lex:Loc OpponentDeathrattleDescription}" />
<GroupBox Header="{Binding PlayerPositionGroup, RelativeSource={RelativeSource AncestorType=Grid}}" Style="{StaticResource PositionGroupStyle}">
<GroupBox Header="{Binding OpponentPositionGroup, RelativeSource={RelativeSource AncestorType=Grid}}" Style="{StaticResource PositionGroupStyle}">
<StackPanel>
<DockPanel Style="{StaticResource SliderPanelStyle}">
<Slider
Expand Down

0 comments on commit 58a8c0b

Please sign in to comment.