From f3ff807cd0fde460a4b71ca5e8c29f7bcaf8d30f Mon Sep 17 00:00:00 2001 From: Brett Hewitson Date: Mon, 13 Jun 2022 18:43:10 +1000 Subject: [PATCH] Player Level Bugfixes - changed INT to LONG when parsing the the INI file values. - created new slider for LONG types. --- src/ARKServerManager/Lib/Model/Level.cs | 8 +- .../UserControls/ServerSettingsControl.xaml | 4 +- src/ARKServerManager/VersionFeed.xml | 4 +- src/ARKServerManager/VersionFeedBeta.xml | 23 ++ .../AnnotatedCheckBoxAndLongSlider.xaml | 298 ++++++++++++++++++ .../AnnotatedCheckBoxAndLongSlider.xaml.cs | 152 +++++++++ .../ServerManager.Common.csproj | 6 + 7 files changed, 487 insertions(+), 8 deletions(-) create mode 100644 src/ServerManager.Common/Controls/AnnotatedCheckBoxAndLongSlider.xaml create mode 100644 src/ServerManager.Common/Controls/AnnotatedCheckBoxAndLongSlider.xaml.cs diff --git a/src/ARKServerManager/Lib/Model/Level.cs b/src/ARKServerManager/Lib/Model/Level.cs index 1f6cf88c..ff112972 100644 --- a/src/ARKServerManager/Lib/Model/Level.cs +++ b/src/ARKServerManager/Lib/Model/Level.cs @@ -128,17 +128,17 @@ namespace ServerManagerTool.Lib break; } - int xpRequired; - if (!int.TryParse(xpResult.Groups["xp"].Value, out xpRequired)) + long xpRequired; + if (!long.TryParse(xpResult.Groups["xp"].Value, out xpRequired)) { Debug.WriteLine(String.Format("Invalid xm required value: '{0}'", xpResult.Groups["xp"].Value)); break; } - int engramPoints = 0; + long engramPoints = 0; if (engramResult != null) { - if (!int.TryParse(engramResult.Groups["points"].Value, out engramPoints)) + if (!long.TryParse(engramResult.Groups["points"].Value, out engramPoints)) { Debug.WriteLine(String.Format("Invalid engram points value: '{0}'", engramResult.Groups["points"].Value)); break; diff --git a/src/ARKServerManager/UserControls/ServerSettingsControl.xaml b/src/ARKServerManager/UserControls/ServerSettingsControl.xaml index bce7b3a3..09c7276f 100644 --- a/src/ARKServerManager/UserControls/ServerSettingsControl.xaml +++ b/src/ARKServerManager/UserControls/ServerSettingsControl.xaml @@ -4558,14 +4558,14 @@ - + - + diff --git a/src/ARKServerManager/VersionFeed.xml b/src/ARKServerManager/VersionFeed.xml index b0d8a399..8d7e2827 100644 --- a/src/ARKServerManager/VersionFeed.xml +++ b/src/ARKServerManager/VersionFeed.xml @@ -9,8 +9,8 @@ urn:uuid:2ADA47E8-6DD0-4231-BAB9-AE3CEE5FA72C - 1.1.431 (1.1.431.1) - 1.1.431.1 + 1.1.431 (1.1.431.2) + 1.1.431.2 2022-06-13T00:00:00Z diff --git a/src/ARKServerManager/VersionFeedBeta.xml b/src/ARKServerManager/VersionFeedBeta.xml index 877566b4..07bdafbf 100644 --- a/src/ARKServerManager/VersionFeedBeta.xml +++ b/src/ARKServerManager/VersionFeedBeta.xml @@ -7,6 +7,29 @@ 2022-06-13T00:00:00Z + + urn:uuid:2ADA47E8-6DD0-4231-BAB9-AE3CEE5FA72C + 1.1.431 (1.1.431.2) + 1.1.431.2 + + 2022-06-13T00:00:00Z + +
+

+ BUGFIX +
+

    +
  • Player Levels - fix the conversion bug that would prevent all player levels being read from the INI file. Only values > 2147483647 were affected.
  • +
+

+
+
+ + bletch + bletch1971@hotmail.com + +
+ urn:uuid:2ADA47E8-6DD0-4231-BAB9-AE3CEE5FA72C 1.1.431 (1.1.431.1) diff --git a/src/ServerManager.Common/Controls/AnnotatedCheckBoxAndLongSlider.xaml b/src/ServerManager.Common/Controls/AnnotatedCheckBoxAndLongSlider.xaml new file mode 100644 index 00000000..f81cb9d3 --- /dev/null +++ b/src/ServerManager.Common/Controls/AnnotatedCheckBoxAndLongSlider.xaml @@ -0,0 +1,298 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ServerManager.Common/Controls/AnnotatedCheckBoxAndLongSlider.xaml.cs b/src/ServerManager.Common/Controls/AnnotatedCheckBoxAndLongSlider.xaml.cs new file mode 100644 index 00000000..3f03e3a9 --- /dev/null +++ b/src/ServerManager.Common/Controls/AnnotatedCheckBoxAndLongSlider.xaml.cs @@ -0,0 +1,152 @@ +using ServerManagerTool.Common.Model; +using System.Windows; +using System.Windows.Controls; + +namespace ServerManagerTool.Common.Controls +{ + /// + /// Interaction logic for AnnotatedSlider.xaml + /// + public partial class AnnotatedCheckBoxAndLongSlider : UserControl + { + public static readonly DependencyProperty LabelProperty = DependencyProperty.Register(nameof(Label), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider)); + public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(nameof(Value), typeof(NullableValue), typeof(AnnotatedCheckBoxAndLongSlider), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + public static readonly DependencyProperty SuffixProperty = DependencyProperty.Register(nameof(Suffix), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider)); + public static readonly DependencyProperty MinimumProperty = DependencyProperty.Register(nameof(Minimum), typeof(float), typeof(AnnotatedCheckBoxAndLongSlider)); + public static readonly DependencyProperty MaximumProperty = DependencyProperty.Register(nameof(Maximum), typeof(float), typeof(AnnotatedCheckBoxAndLongSlider)); + public static readonly DependencyProperty LargeChangeProperty = DependencyProperty.Register(nameof(LargeChange), typeof(float), typeof(AnnotatedCheckBoxAndLongSlider)); + public static readonly DependencyProperty SmallChangeProperty = DependencyProperty.Register(nameof(SmallChange), typeof(float), typeof(AnnotatedCheckBoxAndLongSlider)); + public static readonly DependencyProperty TickFrequencyProperty = DependencyProperty.Register(nameof(TickFrequency), typeof(float), typeof(AnnotatedCheckBoxAndLongSlider)); + public static readonly DependencyProperty LabelRelativeWidthProperty = DependencyProperty.Register(nameof(LabelRelativeWidth), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider), new PropertyMetadata("4*")); + public static readonly DependencyProperty LabelRelativeMinWidthProperty = DependencyProperty.Register(nameof(LabelRelativeMinWidth), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider), new PropertyMetadata("0")); + public static readonly DependencyProperty SliderRelativeWidthProperty = DependencyProperty.Register(nameof(SliderRelativeWidth), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider), new PropertyMetadata("8*")); + public static readonly DependencyProperty SliderRelativeMinWidthProperty = DependencyProperty.Register(nameof(SliderRelativeMinWidth), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider), new PropertyMetadata("0")); + public static readonly DependencyProperty ValueRelativeWidthProperty = DependencyProperty.Register(nameof(ValueRelativeWidth), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider), new PropertyMetadata("2*")); + public static readonly DependencyProperty ValueRelativeMinWidthProperty = DependencyProperty.Register(nameof(ValueRelativeMinWidth), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider), new PropertyMetadata("50")); + public static readonly DependencyProperty ValueRelativeMinHeightProperty = DependencyProperty.Register(nameof(ValueRelativeMinHeight), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider), new PropertyMetadata("25")); + public static readonly DependencyProperty SuffixRelativeWidthProperty = DependencyProperty.Register(nameof(SuffixRelativeWidth), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider), new PropertyMetadata("1*")); + public static readonly DependencyProperty SuffixRelativeMinWidthProperty = DependencyProperty.Register(nameof(SuffixRelativeMinWidth), typeof(string), typeof(AnnotatedCheckBoxAndLongSlider), new PropertyMetadata("0")); + + public AnnotatedCheckBoxAndLongSlider() + { + InitializeComponent(); + + Value = new NullableValue(); + + (this.Content as FrameworkElement).DataContext = this; + } + + public string Label + { + get { return (string)GetValue(LabelProperty); } + set { SetValue(LabelProperty, value); } + } + + public NullableValue Value + { + get { return (NullableValue)GetValue(ValueProperty); } + set { SetValue(ValueProperty, value); } + } + + public string Suffix + { + get { return (string)GetValue(SuffixProperty); } + set { SetValue(SuffixProperty, value); } + } + + public float Minimum + { + get { return (float)GetValue(MinimumProperty); } + set { SetValue(MinimumProperty, value); } + } + + public float Maximum + { + get { return (float)GetValue(MaximumProperty); } + set { SetValue(MaximumProperty, value); } + } + + public float LargeChange + { + get { return (float)GetValue(LargeChangeProperty); } + set { SetValue(LargeChangeProperty, value); } + } + + public float SmallChange + { + get { return (float)GetValue(SmallChangeProperty); } + set { SetValue(SmallChangeProperty, value); } + } + + public float TickFrequency + { + get { return (float)GetValue(TickFrequencyProperty); } + set { SetValue(TickFrequencyProperty, value); } + } + + public string LabelRelativeWidth + { + get { return (string)GetValue(LabelRelativeWidthProperty); } + set { SetValue(LabelRelativeWidthProperty, value); } + } + + public string LabelRelativeMinWidth + { + get { return (string)GetValue(LabelRelativeMinWidthProperty); } + set { SetValue(LabelRelativeMinWidthProperty, value); } + } + + public string SliderRelativeWidth + { + get { return (string)GetValue(SliderRelativeWidthProperty); } + set { SetValue(SliderRelativeWidthProperty, value); } + } + + public string SliderRelativeMinWidth + { + get { return (string)GetValue(SliderRelativeMinWidthProperty); } + set { SetValue(SliderRelativeMinWidthProperty, value); } + } + + public string ValueRelativeWidth + { + get { return (string)GetValue(ValueRelativeWidthProperty); } + set { SetValue(ValueRelativeWidthProperty, value); } + } + + public string ValueRelativeMinWidth + { + get { return (string)GetValue(ValueRelativeMinWidthProperty); } + set { SetValue(ValueRelativeMinWidthProperty, value); } + } + + public string ValueRelativeMinHeight + { + get { return (string)GetValue(ValueRelativeMinHeightProperty); } + set { SetValue(ValueRelativeMinHeightProperty, value); } + } + + public string SuffixRelativeWidth + { + get { return (string)GetValue(SuffixRelativeWidthProperty); } + set { SetValue(SuffixRelativeWidthProperty, value); } + } + + public string SuffixRelativeMinWidth + { + get { return (string)GetValue(SuffixRelativeMinWidthProperty); } + set { SetValue(SuffixRelativeMinWidthProperty, value); } + } + + private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + if (Slider.IsFocused) + { + unchecked + { + Value.Value = (long)e.NewValue; + } + } + } + } +} diff --git a/src/ServerManager.Common/ServerManager.Common.csproj b/src/ServerManager.Common/ServerManager.Common.csproj index a198879e..249bb7b6 100644 --- a/src/ServerManager.Common/ServerManager.Common.csproj +++ b/src/ServerManager.Common/ServerManager.Common.csproj @@ -11,6 +11,9 @@ none false + + + @@ -21,6 +24,9 @@ + + MSBuild:Compile +