diff --git a/VPet.Solution/Models/SaveViewer/SaveModel.cs b/VPet.Solution/Models/SaveViewer/SaveModel.cs index 58e26d0..4b7b878 100644 --- a/VPet.Solution/Models/SaveViewer/SaveModel.cs +++ b/VPet.Solution/Models/SaveViewer/SaveModel.cs @@ -124,10 +124,10 @@ public class SaveModel : ObservableClass #endregion #region Mode - private VPet_Simulator.Core.GameSave.ModeType _mode; + private VPet_Simulator.Core.IGameSave.ModeType _mode; - [ReflectionProperty(nameof(VPet_Simulator.Core.GameSave.Mode))] - public VPet_Simulator.Core.GameSave.ModeType Mode + [ReflectionProperty(nameof(VPet_Simulator.Core.IGameSave.Mode))] + public VPet_Simulator.Core.IGameSave.ModeType Mode { get => _mode; set => SetProperty(ref _mode, value); @@ -219,7 +219,7 @@ public class SaveModel : ObservableClass } } - private void LoadSave(VPet_Simulator.Core.GameSave save) + private void LoadSave(VPet_Simulator.Core.IGameSave save) { ReflectionUtils.SetValue(save, this); } diff --git a/VPet.Solution/Models/SettingEditor/InteractiveSettingModel.cs b/VPet.Solution/Models/SettingEditor/InteractiveSettingModel.cs index 602b797..74e1c1b 100644 --- a/VPet.Solution/Models/SettingEditor/InteractiveSettingModel.cs +++ b/VPet.Solution/Models/SettingEditor/InteractiveSettingModel.cs @@ -51,20 +51,20 @@ public class InteractiveSettingModel : ObservableClass #endregion #region CalFunState - private GameSave.ModeType _calFunState; + private IGameSave.ModeType _calFunState; /// /// 非计算模式下默认模式 /// [ReflectionProperty(nameof(VPet_Simulator.Windows.Interface.Setting.CalFunState))] - public GameSave.ModeType CalFunState + public IGameSave.ModeType CalFunState { get => _calFunState; set => SetProperty(ref _calFunState, value); } - public ObservableCollection ModeTypes { get; } = - new(Enum.GetValues(typeof(GameSave.ModeType)).Cast()); + public ObservableCollection ModeTypes { get; } = + new(Enum.GetValues(typeof(IGameSave.ModeType)).Cast()); #endregion #region LastCacheDate diff --git a/VPet.Solution/Utils/Expansions.cs b/VPet.Solution/Utils/Expansions.cs index 6e78a73..02f2268 100644 --- a/VPet.Solution/Utils/Expansions.cs +++ b/VPet.Solution/Utils/Expansions.cs @@ -28,29 +28,6 @@ public static class Extensions return source.IndexOf(value, comparisonType) >= 0; } - public static TSource MaxBy( - this IEnumerable source, - Func keySelector - ) - { - using IEnumerator e = source.GetEnumerator(); - if (e.MoveNext() is false) - return default; - TSource value = e.Current; - TKey key = keySelector(value); - while (e.MoveNext()) - { - TSource nextValue = e.Current; - TKey nextKey = keySelector(nextValue); - if (Comparer.Default.Compare(nextKey, key) > 0) - { - key = nextKey; - value = nextValue; - } - } - return value; - } - //public static string GetSourceFile(this BitmapImage image) //{ // return ((FileStream)image.StreamSource).Name;