From 6fbff26184615bb0900a7882f031f9060b40d810 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 2 Dec 2020 12:52:12 -0800 Subject: [PATCH] Simplify expression #433 --- NHSE.Core/Structures/Villager/Villager1.cs | 2 +- NHSE.Core/Structures/Villager/Villager2.cs | 2 +- NHSE.WinForms/Subforms/Villager/VillagerDIYTimerEditor.cs | 6 ------ 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/NHSE.Core/Structures/Villager/Villager1.cs b/NHSE.Core/Structures/Villager/Villager1.cs index 6dedbf3..18316fa 100644 --- a/NHSE.Core/Structures/Villager/Villager1.cs +++ b/NHSE.Core/Structures/Villager/Villager1.cs @@ -119,7 +119,7 @@ public DesignPatternPRO Design public byte DIYEndHour { get => Data[0x129D1]; set => Data[0x129D1] = value; } public byte DIYEndMinute { get => Data[0x129D2]; set => Data[0x129D2] = value; } public byte DIYEndSecond { get => Data[0x129D3]; set => Data[0x129D3] = value; } - public ushort DIYRecipeIndex { get => Data.Slice(0x129D4, sizeof(ushort)).ToStructure(); set => value.ToBytes().CopyTo(Data, 0x129D4); } + public ushort DIYRecipeIndex { get => BitConverter.ToUInt16(Data, 0x129D4); set => BitConverter.GetBytes(value).CopyTo(Data, 0x129D4); } public void SetFriendshipAll(byte value = byte.MaxValue) { diff --git a/NHSE.Core/Structures/Villager/Villager2.cs b/NHSE.Core/Structures/Villager/Villager2.cs index 696c5f9..bf55775 100644 --- a/NHSE.Core/Structures/Villager/Villager2.cs +++ b/NHSE.Core/Structures/Villager/Villager2.cs @@ -119,7 +119,7 @@ public DesignPatternPRO Design public byte DIYEndHour { get => Data[0x13151]; set => Data[0x13151] = value; } public byte DIYEndMinute { get => Data[0x13152]; set => Data[0x13152] = value; } public byte DIYEndSecond { get => Data[0x13153]; set => Data[0x13153] = value; } - public ushort DIYRecipeIndex { get => Data.Slice(0x13154, sizeof(ushort)).ToStructure(); set => value.ToBytes().CopyTo(Data, 0x13154); } + public ushort DIYRecipeIndex { get => BitConverter.ToUInt16(Data, 0x13154); set => BitConverter.GetBytes(value).CopyTo(Data, 0x13154); } public void SetFriendshipAll(byte value = byte.MaxValue) { diff --git a/NHSE.WinForms/Subforms/Villager/VillagerDIYTimerEditor.cs b/NHSE.WinForms/Subforms/Villager/VillagerDIYTimerEditor.cs index f5d1b82..939333e 100644 --- a/NHSE.WinForms/Subforms/Villager/VillagerDIYTimerEditor.cs +++ b/NHSE.WinForms/Subforms/Villager/VillagerDIYTimerEditor.cs @@ -1,12 +1,6 @@ using NHSE.Core; using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; namespace NHSE.WinForms