From bbd44a6adbf3ed4d08d93ac0cd3de96008ff9cfd Mon Sep 17 00:00:00 2001 From: Will Bennion Date: Wed, 29 Apr 2020 09:33:18 +0100 Subject: [PATCH 1/3] Fixed crash with the parameter picker when choosing a new path, it has a SelectPathChanged handler and the existing path is empty. --- .../Project-Aurora/Controls/GameStateParameterPicker.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project-Aurora/Project-Aurora/Controls/GameStateParameterPicker.xaml.cs b/Project-Aurora/Project-Aurora/Controls/GameStateParameterPicker.xaml.cs index ded1e4a62..9db498c68 100644 --- a/Project-Aurora/Project-Aurora/Controls/GameStateParameterPicker.xaml.cs +++ b/Project-Aurora/Project-Aurora/Controls/GameStateParameterPicker.xaml.cs @@ -118,7 +118,7 @@ private static void SelectedPathDPChanged(DependencyObject sender, DependencyPro } // Raise an event informing subscribers - picker.SelectedPathChanged?.Invoke(picker, new SelectedPathChangedEventArgs(e.OldValue.ToString(), e.NewValue.ToString())); + picker.SelectedPathChanged?.Invoke(picker, new SelectedPathChangedEventArgs(e.OldValue?.ToString() ?? "", e.NewValue?.ToString() ?? "")); } #endregion From c92a71db3715be8ebe9e4bbbea03747120f84472 Mon Sep 17 00:00:00 2001 From: Will Bennion Date: Thu, 30 Apr 2020 10:37:18 +0100 Subject: [PATCH 2/3] Fixed issue with TypeAnnotatedObjectConverter when it gets a null value. --- .../Project-Aurora/Utils/JSONUtils.cs | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/Project-Aurora/Project-Aurora/Utils/JSONUtils.cs b/Project-Aurora/Project-Aurora/Utils/JSONUtils.cs index 4479e4c28..5a2836f8a 100755 --- a/Project-Aurora/Project-Aurora/Utils/JSONUtils.cs +++ b/Project-Aurora/Project-Aurora/Utils/JSONUtils.cs @@ -77,17 +77,23 @@ public class TypeAnnotatedObjectConverter : JsonConverter { public override bool CanConvert(Type objectType) => true; public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { - // TODO: add some sort of error handling, e.g. in case of the targetType being inaccessible? + // If this is a null token, then the original value was null. + if (reader.TokenType == JsonToken.Null) return null; - reader.Read(); // Read "$type" property name - reader.Read(); // Read "$type" value - var typeName = reader.Value?.ToString(); // Find the type based on the fully-qualified name from the $type. This will be null if the original value was null - reader.Read(); // Read "$value" property name - reader.Read(); // Read "$value" value - var value = typeName == null ? null : JsonConvert.DeserializeObject(reader.Value.ToString(), Type.GetType(typeName)); // The $value is a JSON-encoded string, so decode as the requested type - reader.Read(); // Read end of object (if this is not done, it breaks the next converter) + // Read "$type" property + reader.Read(); // Property name + reader.Read(); // Property value + var typeName = reader.Value.ToString(); // Find the type based on the fully-qualified name from the $type. This will be null if the original value was null - return value; + // Read "$value" property + reader.Read(); // Property name + reader.Read(); // Property value + var value = reader.Value.ToString(); + + // Read end of object '}' (if this is not done, it breaks the next converter) + reader.Read(); + + return JsonConvert.DeserializeObject(value.ToString(), Type.GetType(typeName)); // The $value is a JSON-encoded string, so decode as the requested type; } public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { From 358eb3412090246e5189f21b08ce84f3e9b66fa3 Mon Sep 17 00:00:00 2001 From: Will Bennion Date: Thu, 30 Apr 2020 10:38:46 +0100 Subject: [PATCH 3/3] Updated links to the new documentation pages. --- .../Settings/Layers/Control_AnimationLayer.xaml.cs | 2 +- .../Settings/Overrides/Control_OverridesEditor.xaml.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Project-Aurora/Project-Aurora/Settings/Layers/Control_AnimationLayer.xaml.cs b/Project-Aurora/Project-Aurora/Settings/Layers/Control_AnimationLayer.xaml.cs index b5b0acd80..10c2b50f8 100644 --- a/Project-Aurora/Project-Aurora/Settings/Layers/Control_AnimationLayer.xaml.cs +++ b/Project-Aurora/Project-Aurora/Settings/Layers/Control_AnimationLayer.xaml.cs @@ -238,7 +238,7 @@ private void stackModeCb_SelectionChanged(object sender, SelectionChangedEventAr private void btnInfo_Click(object sender, RoutedEventArgs e) { // Open the online documentation for the Animation Trigger properties - Process.Start(new ProcessStartInfo(@"https://wibble199.github.io/Aurora-Docs/docs/advanced-topics/animation-editor.html")); + Process.Start(new ProcessStartInfo(@"https://wibble199.github.io/Aurora-Docs/advanced-topics/animation-editor/")); } private void whileKeyHeldTerminate_Checked(object sender, RoutedEventArgs e) { diff --git a/Project-Aurora/Project-Aurora/Settings/Overrides/Control_OverridesEditor.xaml.cs b/Project-Aurora/Project-Aurora/Settings/Overrides/Control_OverridesEditor.xaml.cs index 180661806..a793df2cc 100644 --- a/Project-Aurora/Project-Aurora/Settings/Overrides/Control_OverridesEditor.xaml.cs +++ b/Project-Aurora/Project-Aurora/Settings/Overrides/Control_OverridesEditor.xaml.cs @@ -138,7 +138,7 @@ public void ForcePropertyListUpdate() { private void HelpButton_Click(object sender, RoutedEventArgs e) { // Open the overrides page on the documentation page - Process.Start(new ProcessStartInfo(@"https://wibble199.github.io/Aurora-Docs/docs/advanced-topics/overrides-system.html")); + Process.Start(new ProcessStartInfo(@"https://wibble199.github.io/Aurora-Docs/advanced-topics/overrides-system/")); } #endregion }