mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
更新NuGet库
This commit is contained in:
parent
85d22dbb96
commit
bcd1b6f1df
131
.editorconfig
131
.editorconfig
@ -7,3 +7,134 @@ dotnet_diagnostic.CS1573.severity = suggestion
|
||||
dotnet_diagnostic.CS1570.severity = suggestion
|
||||
# CS8632: 只能在 "#nullable" 注释上下文内的代码中使用可为 null 的引用类型的注释。
|
||||
dotnet_diagnostic.CS8632.severity = suggestion
|
||||
|
||||
[*.cs]
|
||||
#### 命名样式 ####
|
||||
|
||||
# 命名规则
|
||||
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
|
||||
|
||||
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
|
||||
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
|
||||
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
|
||||
|
||||
# 符号规范
|
||||
|
||||
dotnet_naming_symbols.interface.applicable_kinds = interface
|
||||
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.interface.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
|
||||
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.types.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
|
||||
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.non_field_members.required_modifiers =
|
||||
|
||||
# 命名样式
|
||||
|
||||
dotnet_naming_style.begins_with_i.required_prefix = I
|
||||
dotnet_naming_style.begins_with_i.required_suffix =
|
||||
dotnet_naming_style.begins_with_i.word_separator =
|
||||
dotnet_naming_style.begins_with_i.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style.pascal_case.required_prefix =
|
||||
dotnet_naming_style.pascal_case.required_suffix =
|
||||
dotnet_naming_style.pascal_case.word_separator =
|
||||
dotnet_naming_style.pascal_case.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style.pascal_case.required_prefix =
|
||||
dotnet_naming_style.pascal_case.required_suffix =
|
||||
dotnet_naming_style.pascal_case.word_separator =
|
||||
dotnet_naming_style.pascal_case.capitalization = pascal_case
|
||||
csharp_using_directive_placement = outside_namespace:silent
|
||||
csharp_style_expression_bodied_methods = false:silent
|
||||
csharp_style_expression_bodied_constructors = false:silent
|
||||
csharp_style_expression_bodied_operators = false:silent
|
||||
csharp_style_expression_bodied_properties = true:silent
|
||||
csharp_style_expression_bodied_indexers = true:silent
|
||||
csharp_style_expression_bodied_accessors = true:silent
|
||||
csharp_style_expression_bodied_lambdas = true:silent
|
||||
csharp_style_expression_bodied_local_functions = false:silent
|
||||
csharp_style_conditional_delegate_call = true:suggestion
|
||||
csharp_style_var_for_built_in_types = false:silent
|
||||
csharp_style_var_when_type_is_apparent = false:silent
|
||||
csharp_style_var_elsewhere = false:silent
|
||||
csharp_prefer_simple_using_statement = true:suggestion
|
||||
csharp_prefer_braces = true:silent
|
||||
csharp_style_namespace_declarations = file_scoped:silent
|
||||
csharp_style_prefer_method_group_conversion = true:silent
|
||||
csharp_style_prefer_top_level_statements = true:silent
|
||||
csharp_style_prefer_primary_constructors = true:suggestion
|
||||
csharp_prefer_static_local_function = true:suggestion
|
||||
csharp_style_prefer_readonly_struct = true:suggestion
|
||||
csharp_space_around_binary_operators = before_and_after
|
||||
csharp_indent_labels = one_less_than_current
|
||||
|
||||
[*.vb]
|
||||
#### 命名样式 ####
|
||||
|
||||
# 命名规则
|
||||
|
||||
dotnet_naming_rule.interface_should_be_以_i_开始.severity = suggestion
|
||||
dotnet_naming_rule.interface_should_be_以_i_开始.symbols = interface
|
||||
dotnet_naming_rule.interface_should_be_以_i_开始.style = 以_i_开始
|
||||
|
||||
dotnet_naming_rule.类型_should_be_帕斯卡拼写法.severity = suggestion
|
||||
dotnet_naming_rule.类型_should_be_帕斯卡拼写法.symbols = 类型
|
||||
dotnet_naming_rule.类型_should_be_帕斯卡拼写法.style = 帕斯卡拼写法
|
||||
|
||||
dotnet_naming_rule.非字段成员_should_be_帕斯卡拼写法.severity = suggestion
|
||||
dotnet_naming_rule.非字段成员_should_be_帕斯卡拼写法.symbols = 非字段成员
|
||||
dotnet_naming_rule.非字段成员_should_be_帕斯卡拼写法.style = 帕斯卡拼写法
|
||||
|
||||
# 符号规范
|
||||
|
||||
dotnet_naming_symbols.interface.applicable_kinds = interface
|
||||
dotnet_naming_symbols.interface.applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected
|
||||
dotnet_naming_symbols.interface.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.类型.applicable_kinds = class, struct, interface, enum
|
||||
dotnet_naming_symbols.类型.applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected
|
||||
dotnet_naming_symbols.类型.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.非字段成员.applicable_kinds = property, event, method
|
||||
dotnet_naming_symbols.非字段成员.applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected
|
||||
dotnet_naming_symbols.非字段成员.required_modifiers =
|
||||
|
||||
# 命名样式
|
||||
|
||||
dotnet_naming_style.以_i_开始.required_prefix = I
|
||||
dotnet_naming_style.以_i_开始.required_suffix =
|
||||
dotnet_naming_style.以_i_开始.word_separator =
|
||||
dotnet_naming_style.以_i_开始.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style.帕斯卡拼写法.required_prefix =
|
||||
dotnet_naming_style.帕斯卡拼写法.required_suffix =
|
||||
dotnet_naming_style.帕斯卡拼写法.word_separator =
|
||||
dotnet_naming_style.帕斯卡拼写法.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style.帕斯卡拼写法.required_prefix =
|
||||
dotnet_naming_style.帕斯卡拼写法.required_suffix =
|
||||
dotnet_naming_style.帕斯卡拼写法.word_separator =
|
||||
dotnet_naming_style.帕斯卡拼写法.capitalization = pascal_case
|
||||
|
||||
[*.{cs,vb}]
|
||||
end_of_line = crlf
|
||||
dotnet_style_qualification_for_field = false:silent
|
||||
dotnet_style_qualification_for_property = false:silent
|
||||
dotnet_style_qualification_for_method = false:silent
|
||||
dotnet_style_qualification_for_event = false:silent
|
||||
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
|
||||
indent_size = 4
|
||||
tab_width = 4
|
||||
dotnet_style_operator_placement_when_wrapping = beginning_of_line
|
||||
dotnet_diagnostic.CA1416.severity = none
|
@ -23,10 +23,10 @@
|
||||
<None Include="..\.editorconfig" Link=".editorconfig" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="LinePutScript" Version="1.10.2" />
|
||||
<PackageReference Include="LinePutScript" Version="1.11.1" />
|
||||
<PackageReference Include="LinePutScript.Localization.WPF" Version="1.0.6" />
|
||||
<PackageReference Include="Panuon.WPF" Version="1.0.3" />
|
||||
<PackageReference Include="Panuon.WPF.UI" Version="1.1.17.3" />
|
||||
<PackageReference Include="Panuon.WPF" Version="1.0.4" />
|
||||
<PackageReference Include="Panuon.WPF.UI" Version="1.1.17.5" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
|
@ -16,9 +16,9 @@
|
||||
<ProjectReference Include="..\VPet-Simulator.Core\VPet-Simulator.Core.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="LinePutScript" Version="1.10.2" />
|
||||
<PackageReference Include="LinePutScript" Version="1.11.1" />
|
||||
<PackageReference Include="LinePutScript.Localization.WPF" Version="1.0.6" />
|
||||
<PackageReference Include="Panuon.WPF" Version="1.0.3" />
|
||||
<PackageReference Include="Panuon.WPF.UI" Version="1.1.17.3" />
|
||||
<PackageReference Include="Panuon.WPF" Version="1.0.4" />
|
||||
<PackageReference Include="Panuon.WPF.UI" Version="1.1.17.5" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -205,12 +205,12 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Facepunch.Steamworks" Condition="'$(Platform)' == 'x64'" Version="2.3.3" />
|
||||
<PackageReference Include="Facepunch.Steamworks.win32" Condition="'$(Platform)' == 'x86'" Version="2.3.3" />
|
||||
<PackageReference Include="LinePutScript" Version="1.10.2" />
|
||||
<PackageReference Include="LinePutScript" Version="1.11.1" />
|
||||
<PackageReference Include="LinePutScript.Localization.WPF" Version="1.0.6" />
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||
<PackageReference Include="NAudio" Version="2.2.1" />
|
||||
<PackageReference Include="Panuon.WPF" Version="1.0.4" />
|
||||
<PackageReference Include="Panuon.WPF.UI" Version="1.1.17.3" />
|
||||
<PackageReference Include="Panuon.WPF.UI" Version="1.1.17.5" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\VPet-Simulator.Core\VPet-Simulator.Core.csproj" />
|
||||
|
233
VPet.Solution/Models/SettingEditor/ModModel.cs
Normal file
233
VPet.Solution/Models/SettingEditor/ModModel.cs
Normal file
@ -0,0 +1,233 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Media.Imaging;
|
||||
using LinePutScript.Localization.WPF;
|
||||
|
||||
namespace VPet.Solution.Models.SettingEditor;
|
||||
|
||||
public class ModModel : ObservableClass<ModModel>
|
||||
{
|
||||
#region ID
|
||||
private string _id = string.Empty;
|
||||
public string ID
|
||||
{
|
||||
get => _id;
|
||||
set => SetProperty(ref _id, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Name
|
||||
private string _name = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[ReflectionProperty(nameof(ModLoader.Name))]
|
||||
public string Name
|
||||
{
|
||||
get => _name;
|
||||
set => SetProperty(ref _name, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Description
|
||||
private string _description = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
/// </summary>
|
||||
[ReflectionProperty(nameof(ModLoader.Intro))]
|
||||
public string Description
|
||||
{
|
||||
get => _description;
|
||||
set => SetProperty(ref _description, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Author
|
||||
private string _author = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 作者
|
||||
/// </summary>
|
||||
[ReflectionProperty(nameof(ModLoader.Author))]
|
||||
public string Author
|
||||
{
|
||||
get => _author;
|
||||
set => SetProperty(ref _author, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ModVersion
|
||||
private int _modVersion;
|
||||
|
||||
/// <summary>
|
||||
/// 模组版本
|
||||
/// </summary>
|
||||
[ReflectionProperty(nameof(ModLoader.Ver))]
|
||||
public int ModVersion
|
||||
{
|
||||
get => _modVersion;
|
||||
set => SetProperty(ref _modVersion, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GameVersion
|
||||
private int _gameVersion;
|
||||
|
||||
/// <summary>
|
||||
/// 游戏版本
|
||||
/// </summary>
|
||||
[ReflectionProperty(nameof(ModLoader.GameVer))]
|
||||
public int GameVersion
|
||||
{
|
||||
get => _gameVersion;
|
||||
set => SetProperty(ref _gameVersion, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Tags
|
||||
private HashSet<string> _tags = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 功能
|
||||
/// </summary>
|
||||
[ReflectionProperty(nameof(ModLoader.Tags))]
|
||||
public HashSet<string> Tags
|
||||
{
|
||||
get => _tags;
|
||||
set => SetProperty(ref _tags, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Image
|
||||
private BitmapImage _image = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 图像
|
||||
/// </summary>
|
||||
[ReflectionProperty(nameof(ModLoader.Image))]
|
||||
public BitmapImage Image
|
||||
{
|
||||
get => _image;
|
||||
set => SetProperty(ref _image, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ItemId
|
||||
private ulong _itemId;
|
||||
|
||||
[ReflectionProperty(nameof(ModLoader.ItemID))]
|
||||
public ulong ItemId
|
||||
{
|
||||
get => _itemId;
|
||||
set => SetProperty(ref _itemId, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region ModPath
|
||||
|
||||
private string _modPath = string.Empty;
|
||||
|
||||
[ReflectionProperty(nameof(ModLoader.ModPath))]
|
||||
public string ModPath
|
||||
{
|
||||
get => _modPath;
|
||||
set => SetProperty(ref _modPath, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IsEnabled
|
||||
private bool? _isEnabled = true;
|
||||
|
||||
/// <summary>
|
||||
/// 启用状态
|
||||
/// <para>已启用为 <see langword="true"/> 已禁用为 <see langword="false"/> 已失效为 <see langword="null"/></para>
|
||||
/// </summary>
|
||||
public bool? IsEnabled
|
||||
{
|
||||
get => _isEnabled;
|
||||
set => SetProperty(ref _isEnabled, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IsPass
|
||||
private bool _isPass;
|
||||
|
||||
/// <summary>
|
||||
/// 是通过检查的代码模组
|
||||
/// </summary>
|
||||
public bool IsPass
|
||||
{
|
||||
get => _isPass;
|
||||
set => SetProperty(ref _isPass, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IsMsg
|
||||
private bool _isMsg;
|
||||
|
||||
/// <summary>
|
||||
/// 是含有代码的模组
|
||||
/// </summary>
|
||||
public bool IsMsg
|
||||
{
|
||||
get => _isMsg;
|
||||
set => SetProperty(ref _isMsg, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region State
|
||||
private string _state = string.Empty;
|
||||
public string State
|
||||
{
|
||||
get => _state;
|
||||
set => SetProperty(ref _state, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
public ModModel()
|
||||
{
|
||||
IsEnabled = null;
|
||||
RefreshState();
|
||||
}
|
||||
|
||||
private void ModModel_PropertyChanged(
|
||||
object? sender,
|
||||
System.ComponentModel.PropertyChangedEventArgs e
|
||||
)
|
||||
{
|
||||
if (e.PropertyName == nameof(IsEnabled))
|
||||
{
|
||||
RefreshState();
|
||||
}
|
||||
}
|
||||
|
||||
public ModModel(ModLoader loader)
|
||||
{
|
||||
PropertyChanged += ModModel_PropertyChanged;
|
||||
ReflectionUtils.SetValue(loader, this);
|
||||
RefreshState();
|
||||
ID = Name;
|
||||
Name = Name.Translate();
|
||||
Description = Description.Translate();
|
||||
LocalizeCore.BindingNotify.PropertyChanged += BindingNotify_PropertyChanged;
|
||||
}
|
||||
|
||||
private void BindingNotify_PropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
Name = Name.Translate();
|
||||
Description = Description.Translate();
|
||||
}
|
||||
|
||||
public void RefreshState()
|
||||
{
|
||||
if (IsEnabled is true)
|
||||
State = "已启用".Translate();
|
||||
else if (IsEnabled is false)
|
||||
State = "已禁用".Translate();
|
||||
else
|
||||
State = "已损坏".Translate();
|
||||
}
|
||||
}
|
@ -1,16 +1,14 @@
|
||||
using HKW.HKWUtils.Observable;
|
||||
using LinePutScript;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using LinePutScript;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using VPet.Solution.Views.SettingEditor;
|
||||
using VPet_Simulator.Windows.Interface;
|
||||
|
||||
@ -23,7 +21,7 @@ public class ModSettingModel : ObservableClass<ModSettingModel>
|
||||
public const string MsgModLineName = "msgmod";
|
||||
public const string WorkShopLineName = "workshop";
|
||||
public static string ModDirectory = Path.Combine(Environment.CurrentDirectory, "mod");
|
||||
public static Dictionary<string, ModLoader> LocalMods { get; private set; } = null;
|
||||
public static Dictionary<string, ModLoader> LocalMods { get; private set; } = null!;
|
||||
|
||||
#region Mods
|
||||
private ObservableCollection<ModModel> _mods = new();
|
||||
@ -117,230 +115,3 @@ public class ModSettingModel : ObservableClass<ModSettingModel>
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class ModModel : ObservableClass<ModModel>
|
||||
{
|
||||
#region ID
|
||||
private string _id;
|
||||
public string ID
|
||||
{
|
||||
get => _id;
|
||||
set => SetProperty(ref _id, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Name
|
||||
private string _name;
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[ReflectionProperty(nameof(ModLoader.Name))]
|
||||
public string Name
|
||||
{
|
||||
get => _name;
|
||||
set => SetProperty(ref _name, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Description
|
||||
private string _description;
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
/// </summary>
|
||||
[ReflectionProperty(nameof(ModLoader.Intro))]
|
||||
public string Description
|
||||
{
|
||||
get => _description;
|
||||
set => SetProperty(ref _description, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Author
|
||||
private string _author;
|
||||
|
||||
/// <summary>
|
||||
/// 作者
|
||||
/// </summary>
|
||||
[ReflectionProperty(nameof(ModLoader.Author))]
|
||||
public string Author
|
||||
{
|
||||
get => _author;
|
||||
set => SetProperty(ref _author, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ModVersion
|
||||
private int _modVersion;
|
||||
|
||||
/// <summary>
|
||||
/// 模组版本
|
||||
/// </summary>
|
||||
[ReflectionProperty(nameof(ModLoader.Ver))]
|
||||
public int ModVersion
|
||||
{
|
||||
get => _modVersion;
|
||||
set => SetProperty(ref _modVersion, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GameVersion
|
||||
private int _gameVersion;
|
||||
|
||||
/// <summary>
|
||||
/// 游戏版本
|
||||
/// </summary>
|
||||
[ReflectionProperty(nameof(ModLoader.GameVer))]
|
||||
public int GameVersion
|
||||
{
|
||||
get => _gameVersion;
|
||||
set => SetProperty(ref _gameVersion, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Tags
|
||||
private HashSet<string> _tags;
|
||||
|
||||
/// <summary>
|
||||
/// 功能
|
||||
/// </summary>
|
||||
[ReflectionProperty(nameof(ModLoader.Tags))]
|
||||
public HashSet<string> Tags
|
||||
{
|
||||
get => _tags;
|
||||
set => SetProperty(ref _tags, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Image
|
||||
private BitmapImage _image;
|
||||
|
||||
/// <summary>
|
||||
/// 图像
|
||||
/// </summary>
|
||||
[ReflectionProperty(nameof(ModLoader.Image))]
|
||||
public BitmapImage Image
|
||||
{
|
||||
get => _image;
|
||||
set => SetProperty(ref _image, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ItemId
|
||||
private ulong _itemId;
|
||||
|
||||
[ReflectionProperty(nameof(ModLoader.ItemID))]
|
||||
public ulong ItemId
|
||||
{
|
||||
get => _itemId;
|
||||
set => SetProperty(ref _itemId, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region ModPath
|
||||
|
||||
private string _modPath;
|
||||
|
||||
[ReflectionProperty(nameof(ModLoader.ModPath))]
|
||||
public string ModPath
|
||||
{
|
||||
get => _modPath;
|
||||
set => SetProperty(ref _modPath, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IsEnabled
|
||||
private bool? _isEnabled = true;
|
||||
|
||||
/// <summary>
|
||||
/// 已启用
|
||||
/// </summary>
|
||||
public bool? IsEnabled
|
||||
{
|
||||
get => _isEnabled;
|
||||
set => SetProperty(ref _isEnabled, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IsPass
|
||||
private bool _isPass;
|
||||
|
||||
/// <summary>
|
||||
/// 是通过检查的代码模组
|
||||
/// </summary>
|
||||
public bool IsPass
|
||||
{
|
||||
get => _isPass;
|
||||
set => SetProperty(ref _isPass, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IsMsg
|
||||
private bool _isMsg;
|
||||
|
||||
/// <summary>
|
||||
/// 是含有代码的模组
|
||||
/// </summary>
|
||||
public bool IsMsg
|
||||
{
|
||||
get => _isMsg;
|
||||
set => SetProperty(ref _isMsg, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region State
|
||||
private string _state;
|
||||
public string State
|
||||
{
|
||||
get => _state;
|
||||
set => SetProperty(ref _state, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
public ModModel()
|
||||
{
|
||||
IsEnabled = null;
|
||||
RefreshState();
|
||||
}
|
||||
|
||||
private void ModModel_PropertyChanged(
|
||||
object sender,
|
||||
System.ComponentModel.PropertyChangedEventArgs e
|
||||
)
|
||||
{
|
||||
if (e.PropertyName == nameof(IsEnabled))
|
||||
{
|
||||
RefreshState();
|
||||
}
|
||||
}
|
||||
|
||||
public ModModel(ModLoader loader)
|
||||
{
|
||||
PropertyChanged += ModModel_PropertyChanged;
|
||||
ReflectionUtils.SetValue(loader, this);
|
||||
RefreshState();
|
||||
ID = Name;
|
||||
Name = Name.Translate();
|
||||
Description = Description.Translate();
|
||||
LocalizeCore.BindingNotify.PropertyChanged += BindingNotify_PropertyChanged;
|
||||
}
|
||||
|
||||
private void BindingNotify_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
Name = Name.Translate();
|
||||
Description = Description.Translate();
|
||||
}
|
||||
|
||||
public void RefreshState()
|
||||
{
|
||||
if (IsEnabled is true)
|
||||
State = "已启用".Translate();
|
||||
else if (IsEnabled is false)
|
||||
State = "已关闭".Translate();
|
||||
else
|
||||
State = "已损坏".Translate();
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
using FastMember;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using LinePutScript;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
using FastMember;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using LinePutScript;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using VPet.Solution.Properties;
|
||||
using VPet_Simulator.Windows.Interface;
|
||||
|
||||
@ -131,7 +131,7 @@ public class SettingModel : ObservableClass<SettingModel>
|
||||
}
|
||||
}
|
||||
|
||||
private void Notify_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
private void Notify_PropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
IsChanged = true;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
using HKW.WPF.Extensions;
|
||||
using System.Windows;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using HKW.WPF.Extensions;
|
||||
|
||||
namespace HKW.WPF.Helpers;
|
||||
|
||||
@ -95,7 +95,7 @@ public static class ElementHelper
|
||||
element.KeyDown -= Element_KeyDown;
|
||||
element.KeyDown += Element_KeyDown;
|
||||
|
||||
static void Element_KeyDown(object sender, KeyEventArgs e)
|
||||
static void Element_KeyDown(object? sender, KeyEventArgs e)
|
||||
{
|
||||
if (sender is not FrameworkElement element)
|
||||
return;
|
||||
@ -184,7 +184,7 @@ public static class ElementHelper
|
||||
#endregion
|
||||
|
||||
#region Element
|
||||
static void Element_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
static void Element_SizeChanged(object? sender, SizeChangedEventArgs e)
|
||||
{
|
||||
if (sender is not FrameworkElement element)
|
||||
return;
|
||||
|
@ -340,7 +340,7 @@ public static class Extensions
|
||||
window.Activate();
|
||||
}
|
||||
|
||||
private static void WindowCloseState_Closing(object sender, CancelEventArgs e)
|
||||
private static void WindowCloseState_Closing(object? sender, CancelEventArgs e)
|
||||
{
|
||||
if (sender is not Window window)
|
||||
return;
|
||||
|
@ -19,11 +19,11 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FastMember" Version="1.5.0" />
|
||||
<PackageReference Include="LinePutScript" Version="1.10.2" />
|
||||
<PackageReference Include="LinePutScript" Version="1.11.1" />
|
||||
<PackageReference Include="LinePutScript.Localization.WPF" Version="1.0.6" />
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||
<PackageReference Include="Panuon.WPF" Version="1.0.3" />
|
||||
<PackageReference Include="Panuon.WPF.UI" Version="1.1.17.3" />
|
||||
<PackageReference Include="Panuon.WPF" Version="1.0.4" />
|
||||
<PackageReference Include="Panuon.WPF.UI" Version="1.1.17.5" />
|
||||
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,11 +1,11 @@
|
||||
using HKW.HKWUtils.Observable;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Panuon.WPF.UI;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Panuon.WPF.UI;
|
||||
using VPet.Solution.Models.SettingEditor;
|
||||
using VPet.Solution.ViewModels.SettingEditor;
|
||||
using VPet_Simulator.Windows.Interface;
|
||||
@ -14,14 +14,14 @@ namespace VPet.Solution.ViewModels;
|
||||
|
||||
public class MainWindowVM : ObservableClass<MainWindowVM>
|
||||
{
|
||||
private readonly SettingModel _mainSetting;
|
||||
private readonly SettingModel? _mainSetting;
|
||||
|
||||
public MainWindowVM()
|
||||
{
|
||||
LocalizeCore.StoreTranslation = true;
|
||||
LocalizeCore.LoadDefaultCulture();
|
||||
_mainSetting = SettingWindowVM.Current.ShowSettings.FirstOrDefault(
|
||||
m => m.Name == nameof(Setting)
|
||||
_mainSetting = SettingWindowVM.Current.ShowSettings.FirstOrDefault(m =>
|
||||
m.Name == nameof(Setting)
|
||||
);
|
||||
if (string.IsNullOrWhiteSpace(_mainSetting?.GraphicsSetting?.Language))
|
||||
CurrentCulture = LocalizeCore.CurrentCulture;
|
||||
@ -51,7 +51,7 @@ public class MainWindowVM : ObservableClass<MainWindowVM>
|
||||
}
|
||||
|
||||
#region Property
|
||||
public IEnumerable<string> AvailableCultures => LocalizeCore.AvailableCultures;
|
||||
public static IEnumerable<string> AvailableCultures => LocalizeCore.AvailableCultures;
|
||||
#region CurrentCulture
|
||||
private string _currentCulture = string.Empty;
|
||||
public string CurrentCulture
|
||||
@ -62,7 +62,8 @@ public class MainWindowVM : ObservableClass<MainWindowVM>
|
||||
SetProperty(ref _currentCulture, value);
|
||||
LocalizeCore.LoadCulture(_currentCulture);
|
||||
if (
|
||||
_mainSetting is not null && _mainSetting.GraphicsSetting.Language != _currentCulture
|
||||
_mainSetting is not null
|
||||
&& _mainSetting.GraphicsSetting.Language != _currentCulture
|
||||
)
|
||||
{
|
||||
_mainSetting.GraphicsSetting.Language = _currentCulture;
|
||||
|
@ -1,8 +1,4 @@
|
||||
using HKW.HKWUtils.Observable;
|
||||
using LinePutScript;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Panuon.WPF.UI;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
@ -10,6 +6,10 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using LinePutScript;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Panuon.WPF.UI;
|
||||
using VPet.Solution.Models;
|
||||
using VPet.Solution.Models.SaveViewer;
|
||||
using VPet.Solution.Models.SettingEditor;
|
||||
@ -20,10 +20,10 @@ namespace VPet.Solution.ViewModels.SaveViewer;
|
||||
|
||||
public class SaveWindowVM : ObservableClass<SaveWindowVM>
|
||||
{
|
||||
public static SaveWindowVM Current { get; private set; }
|
||||
public static SaveWindowVM Current { get; private set; } = null!;
|
||||
|
||||
#region Properties
|
||||
private SaveModel _currentSave;
|
||||
private SaveModel _currentSave = null!;
|
||||
public SaveModel CurrentSave
|
||||
{
|
||||
get => _currentSave;
|
||||
@ -32,14 +32,14 @@ public class SaveWindowVM : ObservableClass<SaveWindowVM>
|
||||
|
||||
private readonly ObservableCollection<SaveModel> _saves = new();
|
||||
|
||||
private IEnumerable<SaveModel> _showSaves;
|
||||
private IEnumerable<SaveModel> _showSaves = null!;
|
||||
public IEnumerable<SaveModel> ShowSaves
|
||||
{
|
||||
get => _showSaves;
|
||||
set => SetProperty(ref _showSaves, value);
|
||||
}
|
||||
|
||||
private string _searchSave;
|
||||
private string _searchSave = string.Empty;
|
||||
public string SearchSave
|
||||
{
|
||||
get => _searchSave;
|
||||
@ -85,12 +85,12 @@ public class SaveWindowVM : ObservableClass<SaveWindowVM>
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
ShowSaves = _saves;
|
||||
else
|
||||
ShowSaves = _saves.Where(
|
||||
s => s.Name.Contains(SearchSave, StringComparison.OrdinalIgnoreCase)
|
||||
ShowSaves = _saves.Where(s =>
|
||||
s.Name.Contains(SearchSave, StringComparison.OrdinalIgnoreCase)
|
||||
);
|
||||
}
|
||||
|
||||
private void SaveWindowVM_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
private void SaveWindowVM_PropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == nameof(SearchSave))
|
||||
{
|
||||
|
@ -1,8 +1,4 @@
|
||||
using HKW.HKWUtils.Observable;
|
||||
using LinePutScript;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Panuon.WPF;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
@ -10,6 +6,10 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using LinePutScript;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Panuon.WPF;
|
||||
using VPet.Solution.Models;
|
||||
using VPet.Solution.Models.SettingEditor;
|
||||
using VPet.Solution.Views.SettingEditor;
|
||||
@ -19,9 +19,9 @@ namespace VPet.Solution.ViewModels.SettingEditor;
|
||||
|
||||
public class SettingWindowVM : ObservableClass<SettingWindowVM>
|
||||
{
|
||||
public static SettingWindowVM Current { get; private set; }
|
||||
public static SettingWindowVM Current { get; private set; } = null!;
|
||||
#region Properties
|
||||
private SettingModel _currentSetting;
|
||||
private SettingModel _currentSetting = null!;
|
||||
public SettingModel CurrentSetting
|
||||
{
|
||||
get => _currentSetting;
|
||||
@ -47,25 +47,30 @@ public class SettingWindowVM : ObservableClass<SettingWindowVM>
|
||||
return;
|
||||
}
|
||||
}
|
||||
SetProperty(ref _currentSetting, value);
|
||||
SetProperty(ref _currentSetting!, value);
|
||||
}
|
||||
}
|
||||
|
||||
private readonly ObservableCollection<SettingModel> _settings = new();
|
||||
public readonly ObservableCollection<SettingModel> Settings = new();
|
||||
|
||||
private IEnumerable<SettingModel> _showSettings;
|
||||
#region ShowSettings
|
||||
private IEnumerable<SettingModel> _showSettings = null!;
|
||||
public IEnumerable<SettingModel> ShowSettings
|
||||
{
|
||||
get => _showSettings;
|
||||
set => SetProperty(ref _showSettings, value);
|
||||
}
|
||||
|
||||
private string _searchSetting;
|
||||
#endregion
|
||||
|
||||
#region SearchSetting
|
||||
private string _searchSetting = string.Empty;
|
||||
public string SearchSetting
|
||||
{
|
||||
get => _searchSetting;
|
||||
set => SetProperty(ref _searchSetting, value);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
@ -104,7 +109,7 @@ public class SettingWindowVM : ObservableClass<SettingWindowVM>
|
||||
{
|
||||
Current = this;
|
||||
LoadSettings();
|
||||
ShowSettings = _settings = new(_settings.OrderBy(m => m.Name));
|
||||
ShowSettings = Settings = new(Settings.OrderBy(m => m.Name));
|
||||
|
||||
PropertyChanged += MainWindowVM_PropertyChanged;
|
||||
OpenFileCommand.ExecuteCommand += OpenFileCommand_ExecuteCommand;
|
||||
@ -128,8 +133,8 @@ public class SettingWindowVM : ObservableClass<SettingWindowVM>
|
||||
is not MessageBoxResult.Yes
|
||||
)
|
||||
return;
|
||||
for (var i = 0; i < _settings.Count; i++)
|
||||
_settings[i] = new SettingModel();
|
||||
for (var i = 0; i < Settings.Count; i++)
|
||||
Settings[i] = new SettingModel();
|
||||
}
|
||||
|
||||
private void OpenFileInExplorerCommand_ExecuteCommand(SettingModel parameter)
|
||||
@ -155,7 +160,7 @@ public class SettingWindowVM : ObservableClass<SettingWindowVM>
|
||||
is not MessageBoxResult.Yes
|
||||
)
|
||||
return;
|
||||
foreach (var setting in _settings)
|
||||
foreach (var setting in Settings)
|
||||
setting.Save();
|
||||
}
|
||||
|
||||
@ -177,7 +182,7 @@ public class SettingWindowVM : ObservableClass<SettingWindowVM>
|
||||
is not MessageBoxResult.Yes
|
||||
)
|
||||
return;
|
||||
CurrentSetting = _settings[_settings.IndexOf(CurrentSetting)] = new SettingModel()
|
||||
CurrentSetting = Settings[Settings.IndexOf(CurrentSetting)] = new SettingModel()
|
||||
{
|
||||
Name = CurrentSetting.Name,
|
||||
FilePath = CurrentSetting.FilePath
|
||||
@ -188,14 +193,14 @@ public class SettingWindowVM : ObservableClass<SettingWindowVM>
|
||||
public void RefreshShowSettings(string name)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
ShowSettings = _settings;
|
||||
ShowSettings = Settings;
|
||||
else
|
||||
ShowSettings = _settings.Where(
|
||||
s => s.Name.Contains(SearchSetting, StringComparison.OrdinalIgnoreCase)
|
||||
ShowSettings = Settings.Where(s =>
|
||||
s.Name.Contains(SearchSetting, StringComparison.OrdinalIgnoreCase)
|
||||
);
|
||||
}
|
||||
|
||||
private void MainWindowVM_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
private void MainWindowVM_PropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == nameof(SearchSetting))
|
||||
{
|
||||
@ -212,7 +217,7 @@ public class SettingWindowVM : ObservableClass<SettingWindowVM>
|
||||
{
|
||||
var setting = new Setting(File.ReadAllText(file));
|
||||
var settingModel = new SettingModel(setting) { Name = fileName, FilePath = file };
|
||||
_settings.Add(settingModel);
|
||||
Settings.Add(settingModel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -231,7 +236,7 @@ public class SettingWindowVM : ObservableClass<SettingWindowVM>
|
||||
)
|
||||
return;
|
||||
var setting = new SettingModel() { Name = fileName, FilePath = file };
|
||||
_settings.Add(setting);
|
||||
Settings.Add(setting);
|
||||
setting.Save();
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
using HKW.HKWUtils;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Panuon.WPF.UI;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using HKW.HKWUtils;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Panuon.WPF.UI;
|
||||
using VPet.Solution.Models.SettingEditor;
|
||||
using VPet.Solution.ViewModels;
|
||||
using VPet.Solution.Views.SaveViewer;
|
||||
@ -35,18 +35,20 @@ public partial class MainWindow : WindowX
|
||||
Closed += MainWindow_Closed;
|
||||
}
|
||||
|
||||
private void MainWindow_Closed(object sender, EventArgs e)
|
||||
private void MainWindow_Closed(object? sender, EventArgs e)
|
||||
{
|
||||
foreach (var mod in ModSettingModel.LocalMods)
|
||||
mod.Value.Image?.CloseStream();
|
||||
SettingWindow.CloseX();
|
||||
SaveWindow.CloseX();
|
||||
}
|
||||
|
||||
private void Button_OpenSettingEditor_Click(object sender, RoutedEventArgs e)
|
||||
private void Button_OpenSettingEditor_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
SettingWindow.ShowOrActivate();
|
||||
}
|
||||
|
||||
private void Button_OpenSaveViewer_Click(object sender, RoutedEventArgs e)
|
||||
private void Button_OpenSaveViewer_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
SaveWindow.ShowOrActivate();
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
using HKW.HKWUtils;
|
||||
using Panuon.WPF.UI;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using HKW.HKWUtils;
|
||||
using Panuon.WPF.UI;
|
||||
using VPet.Solution.ViewModels.SaveViewer;
|
||||
using VPet.Solution.ViewModels.SettingEditor;
|
||||
|
||||
@ -28,7 +28,7 @@ public partial class SaveWindow : WindowX
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
private void Frame_Main_ContentRendered(object sender, EventArgs e)
|
||||
private void Frame_Main_ContentRendered(object? sender, EventArgs e)
|
||||
{
|
||||
if (sender is not Frame frame)
|
||||
return;
|
||||
|
@ -1,5 +1,4 @@
|
||||
using HKW.HKWUtils;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -13,6 +12,7 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using HKW.HKWUtils;
|
||||
using VPet.Solution.ViewModels.SettingEditor;
|
||||
|
||||
namespace VPet.Solution.Views.SettingEditor;
|
||||
@ -30,7 +30,7 @@ public partial class GraphicsSettingPage : Page
|
||||
this.SetViewModel<GraphicsSettingPageVM>();
|
||||
}
|
||||
|
||||
private void Button_StartPoint_Click(object sender, RoutedEventArgs e)
|
||||
private void Button_StartPoint_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
ViewModel.GraphicsSetting.StartRecordPoint = new(
|
||||
SettingWindow.Instance.Left,
|
||||
|
@ -1,9 +1,9 @@
|
||||
using HKW.HKWUtils;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Panuon.WPF.UI;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using HKW.HKWUtils;
|
||||
using LinePutScript.Localization.WPF;
|
||||
using Panuon.WPF.UI;
|
||||
using VPet.Solution.ViewModels.SettingEditor;
|
||||
|
||||
namespace VPet.Solution.Views.SettingEditor;
|
||||
@ -32,7 +32,7 @@ public partial class SettingWindow : WindowX
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
private void SettingWindow_Closing(object sender, CancelEventArgs e)
|
||||
private void SettingWindow_Closing(object? sender, CancelEventArgs e)
|
||||
{
|
||||
if (ViewModel?.CurrentSetting?.IsChanged is true)
|
||||
{
|
||||
@ -61,7 +61,7 @@ public partial class SettingWindow : WindowX
|
||||
}
|
||||
}
|
||||
|
||||
private void Frame_Main_ContentRendered(object sender, EventArgs e)
|
||||
private void Frame_Main_ContentRendered(object? sender, EventArgs e)
|
||||
{
|
||||
if (sender is not Frame frame)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user