From 699fc41a7d72ec680c35ab36f3e18d54639d9b93 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 4 Dec 2018 23:31:39 -0500 Subject: cleanup, add release note --- .../StateTracking/FieldWatchers/ComparableListWatcher.cs | 3 ++- .../StateTracking/FieldWatchers/ComparableWatcher.cs | 13 +++++++------ .../StateTracking/FieldWatchers/NetCollectionWatcher.cs | 3 ++- .../StateTracking/FieldWatchers/NetDictionaryWatcher.cs | 2 +- .../StateTracking/FieldWatchers/NetValueWatcher.cs | 14 ++++++++------ .../FieldWatchers/ObservableCollectionWatcher.cs | 3 ++- 6 files changed, 22 insertions(+), 16 deletions(-) (limited to 'src/SMAPI/Framework/StateTracking') diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableListWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableListWatcher.cs index 95e9ef16..2ea6609a 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableListWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableListWatcher.cs @@ -4,6 +4,7 @@ using System.Linq; namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers { /// A watcher which detects changes to a collection of values using a specified instance. + /// The value type within the collection. internal class ComparableListWatcher : BaseDisposableWatcher, ICollectionWatcher { /********* @@ -18,7 +19,7 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers /// The pairs added since the last reset. private readonly List AddedImpl = new List(); - /// The pairs demoved since the last reset. + /// The pairs removed since the last reset. private readonly List RemovedImpl = new List(); diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableWatcher.cs index d51fc2ac..dda30a15 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableWatcher.cs @@ -4,26 +4,27 @@ using System.Collections.Generic; namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers { /// A watcher which detects changes to a value using a specified instance. - internal class ComparableWatcher : IValueWatcher + /// The comparable value type. + internal class ComparableWatcher : IValueWatcher { /********* ** Properties *********/ /// Get the current value. - private readonly Func GetValue; + private readonly Func GetValue; /// The equality comparer. - private readonly IEqualityComparer Comparer; + private readonly IEqualityComparer Comparer; /********* ** Accessors *********/ /// The field value at the last reset. - public T PreviousValue { get; private set; } + public TValue PreviousValue { get; private set; } /// The latest value. - public T CurrentValue { get; private set; } + public TValue CurrentValue { get; private set; } /// Whether the value changed since the last reset. public bool IsChanged { get; private set; } @@ -35,7 +36,7 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers /// Construct an instance. /// Get the current value. /// The equality comparer which indicates whether two values are the same. - public ComparableWatcher(Func getValue, IEqualityComparer comparer) + public ComparableWatcher(Func getValue, IEqualityComparer comparer) { this.GetValue = getValue; this.Comparer = comparer; diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/NetCollectionWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/NetCollectionWatcher.cs index 8a841a79..d3022a69 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/NetCollectionWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/NetCollectionWatcher.cs @@ -4,6 +4,7 @@ using Netcode; namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers { /// A watcher which detects changes to a Netcode collection. + /// The value type within the collection. internal class NetCollectionWatcher : BaseDisposableWatcher, ICollectionWatcher where TValue : class, INetObject { @@ -16,7 +17,7 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers /// The pairs added since the last reset. private readonly List AddedImpl = new List(); - /// The pairs demoved since the last reset. + /// The pairs removed since the last reset. private readonly List RemovedImpl = new List(); diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/NetDictionaryWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/NetDictionaryWatcher.cs index 7a2bf84e..7a7ab89d 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/NetDictionaryWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/NetDictionaryWatcher.cs @@ -20,7 +20,7 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers /// The pairs added since the last reset. private readonly IDictionary PairsAdded = new Dictionary(); - /// The pairs demoved since the last reset. + /// The pairs removed since the last reset. private readonly IDictionary PairsRemoved = new Dictionary(); /// The field being watched. diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/NetValueWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/NetValueWatcher.cs index 188ed9f3..85099988 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/NetValueWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/NetValueWatcher.cs @@ -3,13 +3,15 @@ using Netcode; namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers { /// A watcher which detects changes to a net value field. - internal class NetValueWatcher : BaseDisposableWatcher, IValueWatcher where TSelf : NetFieldBase + /// The value type wrapped by the net field. + /// The net field type. + internal class NetValueWatcher : BaseDisposableWatcher, IValueWatcher where TNetField : NetFieldBase { /********* ** Properties *********/ /// The field being watched. - private readonly NetFieldBase Field; + private readonly NetFieldBase Field; /********* @@ -19,10 +21,10 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers public bool IsChanged { get; private set; } /// The field value at the last reset. - public T PreviousValue { get; private set; } + public TValue PreviousValue { get; private set; } /// The latest value. - public T CurrentValue { get; private set; } + public TValue CurrentValue { get; private set; } /********* @@ -30,7 +32,7 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers *********/ /// Construct an instance. /// The field to watch. - public NetValueWatcher(NetFieldBase field) + public NetValueWatcher(NetFieldBase field) { this.Field = field; this.PreviousValue = field.Value; @@ -74,7 +76,7 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers /// The field being watched. /// The old field value. /// The new field value. - private void OnValueChanged(TSelf field, T oldValue, T newValue) + private void OnValueChanged(TNetField field, TValue oldValue, TValue newValue) { this.CurrentValue = newValue; this.IsChanged = true; diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/ObservableCollectionWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/ObservableCollectionWatcher.cs index 34a97097..0c65789f 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/ObservableCollectionWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/ObservableCollectionWatcher.cs @@ -6,6 +6,7 @@ using System.Linq; namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers { /// A watcher which detects changes to an observable collection. + /// The value type within the collection. internal class ObservableCollectionWatcher : BaseDisposableWatcher, ICollectionWatcher { /********* @@ -17,7 +18,7 @@ namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers /// The pairs added since the last reset. private readonly List AddedImpl = new List(); - /// The pairs demoved since the last reset. + /// The pairs removed since the last reset. private readonly List RemovedImpl = new List(); -- cgit