diff --git a/NHSE.Parsing/BCSV/BCSV.cs b/NHSE.Parsing/BCSV/BCSV.cs index 4a8dfe2..4c290bd 100644 --- a/NHSE.Parsing/BCSV/BCSV.cs +++ b/NHSE.Parsing/BCSV/BCSV.cs @@ -77,11 +77,19 @@ private string ReadFieldUnknownType(in int offset, in int fieldIndex) 1 => Data[offset].ToString(), 2 => BitConverter.ToInt16(Data, offset).ToString(), 4 => EnumLookup[BitConverter.ToUInt32(Data, offset)], + 5 => $"0x{FiveByteLong(offset):X10}", 8 => $"0x{BitConverter.ToUInt64(Data, offset):X16}", _ => Encoding.UTF8.GetString(Data, offset, length), }; } + private ulong FiveByteLong(in int offset) + { + var tmpBytes = new byte[8]; + Array.Copy(Data, offset, tmpBytes, 0, 5); + return BitConverter.ToUInt64(tmpBytes, 0); + } + private int GetFieldLength(in int i) { var next = (i + 1 == FieldCount) ? (int)(EntryLength) : FieldOffsets[i + 1].Offset; diff --git a/NHSE.Sprites/Item/ItemSprite.cs b/NHSE.Sprites/Item/ItemSprite.cs index 095b377..741134b 100644 --- a/NHSE.Sprites/Item/ItemSprite.cs +++ b/NHSE.Sprites/Item/ItemSprite.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Drawing; using System.IO; +using System.Linq; using NHSE.Core; using NHSE.Sprites.Properties; @@ -9,36 +10,19 @@ namespace NHSE.Sprites { public static class ItemSprite { - private static readonly Dictionary FileLookup = new Dictionary(); - private static string[] ItemNames = Array.Empty(); + private static string[] ItemNames = Array.Empty(); // currently only used as length check for FieldItem - public static void Initialize(string path, string[] itemNames) + // %appdata%/NHSE + public static string PlatformAppDataPath { get; } = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(NHSE)); + public static string PlatformAppDataImagePath { get; } = Path.Combine(PlatformAppDataPath, "img"); + public static bool SingleSpriteExists { get => Directory.EnumerateFileSystemEntries(PlatformAppDataImagePath).Any(); } + + public static void Initialize(string[] itemNames) { - var lookup = FileLookup; - if (lookup.Count > 0) - return; - ItemNames = itemNames; - //create items folder if not exist - if (!Directory.Exists(path)) - Directory.CreateDirectory(path); - - var files = Directory.EnumerateFiles(path, "*.png", SearchOption.AllDirectories); - foreach (var f in files) - { - var fn = Path.GetFileNameWithoutExtension(f); - if (fn == null) - continue; - lookup[fn.ToLower()] = f; - var index = fn.IndexOf('('); - if (index < 0) - continue; - - var simplerName = fn.Substring(0, index - 1); - if (!lookup.ContainsKey(simplerName)) - lookup.Add(simplerName, f); - } + if (!Directory.Exists(PlatformAppDataImagePath)) + Directory.CreateDirectory(PlatformAppDataImagePath); } public static Bitmap GetItemMarkup(Item item, Font font, int width, int height, Bitmap backing) @@ -49,15 +33,16 @@ public static Bitmap GetItemMarkup(Item item, Font font, int width, int height, public static Image? GetItemSprite(Item item) { var id = item.ItemId; - return GetItemSprite(id); + var count = item.Count; + return GetItemSprite(id, count); } - public static Image? GetItemSprite(ushort id) + public static Image? GetItemSprite(ushort id, ushort count = 0) { if (id == Item.NONE) return null; - if (!GetItemImageSprite(id, out var path)) + if (!GetItemImageSprite(id, out var path, count)) { if (!GetMenuIconSprite(id, out var img)) return Resources.leaf; @@ -80,37 +65,49 @@ public static Bitmap GetItemMarkup(Item item, Font font, int width, int height, private static bool GetMenuIconSprite(ushort id, out Image? img) { - ItemMenuIconType iconType = ItemInfo.GetMenuIcon(id); + id = TryGetFieldItemId(id, ItemNames.Length); + var iconType = ItemInfo.GetMenuIcon(id); img = (Image?)Resources.ResourceManager.GetObject(iconType == ItemMenuIconType.Leaf ? iconType.ToString() + "1" : iconType.ToString()); // the 1 stops the original "leaf" being overwritten return img != null; } - private static bool GetItemImageSprite(ushort id, out string? path) + private static bool GetItemImageSprite(ushort id, out string? path, ushort count = 0) { path = string.Empty; - var str = ItemNames; - if (id >= str.Length) + id = TryGetFieldItemId(id, ItemNames.Length); + + var name = $"{id:00000}_{count}"; + if (SpriteFileExists(name, out path)) + return true; + + name = $"{id:00000}_0"; // fallback to no variation + if (SpriteFileExists(name, out path)) + return true; + + return false; + } + + private static bool SpriteFileExists(string filename, out string? path) + { + path = Path.Combine(PlatformAppDataImagePath, filename + ".png"); + return File.Exists(path); + } + + private static ushort TryGetFieldItemId(ushort id, int length) + { + if (id >= length) { if (!FieldItemList.Items.TryGetValue(id, out var definition)) - return false; + return id; var remap = definition.HeldItemId; - if (remap >= str.Length) - return false; + if (remap >= length) + return id; id = remap; } - var name = str[id].ToLower(); - if (FileLookup.TryGetValue(name, out path)) - return true; - - var index = name.IndexOf('('); - if (index <= 0) - return false; - - var simple = name.Substring(0, index - 1); - return FileLookup.TryGetValue(simple, out path); + return id; } public static Bitmap? GetImage(Item item, Font font, int width, int height) diff --git a/NHSE.WinForms/Controls/ItemEditor.Designer.cs b/NHSE.WinForms/Controls/ItemEditor.Designer.cs index 3932dc2..19207e4 100644 --- a/NHSE.WinForms/Controls/ItemEditor.Designer.cs +++ b/NHSE.WinForms/Controls/ItemEditor.Designer.cs @@ -143,6 +143,7 @@ private void InitializeComponent() this.NUD_Count.Name = "NUD_Count"; this.NUD_Count.Size = new System.Drawing.Size(56, 20); this.NUD_Count.TabIndex = 2; + this.NUD_Count.ValueChanged += new System.EventHandler(this.NUD_Count_ValueChanged); // // L_Count // diff --git a/NHSE.WinForms/Controls/ItemEditor.cs b/NHSE.WinForms/Controls/ItemEditor.cs index 8ae09ff..f3bb6df 100644 --- a/NHSE.WinForms/Controls/ItemEditor.cs +++ b/NHSE.WinForms/Controls/ItemEditor.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Drawing; using System.Linq; using System.Windows.Forms; using NHSE.Core; @@ -174,7 +175,8 @@ private Item SetExtensionItem(Item item) private void CB_ItemID_SelectedValueChanged(object sender, EventArgs e) { var itemID = (ushort)WinFormsUtil.GetIndex(CB_ItemID); - ChangeItem(itemID); + var itemCount = (ushort)NUD_Count.Value; + ChangeItem(itemID, itemCount); var kind = ItemInfo.GetItemKind(itemID); ToggleEditorVisibility(kind); @@ -336,11 +338,11 @@ private void CHK_IsExtension_CheckedChanged(object sender, EventArgs e) } } - private void ChangeItem(ushort item) + private void ChangeItem(ushort item, ushort count) { var pb = PB_Item; pb.BackColor = ItemColor.GetItemColor(item); - pb.BackgroundImage = ItemSprite.GetItemSprite(item); + pb.BackgroundImage = ItemSprite.GetItemSprite(item, count); } private void CHK_Wrapped_CheckedChanged(object sender, EventArgs e) @@ -359,5 +361,12 @@ private void CB_ItemID_TextChanged(object sender, EventArgs e) var caption = string.Join(Environment.NewLine, itemNames); TT_Search.SetToolTip(CB_ItemID, caption); } + + private void NUD_Count_ValueChanged(object sender, EventArgs e) + { + var itemID = (ushort)WinFormsUtil.GetIndex(CB_ItemID); + var itemCount = (ushort)NUD_Count.Value; + ChangeItem(itemID, itemCount); + } } } diff --git a/NHSE.WinForms/Editor.Designer.cs b/NHSE.WinForms/Editor.Designer.cs index 8fc7afd..5149f63 100644 --- a/NHSE.WinForms/Editor.Designer.cs +++ b/NHSE.WinForms/Editor.Designer.cs @@ -98,6 +98,7 @@ private void InitializeComponent() this.CB_Players = new System.Windows.Forms.ComboBox(); this.PB_Player = new System.Windows.Forms.PictureBox(); this.TC_Editors = new System.Windows.Forms.TabControl(); + this.Menu_ItemImages = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_Editor.SuspendLayout(); this.CM_Picture.SuspendLayout(); this.Tab_Map.SuspendLayout(); @@ -126,8 +127,7 @@ private void InitializeComponent() this.Menu_Options}); this.Menu_Editor.Location = new System.Drawing.Point(0, 0); this.Menu_Editor.Name = "Menu_Editor"; - this.Menu_Editor.Padding = new System.Windows.Forms.Padding(8, 2, 0, 2); - this.Menu_Editor.Size = new System.Drawing.Size(539, 28); + this.Menu_Editor.Size = new System.Drawing.Size(404, 24); this.Menu_Editor.TabIndex = 0; this.Menu_Editor.Text = "menuStrip1"; // @@ -136,14 +136,14 @@ private void InitializeComponent() this.Menu_File.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.Menu_Save}); this.Menu_File.Name = "Menu_File"; - this.Menu_File.Size = new System.Drawing.Size(46, 24); + this.Menu_File.Size = new System.Drawing.Size(37, 20); this.Menu_File.Text = "File"; // // Menu_Save // this.Menu_Save.Name = "Menu_Save"; this.Menu_Save.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); - this.Menu_Save.Size = new System.Drawing.Size(173, 26); + this.Menu_Save.Size = new System.Drawing.Size(138, 22); this.Menu_Save.Text = "Save"; this.Menu_Save.Click += new System.EventHandler(this.Menu_Save_Click); // @@ -153,16 +153,17 @@ private void InitializeComponent() this.Menu_DumpDecrypted, this.Menu_VerifyHashes, this.Menu_LoadDecrypted, - this.Menu_RAMEdit}); + this.Menu_RAMEdit, + this.Menu_ItemImages}); this.Menu_Tools.Name = "Menu_Tools"; - this.Menu_Tools.Size = new System.Drawing.Size(58, 24); + this.Menu_Tools.Size = new System.Drawing.Size(46, 20); this.Menu_Tools.Text = "Tools"; // // Menu_DumpDecrypted // this.Menu_DumpDecrypted.Name = "Menu_DumpDecrypted"; this.Menu_DumpDecrypted.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D))); - this.Menu_DumpDecrypted.Size = new System.Drawing.Size(259, 26); + this.Menu_DumpDecrypted.Size = new System.Drawing.Size(206, 22); this.Menu_DumpDecrypted.Text = "Dump Decrypted"; this.Menu_DumpDecrypted.Click += new System.EventHandler(this.Menu_DumpDecrypted_Click); // @@ -170,7 +171,7 @@ private void InitializeComponent() // this.Menu_VerifyHashes.Name = "Menu_VerifyHashes"; this.Menu_VerifyHashes.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.H))); - this.Menu_VerifyHashes.Size = new System.Drawing.Size(259, 26); + this.Menu_VerifyHashes.Size = new System.Drawing.Size(206, 22); this.Menu_VerifyHashes.Text = "Verify Hashes"; this.Menu_VerifyHashes.Click += new System.EventHandler(this.Menu_VerifyHashes_Click); // @@ -178,7 +179,7 @@ private void InitializeComponent() // this.Menu_LoadDecrypted.Name = "Menu_LoadDecrypted"; this.Menu_LoadDecrypted.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.L))); - this.Menu_LoadDecrypted.Size = new System.Drawing.Size(259, 26); + this.Menu_LoadDecrypted.Size = new System.Drawing.Size(206, 22); this.Menu_LoadDecrypted.Text = "Load Decrypted"; this.Menu_LoadDecrypted.Click += new System.EventHandler(this.Menu_LoadDecrypted_Click); // @@ -186,7 +187,7 @@ private void InitializeComponent() // this.Menu_RAMEdit.Name = "Menu_RAMEdit"; this.Menu_RAMEdit.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R))); - this.Menu_RAMEdit.Size = new System.Drawing.Size(259, 26); + this.Menu_RAMEdit.Size = new System.Drawing.Size(206, 22); this.Menu_RAMEdit.Text = "RAM Edit"; this.Menu_RAMEdit.Click += new System.EventHandler(this.Menu_RAMEdit_Click); // @@ -196,7 +197,7 @@ private void InitializeComponent() this.Menu_Language, this.Menu_Settings}); this.Menu_Options.Name = "Menu_Options"; - this.Menu_Options.Size = new System.Drawing.Size(75, 24); + this.Menu_Options.Size = new System.Drawing.Size(61, 20); this.Menu_Options.Text = "Options"; // // Menu_Language @@ -213,14 +214,14 @@ private void InitializeComponent() "简体中文", "繁體中文"}); this.Menu_Language.Name = "Menu_Language"; - this.Menu_Language.Size = new System.Drawing.Size(115, 28); + this.Menu_Language.Size = new System.Drawing.Size(115, 23); this.Menu_Language.SelectedIndexChanged += new System.EventHandler(this.Menu_Language_SelectedIndexChanged); // // Menu_Settings // this.Menu_Settings.Name = "Menu_Settings"; this.Menu_Settings.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P))); - this.Menu_Settings.Size = new System.Drawing.Size(195, 26); + this.Menu_Settings.Size = new System.Drawing.Size(175, 22); this.Menu_Settings.Text = "Settings"; this.Menu_Settings.Click += new System.EventHandler(this.Menu_Settings_Click); // @@ -231,12 +232,12 @@ private void InitializeComponent() this.Menu_SavePNG}); this.CM_Picture.Name = "CM_Picture"; this.CM_Picture.ShowImageMargin = false; - this.CM_Picture.Size = new System.Drawing.Size(118, 28); + this.CM_Picture.Size = new System.Drawing.Size(101, 26); // // Menu_SavePNG // this.Menu_SavePNG.Name = "Menu_SavePNG"; - this.Menu_SavePNG.Size = new System.Drawing.Size(117, 24); + this.Menu_SavePNG.Size = new System.Drawing.Size(100, 22); this.Menu_SavePNG.Text = "Save .png"; this.Menu_SavePNG.Click += new System.EventHandler(this.Menu_SavePNG_Click); // @@ -256,11 +257,10 @@ private void InitializeComponent() this.Tab_Map.Controls.Add(this.B_EditPatterns); this.Tab_Map.Controls.Add(this.B_EditTurnipExchange); this.Tab_Map.Controls.Add(this.B_RecycleBin); - this.Tab_Map.Location = new System.Drawing.Point(4, 25); - this.Tab_Map.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.Tab_Map.Location = new System.Drawing.Point(4, 22); this.Tab_Map.Name = "Tab_Map"; - this.Tab_Map.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.Tab_Map.Size = new System.Drawing.Size(531, 264); + this.Tab_Map.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); + this.Tab_Map.Size = new System.Drawing.Size(396, 212); this.Tab_Map.TabIndex = 2; this.Tab_Map.Text = "Map"; this.Tab_Map.UseVisualStyleBackColor = true; @@ -268,15 +268,14 @@ private void InitializeComponent() // NUD_WeatherSeed // this.NUD_WeatherSeed.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.NUD_WeatherSeed.Location = new System.Drawing.Point(269, 73); - this.NUD_WeatherSeed.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.NUD_WeatherSeed.Location = new System.Drawing.Point(202, 59); this.NUD_WeatherSeed.Maximum = new decimal(new int[] { -1, 0, 0, 0}); this.NUD_WeatherSeed.Name = "NUD_WeatherSeed"; - this.NUD_WeatherSeed.Size = new System.Drawing.Size(124, 23); + this.NUD_WeatherSeed.Size = new System.Drawing.Size(93, 20); this.NUD_WeatherSeed.TabIndex = 65; this.NUD_WeatherSeed.Value = new decimal(new int[] { 1234567890, @@ -287,19 +286,17 @@ private void InitializeComponent() // L_WeatherSeed // this.L_WeatherSeed.AutoSize = true; - this.L_WeatherSeed.Location = new System.Drawing.Point(401, 81); - this.L_WeatherSeed.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.L_WeatherSeed.Location = new System.Drawing.Point(301, 66); this.L_WeatherSeed.Name = "L_WeatherSeed"; - this.L_WeatherSeed.Size = new System.Drawing.Size(99, 17); + this.L_WeatherSeed.Size = new System.Drawing.Size(76, 13); this.L_WeatherSeed.TabIndex = 64; this.L_WeatherSeed.Text = "Weather Seed"; // // B_EditDesignsTailor // - this.B_EditDesignsTailor.Location = new System.Drawing.Point(400, 121); - this.B_EditDesignsTailor.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.B_EditDesignsTailor.Location = new System.Drawing.Point(300, 98); this.B_EditDesignsTailor.Name = "B_EditDesignsTailor"; - this.B_EditDesignsTailor.Size = new System.Drawing.Size(123, 49); + this.B_EditDesignsTailor.Size = new System.Drawing.Size(92, 40); this.B_EditDesignsTailor.TabIndex = 63; this.B_EditDesignsTailor.Text = "Edit Tailor Designs"; this.B_EditDesignsTailor.UseVisualStyleBackColor = true; @@ -307,10 +304,9 @@ private void InitializeComponent() // // B_EditPatternFlag // - this.B_EditPatternFlag.Location = new System.Drawing.Point(269, 121); - this.B_EditPatternFlag.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.B_EditPatternFlag.Location = new System.Drawing.Point(202, 98); this.B_EditPatternFlag.Name = "B_EditPatternFlag"; - this.B_EditPatternFlag.Size = new System.Drawing.Size(123, 49); + this.B_EditPatternFlag.Size = new System.Drawing.Size(92, 40); this.B_EditPatternFlag.TabIndex = 62; this.B_EditPatternFlag.Text = "Edit Flag Design"; this.B_EditPatternFlag.UseVisualStyleBackColor = true; @@ -320,29 +316,26 @@ private void InitializeComponent() // this.CB_AirportColor.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_AirportColor.FormattingEnabled = true; - this.CB_AirportColor.Location = new System.Drawing.Point(269, 39); - this.CB_AirportColor.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.CB_AirportColor.Location = new System.Drawing.Point(202, 32); this.CB_AirportColor.Name = "CB_AirportColor"; - this.CB_AirportColor.Size = new System.Drawing.Size(121, 24); + this.CB_AirportColor.Size = new System.Drawing.Size(92, 21); this.CB_AirportColor.TabIndex = 61; // // L_AirportColor // this.L_AirportColor.AutoSize = true; - this.L_AirportColor.Location = new System.Drawing.Point(400, 43); - this.L_AirportColor.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.L_AirportColor.Location = new System.Drawing.Point(300, 35); this.L_AirportColor.Name = "L_AirportColor"; - this.L_AirportColor.Size = new System.Drawing.Size(87, 17); + this.L_AirportColor.Size = new System.Drawing.Size(64, 13); this.L_AirportColor.TabIndex = 60; this.L_AirportColor.Text = "Airport Color"; // // L_Hemisphere // this.L_Hemisphere.AutoSize = true; - this.L_Hemisphere.Location = new System.Drawing.Point(400, 11); - this.L_Hemisphere.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.L_Hemisphere.Location = new System.Drawing.Point(300, 9); this.L_Hemisphere.Name = "L_Hemisphere"; - this.L_Hemisphere.Size = new System.Drawing.Size(84, 17); + this.L_Hemisphere.Size = new System.Drawing.Size(63, 13); this.L_Hemisphere.TabIndex = 58; this.L_Hemisphere.Text = "Hemisphere"; // @@ -350,19 +343,17 @@ private void InitializeComponent() // this.CB_Hemisphere.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Hemisphere.FormattingEnabled = true; - this.CB_Hemisphere.Location = new System.Drawing.Point(269, 7); - this.CB_Hemisphere.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.CB_Hemisphere.Location = new System.Drawing.Point(202, 6); this.CB_Hemisphere.Name = "CB_Hemisphere"; - this.CB_Hemisphere.Size = new System.Drawing.Size(121, 24); + this.CB_Hemisphere.Size = new System.Drawing.Size(92, 21); this.CB_Hemisphere.TabIndex = 57; // // B_EditPlayerHouses // this.B_EditPlayerHouses.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.B_EditPlayerHouses.Location = new System.Drawing.Point(8, 208); - this.B_EditPlayerHouses.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.B_EditPlayerHouses.Location = new System.Drawing.Point(6, 169); this.B_EditPlayerHouses.Name = "B_EditPlayerHouses"; - this.B_EditPlayerHouses.Size = new System.Drawing.Size(123, 49); + this.B_EditPlayerHouses.Size = new System.Drawing.Size(92, 40); this.B_EditPlayerHouses.TabIndex = 56; this.B_EditPlayerHouses.Text = "Edit Player Houses"; this.B_EditPlayerHouses.UseVisualStyleBackColor = true; @@ -371,10 +362,9 @@ private void InitializeComponent() // B_EditMap // this.B_EditMap.ContextMenuStrip = this.CM_EditMap; - this.B_EditMap.Location = new System.Drawing.Point(400, 207); - this.B_EditMap.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.B_EditMap.Location = new System.Drawing.Point(300, 168); this.B_EditMap.Name = "B_EditMap"; - this.B_EditMap.Size = new System.Drawing.Size(123, 49); + this.B_EditMap.Size = new System.Drawing.Size(92, 40); this.B_EditMap.TabIndex = 2; this.B_EditMap.Text = "Edit Map..."; this.B_EditMap.UseVisualStyleBackColor = true; @@ -391,56 +381,55 @@ private void InitializeComponent() this.B_EditMuseum_Click, this.B_EditVisitors}); this.CM_EditMap.Name = "CM_EditMap"; - this.CM_EditMap.Size = new System.Drawing.Size(203, 148); + this.CM_EditMap.Size = new System.Drawing.Size(172, 136); // // B_EditLandFlags // this.B_EditLandFlags.Name = "B_EditLandFlags"; - this.B_EditLandFlags.Size = new System.Drawing.Size(202, 24); + this.B_EditLandFlags.Size = new System.Drawing.Size(171, 22); this.B_EditLandFlags.Text = "Edit Flags"; this.B_EditLandFlags.Click += new System.EventHandler(this.B_EditLandFlags_Click); // // B_EditFieldItems // this.B_EditFieldItems.Name = "B_EditFieldItems"; - this.B_EditFieldItems.Size = new System.Drawing.Size(202, 24); + this.B_EditFieldItems.Size = new System.Drawing.Size(171, 22); this.B_EditFieldItems.Text = "Edit Field Items"; this.B_EditFieldItems.Click += new System.EventHandler(this.B_EditFieldItems_Click); // // B_EditBulletin // this.B_EditBulletin.Name = "B_EditBulletin"; - this.B_EditBulletin.Size = new System.Drawing.Size(202, 24); + this.B_EditBulletin.Size = new System.Drawing.Size(171, 22); this.B_EditBulletin.Text = "Edit Bulletin Board"; this.B_EditBulletin.Click += new System.EventHandler(this.B_EditBulletin_Click); // // B_EditFieldGoods // this.B_EditFieldGoods.Name = "B_EditFieldGoods"; - this.B_EditFieldGoods.Size = new System.Drawing.Size(202, 24); + this.B_EditFieldGoods.Size = new System.Drawing.Size(171, 22); this.B_EditFieldGoods.Text = "Edit Field Goods"; this.B_EditFieldGoods.Click += new System.EventHandler(this.B_EditFieldGoods_Click); // // B_EditMuseum_Click // this.B_EditMuseum_Click.Name = "B_EditMuseum_Click"; - this.B_EditMuseum_Click.Size = new System.Drawing.Size(202, 24); + this.B_EditMuseum_Click.Size = new System.Drawing.Size(171, 22); this.B_EditMuseum_Click.Text = "Edit Museum"; this.B_EditMuseum_Click.Click += new System.EventHandler(this.B_EditMuseum_Click_Click); // // B_EditVisitors // this.B_EditVisitors.Name = "B_EditVisitors"; - this.B_EditVisitors.Size = new System.Drawing.Size(202, 24); + this.B_EditVisitors.Size = new System.Drawing.Size(171, 22); this.B_EditVisitors.Text = "Edit Visitors"; this.B_EditVisitors.Click += new System.EventHandler(this.B_EditVisitors_Click); // // B_EditPRODesigns // - this.B_EditPRODesigns.Location = new System.Drawing.Point(139, 121); - this.B_EditPRODesigns.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.B_EditPRODesigns.Location = new System.Drawing.Point(104, 98); this.B_EditPRODesigns.Name = "B_EditPRODesigns"; - this.B_EditPRODesigns.Size = new System.Drawing.Size(123, 49); + this.B_EditPRODesigns.Size = new System.Drawing.Size(92, 40); this.B_EditPRODesigns.TabIndex = 55; this.B_EditPRODesigns.Text = "Edit PRO Designs"; this.B_EditPRODesigns.UseVisualStyleBackColor = true; @@ -448,10 +437,9 @@ private void InitializeComponent() // // B_EditPatterns // - this.B_EditPatterns.Location = new System.Drawing.Point(8, 121); - this.B_EditPatterns.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.B_EditPatterns.Location = new System.Drawing.Point(6, 98); this.B_EditPatterns.Name = "B_EditPatterns"; - this.B_EditPatterns.Size = new System.Drawing.Size(123, 49); + this.B_EditPatterns.Size = new System.Drawing.Size(92, 40); this.B_EditPatterns.TabIndex = 54; this.B_EditPatterns.Text = "Edit Patterns"; this.B_EditPatterns.UseVisualStyleBackColor = true; @@ -459,10 +447,9 @@ private void InitializeComponent() // // B_EditTurnipExchange // - this.B_EditTurnipExchange.Location = new System.Drawing.Point(8, 7); - this.B_EditTurnipExchange.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.B_EditTurnipExchange.Location = new System.Drawing.Point(6, 6); this.B_EditTurnipExchange.Name = "B_EditTurnipExchange"; - this.B_EditTurnipExchange.Size = new System.Drawing.Size(123, 49); + this.B_EditTurnipExchange.Size = new System.Drawing.Size(92, 40); this.B_EditTurnipExchange.TabIndex = 15; this.B_EditTurnipExchange.Text = "Edit Turnip Exchange"; this.B_EditTurnipExchange.UseVisualStyleBackColor = true; @@ -470,10 +457,9 @@ private void InitializeComponent() // // B_RecycleBin // - this.B_RecycleBin.Location = new System.Drawing.Point(8, 64); - this.B_RecycleBin.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.B_RecycleBin.Location = new System.Drawing.Point(6, 52); this.B_RecycleBin.Name = "B_RecycleBin"; - this.B_RecycleBin.Size = new System.Drawing.Size(123, 49); + this.B_RecycleBin.Size = new System.Drawing.Size(92, 40); this.B_RecycleBin.TabIndex = 13; this.B_RecycleBin.Text = "Edit Recycle Bin"; this.B_RecycleBin.UseVisualStyleBackColor = true; @@ -481,11 +467,10 @@ private void InitializeComponent() // // Tab_Villagers // - this.Tab_Villagers.Location = new System.Drawing.Point(4, 25); - this.Tab_Villagers.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.Tab_Villagers.Location = new System.Drawing.Point(4, 22); this.Tab_Villagers.Name = "Tab_Villagers"; - this.Tab_Villagers.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.Tab_Villagers.Size = new System.Drawing.Size(531, 263); + this.Tab_Villagers.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); + this.Tab_Villagers.Size = new System.Drawing.Size(396, 212); this.Tab_Villagers.TabIndex = 0; this.Tab_Villagers.Text = "Villagers"; this.Tab_Villagers.UseVisualStyleBackColor = true; @@ -514,60 +499,55 @@ private void InitializeComponent() this.Tab_Players.Controls.Add(this.L_PlayerName); this.Tab_Players.Controls.Add(this.CB_Players); this.Tab_Players.Controls.Add(this.PB_Player); - this.Tab_Players.Location = new System.Drawing.Point(4, 25); - this.Tab_Players.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.Tab_Players.Location = new System.Drawing.Point(4, 22); this.Tab_Players.Name = "Tab_Players"; - this.Tab_Players.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.Tab_Players.Size = new System.Drawing.Size(531, 264); + this.Tab_Players.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); + this.Tab_Players.Size = new System.Drawing.Size(396, 211); this.Tab_Players.TabIndex = 1; this.Tab_Players.Text = "Players"; this.Tab_Players.UseVisualStyleBackColor = true; // // L_EarnedMiles // - this.L_EarnedMiles.Location = new System.Drawing.Point(189, 144); - this.L_EarnedMiles.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.L_EarnedMiles.Location = new System.Drawing.Point(142, 117); this.L_EarnedMiles.Name = "L_EarnedMiles"; - this.L_EarnedMiles.Size = new System.Drawing.Size(112, 25); + this.L_EarnedMiles.Size = new System.Drawing.Size(84, 20); this.L_EarnedMiles.TabIndex = 26; this.L_EarnedMiles.Text = "Earned Miles:"; this.L_EarnedMiles.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_TotalNookMiles // - this.NUD_TotalNookMiles.Location = new System.Drawing.Point(309, 144); - this.NUD_TotalNookMiles.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.NUD_TotalNookMiles.Location = new System.Drawing.Point(232, 117); this.NUD_TotalNookMiles.Maximum = new decimal(new int[] { 2147483647, 0, 0, 0}); this.NUD_TotalNookMiles.Name = "NUD_TotalNookMiles"; - this.NUD_TotalNookMiles.Size = new System.Drawing.Size(133, 22); + this.NUD_TotalNookMiles.Size = new System.Drawing.Size(100, 20); this.NUD_TotalNookMiles.TabIndex = 25; // // L_StorageCount // this.L_StorageCount.AutoSize = true; - this.L_StorageCount.Location = new System.Drawing.Point(267, 178); - this.L_StorageCount.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.L_StorageCount.Location = new System.Drawing.Point(200, 145); this.L_StorageCount.Name = "L_StorageCount"; - this.L_StorageCount.Size = new System.Drawing.Size(99, 17); + this.L_StorageCount.Size = new System.Drawing.Size(75, 13); this.L_StorageCount.TabIndex = 24; this.L_StorageCount.Text = "Storage Count"; this.L_StorageCount.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // NUD_StorageCount // - this.NUD_StorageCount.Location = new System.Drawing.Point(201, 175); - this.NUD_StorageCount.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.NUD_StorageCount.Location = new System.Drawing.Point(151, 142); this.NUD_StorageCount.Maximum = new decimal(new int[] { 2147483647, 0, 0, 0}); this.NUD_StorageCount.Name = "NUD_StorageCount"; - this.NUD_StorageCount.Size = new System.Drawing.Size(61, 22); + this.NUD_StorageCount.Size = new System.Drawing.Size(46, 20); this.NUD_StorageCount.TabIndex = 23; this.NUD_StorageCount.Value = new decimal(new int[] { 5000, @@ -578,10 +558,9 @@ private void InitializeComponent() // L_PocketCount2 // this.L_PocketCount2.AutoSize = true; - this.L_PocketCount2.Location = new System.Drawing.Point(197, 235); - this.L_PocketCount2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.L_PocketCount2.Location = new System.Drawing.Point(148, 191); this.L_PocketCount2.Name = "L_PocketCount2"; - this.L_PocketCount2.Size = new System.Drawing.Size(104, 17); + this.L_PocketCount2.Size = new System.Drawing.Size(81, 13); this.L_PocketCount2.TabIndex = 22; this.L_PocketCount2.Text = "Pocket Count 2"; this.L_PocketCount2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; @@ -589,25 +568,23 @@ private void InitializeComponent() // L_PocketCount1 // this.L_PocketCount1.AutoSize = true; - this.L_PocketCount1.Location = new System.Drawing.Point(197, 209); - this.L_PocketCount1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.L_PocketCount1.Location = new System.Drawing.Point(148, 170); this.L_PocketCount1.Name = "L_PocketCount1"; - this.L_PocketCount1.Size = new System.Drawing.Size(104, 17); + this.L_PocketCount1.Size = new System.Drawing.Size(81, 13); this.L_PocketCount1.TabIndex = 21; this.L_PocketCount1.Text = "Pocket Count 1"; this.L_PocketCount1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // NUD_PocketCount2 // - this.NUD_PocketCount2.Location = new System.Drawing.Point(139, 231); - this.NUD_PocketCount2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.NUD_PocketCount2.Location = new System.Drawing.Point(104, 188); this.NUD_PocketCount2.Maximum = new decimal(new int[] { 2147483647, 0, 0, 0}); this.NUD_PocketCount2.Name = "NUD_PocketCount2"; - this.NUD_PocketCount2.Size = new System.Drawing.Size(55, 22); + this.NUD_PocketCount2.Size = new System.Drawing.Size(41, 20); this.NUD_PocketCount2.TabIndex = 20; this.NUD_PocketCount2.Value = new decimal(new int[] { 20, @@ -618,15 +595,14 @@ private void InitializeComponent() // // NUD_PocketCount1 // - this.NUD_PocketCount1.Location = new System.Drawing.Point(139, 206); - this.NUD_PocketCount1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.NUD_PocketCount1.Location = new System.Drawing.Point(104, 167); this.NUD_PocketCount1.Maximum = new decimal(new int[] { 2147483647, 0, 0, 0}); this.NUD_PocketCount1.Name = "NUD_PocketCount1"; - this.NUD_PocketCount1.Size = new System.Drawing.Size(55, 22); + this.NUD_PocketCount1.Size = new System.Drawing.Size(41, 20); this.NUD_PocketCount1.TabIndex = 19; this.NUD_PocketCount1.Value = new decimal(new int[] { 20, @@ -638,10 +614,9 @@ private void InitializeComponent() // B_EditPlayer // this.B_EditPlayer.ContextMenuStrip = this.CM_EditPlayer; - this.B_EditPlayer.Location = new System.Drawing.Point(400, 207); - this.B_EditPlayer.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.B_EditPlayer.Location = new System.Drawing.Point(300, 168); this.B_EditPlayer.Name = "B_EditPlayer"; - this.B_EditPlayer.Size = new System.Drawing.Size(123, 49); + this.B_EditPlayer.Size = new System.Drawing.Size(92, 40); this.B_EditPlayer.TabIndex = 18; this.B_EditPlayer.Text = "Edit Player..."; this.B_EditPlayer.UseVisualStyleBackColor = true; @@ -659,63 +634,62 @@ private void InitializeComponent() this.B_EditPlayerReactions, this.B_EditPlayerMisc}); this.CM_EditPlayer.Name = "CM_EditPlayer"; - this.CM_EditPlayer.Size = new System.Drawing.Size(209, 172); + this.CM_EditPlayer.Size = new System.Drawing.Size(177, 158); // // B_EditPlayerStorage // this.B_EditPlayerStorage.Name = "B_EditPlayerStorage"; - this.B_EditPlayerStorage.Size = new System.Drawing.Size(208, 24); + this.B_EditPlayerStorage.Size = new System.Drawing.Size(176, 22); this.B_EditPlayerStorage.Text = "Edit Storage"; this.B_EditPlayerStorage.Click += new System.EventHandler(this.B_Storage_Click); // // B_EditPlayerReceivedItems // this.B_EditPlayerReceivedItems.Name = "B_EditPlayerReceivedItems"; - this.B_EditPlayerReceivedItems.Size = new System.Drawing.Size(208, 24); + this.B_EditPlayerReceivedItems.Size = new System.Drawing.Size(176, 22); this.B_EditPlayerReceivedItems.Text = "Edit Received Items"; this.B_EditPlayerReceivedItems.Click += new System.EventHandler(this.B_EditPlayerReceivedItems_Click); // // B_EditAchievements // this.B_EditAchievements.Name = "B_EditAchievements"; - this.B_EditAchievements.Size = new System.Drawing.Size(208, 24); + this.B_EditAchievements.Size = new System.Drawing.Size(176, 22); this.B_EditAchievements.Text = "Edit Achievements"; this.B_EditAchievements.Click += new System.EventHandler(this.B_EditAchievements_Click); // // B_EditPlayerRecipes // this.B_EditPlayerRecipes.Name = "B_EditPlayerRecipes"; - this.B_EditPlayerRecipes.Size = new System.Drawing.Size(208, 24); + this.B_EditPlayerRecipes.Size = new System.Drawing.Size(176, 22); this.B_EditPlayerRecipes.Text = "Edit Recipes"; this.B_EditPlayerRecipes.Click += new System.EventHandler(this.B_EditPlayerRecipes_Click); // // B_EditPlayerFlags // this.B_EditPlayerFlags.Name = "B_EditPlayerFlags"; - this.B_EditPlayerFlags.Size = new System.Drawing.Size(208, 24); + this.B_EditPlayerFlags.Size = new System.Drawing.Size(176, 22); this.B_EditPlayerFlags.Text = "Edit Flags"; this.B_EditPlayerFlags.Click += new System.EventHandler(this.B_EditPlayerFlags_Click); // // B_EditPlayerReactions // this.B_EditPlayerReactions.Name = "B_EditPlayerReactions"; - this.B_EditPlayerReactions.Size = new System.Drawing.Size(208, 24); + this.B_EditPlayerReactions.Size = new System.Drawing.Size(176, 22); this.B_EditPlayerReactions.Text = "Edit Reactions"; this.B_EditPlayerReactions.Click += new System.EventHandler(this.B_EditPlayerReactions_Click); // // B_EditPlayerMisc // this.B_EditPlayerMisc.Name = "B_EditPlayerMisc"; - this.B_EditPlayerMisc.Size = new System.Drawing.Size(208, 24); + this.B_EditPlayerMisc.Size = new System.Drawing.Size(176, 22); this.B_EditPlayerMisc.Text = "Edit Misc"; this.B_EditPlayerMisc.Click += new System.EventHandler(this.B_EditPlayerMisc_Click); // // B_EditPlayerItems // - this.B_EditPlayerItems.Location = new System.Drawing.Point(8, 207); - this.B_EditPlayerItems.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.B_EditPlayerItems.Location = new System.Drawing.Point(6, 168); this.B_EditPlayerItems.Name = "B_EditPlayerItems"; - this.B_EditPlayerItems.Size = new System.Drawing.Size(123, 49); + this.B_EditPlayerItems.Size = new System.Drawing.Size(92, 40); this.B_EditPlayerItems.TabIndex = 12; this.B_EditPlayerItems.Text = "Edit Items"; this.B_EditPlayerItems.UseVisualStyleBackColor = true; @@ -723,106 +697,96 @@ private void InitializeComponent() // // L_Wallet // - this.L_Wallet.Location = new System.Drawing.Point(189, 63); - this.L_Wallet.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.L_Wallet.Location = new System.Drawing.Point(142, 51); this.L_Wallet.Name = "L_Wallet"; - this.L_Wallet.Size = new System.Drawing.Size(112, 25); + this.L_Wallet.Size = new System.Drawing.Size(84, 20); this.L_Wallet.TabIndex = 11; this.L_Wallet.Text = "Wallet:"; this.L_Wallet.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_Wallet // - this.NUD_Wallet.Location = new System.Drawing.Point(309, 63); - this.NUD_Wallet.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.NUD_Wallet.Location = new System.Drawing.Point(232, 51); this.NUD_Wallet.Maximum = new decimal(new int[] { 2147483647, 0, 0, 0}); this.NUD_Wallet.Name = "NUD_Wallet"; - this.NUD_Wallet.Size = new System.Drawing.Size(133, 22); + this.NUD_Wallet.Size = new System.Drawing.Size(100, 20); this.NUD_Wallet.TabIndex = 10; this.NUD_Wallet.ValueChanged += new System.EventHandler(this.NUD_Wallet_ValueChanged); // // L_NookMiles // - this.L_NookMiles.Location = new System.Drawing.Point(189, 117); - this.L_NookMiles.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.L_NookMiles.Location = new System.Drawing.Point(142, 95); this.L_NookMiles.Name = "L_NookMiles"; - this.L_NookMiles.Size = new System.Drawing.Size(112, 25); + this.L_NookMiles.Size = new System.Drawing.Size(84, 20); this.L_NookMiles.TabIndex = 9; this.L_NookMiles.Text = "Nook Miles:"; this.L_NookMiles.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_NookMiles // - this.NUD_NookMiles.Location = new System.Drawing.Point(309, 117); - this.NUD_NookMiles.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.NUD_NookMiles.Location = new System.Drawing.Point(232, 95); this.NUD_NookMiles.Maximum = new decimal(new int[] { 2147483647, 0, 0, 0}); this.NUD_NookMiles.Name = "NUD_NookMiles"; - this.NUD_NookMiles.Size = new System.Drawing.Size(133, 22); + this.NUD_NookMiles.Size = new System.Drawing.Size(100, 20); this.NUD_NookMiles.TabIndex = 8; // // L_BankBells // - this.L_BankBells.Location = new System.Drawing.Point(189, 90); - this.L_BankBells.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.L_BankBells.Location = new System.Drawing.Point(142, 73); this.L_BankBells.Name = "L_BankBells"; - this.L_BankBells.Size = new System.Drawing.Size(112, 25); + this.L_BankBells.Size = new System.Drawing.Size(84, 20); this.L_BankBells.TabIndex = 7; this.L_BankBells.Text = "Bank Bells:"; this.L_BankBells.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // NUD_BankBells // - this.NUD_BankBells.Location = new System.Drawing.Point(309, 90); - this.NUD_BankBells.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.NUD_BankBells.Location = new System.Drawing.Point(232, 73); this.NUD_BankBells.Maximum = new decimal(new int[] { 2147483647, 0, 0, 0}); this.NUD_BankBells.Name = "NUD_BankBells"; - this.NUD_BankBells.Size = new System.Drawing.Size(133, 22); + this.NUD_BankBells.Size = new System.Drawing.Size(100, 20); this.NUD_BankBells.TabIndex = 6; // // TB_TownName // - this.TB_TownName.Location = new System.Drawing.Point(309, 36); - this.TB_TownName.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.TB_TownName.Location = new System.Drawing.Point(232, 29); this.TB_TownName.Name = "TB_TownName"; - this.TB_TownName.Size = new System.Drawing.Size(132, 22); + this.TB_TownName.Size = new System.Drawing.Size(100, 20); this.TB_TownName.TabIndex = 5; // // TB_Name // - this.TB_Name.Location = new System.Drawing.Point(309, 9); - this.TB_Name.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.TB_Name.Location = new System.Drawing.Point(232, 7); this.TB_Name.Name = "TB_Name"; - this.TB_Name.Size = new System.Drawing.Size(132, 22); + this.TB_Name.Size = new System.Drawing.Size(100, 20); this.TB_Name.TabIndex = 3; // // L_TownName // - this.L_TownName.Location = new System.Drawing.Point(189, 36); - this.L_TownName.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.L_TownName.Location = new System.Drawing.Point(142, 29); this.L_TownName.Name = "L_TownName"; - this.L_TownName.Size = new System.Drawing.Size(112, 25); + this.L_TownName.Size = new System.Drawing.Size(84, 20); this.L_TownName.TabIndex = 4; this.L_TownName.Text = "Town Name:"; this.L_TownName.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // L_PlayerName // - this.L_PlayerName.Location = new System.Drawing.Point(189, 9); - this.L_PlayerName.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.L_PlayerName.Location = new System.Drawing.Point(142, 7); this.L_PlayerName.Name = "L_PlayerName"; - this.L_PlayerName.Size = new System.Drawing.Size(112, 25); + this.L_PlayerName.Size = new System.Drawing.Size(84, 20); this.L_PlayerName.TabIndex = 2; this.L_PlayerName.Text = "Player Name:"; this.L_PlayerName.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -831,10 +795,9 @@ private void InitializeComponent() // this.CB_Players.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.CB_Players.FormattingEnabled = true; - this.CB_Players.Location = new System.Drawing.Point(8, 7); - this.CB_Players.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.CB_Players.Location = new System.Drawing.Point(6, 6); this.CB_Players.Name = "CB_Players"; - this.CB_Players.Size = new System.Drawing.Size(172, 24); + this.CB_Players.Size = new System.Drawing.Size(130, 21); this.CB_Players.TabIndex = 1; this.CB_Players.SelectedIndexChanged += new System.EventHandler(this.LoadPlayer); // @@ -842,10 +805,9 @@ private void InitializeComponent() // this.PB_Player.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.PB_Player.ContextMenuStrip = this.CM_Picture; - this.PB_Player.Location = new System.Drawing.Point(8, 41); - this.PB_Player.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.PB_Player.Location = new System.Drawing.Point(6, 33); this.PB_Player.Name = "PB_Player"; - this.PB_Player.Size = new System.Drawing.Size(173, 160); + this.PB_Player.Size = new System.Drawing.Size(130, 130); this.PB_Player.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.PB_Player.TabIndex = 0; this.PB_Player.TabStop = false; @@ -856,23 +818,29 @@ private void InitializeComponent() this.TC_Editors.Controls.Add(this.Tab_Villagers); this.TC_Editors.Controls.Add(this.Tab_Map); this.TC_Editors.Dock = System.Windows.Forms.DockStyle.Fill; - this.TC_Editors.Location = new System.Drawing.Point(0, 28); - this.TC_Editors.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.TC_Editors.Location = new System.Drawing.Point(0, 24); this.TC_Editors.Name = "TC_Editors"; this.TC_Editors.SelectedIndex = 0; - this.TC_Editors.Size = new System.Drawing.Size(539, 293); + this.TC_Editors.Size = new System.Drawing.Size(404, 237); this.TC_Editors.TabIndex = 1; // + // Menu_ItemImages + // + this.Menu_ItemImages.Name = "Menu_ItemImages"; + this.Menu_ItemImages.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.M))); + this.Menu_ItemImages.Size = new System.Drawing.Size(206, 22); + this.Menu_ItemImages.Text = "Item Images"; + this.Menu_ItemImages.Click += new System.EventHandler(this.Menu_ItemImages_Click); + // // Editor // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(539, 321); + this.ClientSize = new System.Drawing.Size(404, 261); this.Controls.Add(this.TC_Editors); this.Controls.Add(this.Menu_Editor); this.Icon = global::NHSE.WinForms.Properties.Resources.icon; this.MainMenuStrip = this.Menu_Editor; - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.MaximizeBox = false; this.Name = "Editor"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; @@ -971,6 +939,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem B_EditVisitors; private System.Windows.Forms.Label L_WeatherSeed; private System.Windows.Forms.NumericUpDown NUD_WeatherSeed; + private System.Windows.Forms.ToolStripMenuItem Menu_ItemImages; } } diff --git a/NHSE.WinForms/Editor.cs b/NHSE.WinForms/Editor.cs index 76ff3f3..efa68ac 100644 --- a/NHSE.WinForms/Editor.cs +++ b/NHSE.WinForms/Editor.cs @@ -56,7 +56,7 @@ private void Menu_Language_SelectedIndexChanged(object sender, EventArgs e) Task.Run(() => { - ItemSprite.Initialize(Main.ItemPath, GameInfo.GetStrings("en").itemlist); + ItemSprite.Initialize(GameInfo.GetStrings("en").itemlist); TranslationUtil.SetLocalization(typeof(MessageStrings), lang); TranslationUtil.SetLocalization(GameInfo.Strings.InternalNameTranslation, lang); }); @@ -144,6 +144,19 @@ private void Menu_RAMEdit_Click(object sender, EventArgs e) sysbot.Show(); } + private void Menu_ItemImages_Click(object sender, EventArgs e) + { + var exist = WinFormsUtil.FirstFormOfType(); + if (exist != null) + { + exist.Show(); + return; + } + + var imgfetcher = new ImageFetcher(); + imgfetcher.Show(); + } + private void ReloadAll() { Villagers.Villagers = SAV.Main.GetVillagers(); diff --git a/NHSE.WinForms/Main.cs b/NHSE.WinForms/Main.cs index 4eec957..707688f 100644 --- a/NHSE.WinForms/Main.cs +++ b/NHSE.WinForms/Main.cs @@ -177,7 +177,7 @@ private void Main_KeyDown(object sender, KeyEventArgs e) } case Keys.I: { - ItemSprite.Initialize(ItemPath, GameInfo.GetStrings("en").itemlist); + ItemSprite.Initialize(GameInfo.GetStrings("en").itemlist); var items = new Item[40]; for (int i = 0; i < items.Length; i++) items[i] = new Item(Item.NONE); diff --git a/NHSE.WinForms/NHSE.WinForms.csproj b/NHSE.WinForms/NHSE.WinForms.csproj index 6746482..5dc022b 100644 --- a/NHSE.WinForms/NHSE.WinForms.csproj +++ b/NHSE.WinForms/NHSE.WinForms.csproj @@ -127,4 +127,8 @@ + + + + \ No newline at end of file diff --git a/NHSE.WinForms/Properties/Resources.Designer.cs b/NHSE.WinForms/Properties/Resources.Designer.cs index 61cd08b..19b8e6e 100644 --- a/NHSE.WinForms/Properties/Resources.Designer.cs +++ b/NHSE.WinForms/Properties/Resources.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// 此代码由工具生成。 -// 运行时版本:4.0.30319.42000 +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // -// 对此文件的更改可能会导致不正确的行为,并且如果 -// 重新生成代码,这些更改将会丢失。 +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -13,12 +13,12 @@ namespace NHSE.WinForms.Properties { /// - /// 一个强类型的资源类,用于查找本地化的字符串等。 + /// A strongly-typed resource class, for looking up localized strings, etc. /// - // 此类是由 StronglyTypedResourceBuilder - // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 - // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen - // (以 /str 作为命令选项),或重新生成 VS 项目。 + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] @@ -33,7 +33,7 @@ internal class Resources { } /// - /// 返回此类使用的缓存的 ResourceManager 实例。 + /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { @@ -47,8 +47,8 @@ internal class Resources { } /// - /// 重写当前线程的 CurrentUICulture 属性 - /// 重写当前线程的 CurrentUICulture 属性。 + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { @@ -61,7 +61,16 @@ internal class Resources { } /// - /// 查找类似于 (图标) 的 System.Drawing.Icon 类型的本地化资源。 + /// Looks up a localized string similar to https://github.com/berichan/NHSE-USB/releases/download/0.01/raw.zip. + /// + internal static string hosts_images { + get { + return ResourceManager.GetString("hosts_images", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). /// internal static System.Drawing.Icon icon { get { @@ -71,23 +80,22 @@ internal class Resources { } /// - /// 查找类似 AcreEditor=Acre Editor - ///ActivityEditor=Record Editor - ///BuildingEditor=Building Editor + /// Looks up a localized string similar to AchievementEditor=Record Editor + ///BuildingHelp=Building Help + ///BulkSpawn=Bulk Spawn ///FieldItemEditor=Field Item Editor ///FlagEditor=Flag Editor ///ItemReceivedEditor=Received Item List Editor + ///LandFlagEditor=Flag Editor + ///MiscPlayerEditor=Misc Player Detail Editor + ///MuseumEditor=Flag Editor ///PatternEditor=Pattern Editor ///PatternEditorPRO=Pro Design Editor + ///PlayerHouseEditor=Player House Editor + ///PlayerHouseFlagEditor=Flag Editor ///PlayerItemEditor=Inventory Editor - ///SimpleHexEditor=RAM Edit - ///SingleObjectEditor=Property Editor - ///SysBotRAMEdit=SysBotUI - ///SysBotUI=SysBotUI - ///TerrainEditor=Terrain Editor - ///VillagerHouseEditor=Villager House Editor - ///AcreEditor.B_Cancel=Cancel - ///AcreEditor.B_E [字符串的其余部分被截断]"; 的本地化字符串。 + ///ReactionEditor=Reaction List Editor + ///RecipeListEdit [rest of string was truncated]";. /// internal static string lang_de { get { @@ -96,23 +104,22 @@ internal class Resources { } /// - /// 查找类似 AcreEditor=Acre Editor - ///ActivityEditor=Record Editor - ///BuildingEditor=Building Editor + /// Looks up a localized string similar to AchievementEditor=Record Editor + ///BuildingHelp=Building Help + ///BulkSpawn=Bulk Spawn ///FieldItemEditor=Field Item Editor ///FlagEditor=Flag Editor ///ItemReceivedEditor=Received Item List Editor + ///LandFlagEditor=Flag Editor + ///MiscPlayerEditor=Misc Player Detail Editor + ///MuseumEditor=Flag Editor ///PatternEditor=Pattern Editor ///PatternEditorPRO=Pro Design Editor + ///PlayerHouseEditor=Player House Editor + ///PlayerHouseFlagEditor=Flag Editor ///PlayerItemEditor=Inventory Editor - ///SimpleHexEditor=RAM Edit - ///SingleObjectEditor=Property Editor - ///SysBotRAMEdit=SysBotUI - ///SysBotUI=SysBotUI - ///TerrainEditor=Terrain Editor - ///VillagerHouseEditor=Villager House Editor - ///AcreEditor.B_Cancel=Cancel - ///AcreEditor.B_E [字符串的其余部分被截断]"; 的本地化字符串。 + ///ReactionEditor=Reaction List Editor + ///RecipeListEdit [rest of string was truncated]";. /// internal static string lang_en { get { @@ -121,21 +128,20 @@ internal class Resources { } /// - /// 查找类似 AcreEditor=Editor de Acres - ///ActivityEditor=Editor de Actividad - ///BuildingEditor=Editor de Edificios + /// Looks up a localized string similar to AchievementEditor=Editor de Récords + ///BuildingHelp=Ayuda de Construcción + ///BulkSpawn=Aumentar Spawn ///FieldItemEditor=Editor de Objetos (Terreno) ///FlagEditor=Editor de Flags ///ItemReceivedEditor=Editor de Objetos Recibidos - ///PatternEditor=Pattern Editor - ///PatternEditorPRO=Pro Design Editor - ///PlayerItemEditor=Inventory Editor - ///SimpleHexEditor=Editor de RAM - ///SingleObjectEditor=Property Editor - ///SysBotRAMEdit=SysBotUI - ///SysBotUI=SysBotUI - ///TerrainEditor=Editor de Terreno - ///VillagerHouseEditor=Editor de Casas (Ciudadanos [字符串的其余部分被截断]"; 的本地化字符串。 + ///LandFlagEditor= Editor de Flags + ///MuseumEditor=Editor de Flags + ///PatternEditor=Editor de Patrones + ///PatternEditorPRO=Editor de Diseño Pro + ///PlayerHouseEditor=Editor de la Casa del Jugador + ///PlayerHouseFlagEditor=Editor de Flags + ///PlayerItemEditor=Editor de Inventario + ///ReactionEditor=Editor de List [rest of string was truncated]";. /// internal static string lang_es { get { @@ -144,23 +150,22 @@ internal class Resources { } /// - /// 查找类似 AcreEditor=Acre Editor - ///ActivityEditor=Record Editor - ///BuildingEditor=Building Editor + /// Looks up a localized string similar to AchievementEditor=Record Editor + ///BuildingHelp=Building Help + ///BulkSpawn=Bulk Spawn ///FieldItemEditor=Field Item Editor ///FlagEditor=Flag Editor ///ItemReceivedEditor=Received Item List Editor + ///LandFlagEditor=Flag Editor + ///MiscPlayerEditor=Misc Player Detail Editor + ///MuseumEditor=Flag Editor ///PatternEditor=Pattern Editor ///PatternEditorPRO=Pro Design Editor + ///PlayerHouseEditor=Player House Editor + ///PlayerHouseFlagEditor=Flag Editor ///PlayerItemEditor=Inventory Editor - ///SimpleHexEditor=RAM Edit - ///SingleObjectEditor=Property Editor - ///SysBotRAMEdit=SysBotUI - ///SysBotUI=SysBotUI - ///TerrainEditor=Terrain Editor - ///VillagerHouseEditor=Villager House Editor - ///AcreEditor.B_Cancel=Cancel - ///AcreEditor.B_E [字符串的其余部分被截断]"; 的本地化字符串。 + ///ReactionEditor=Reaction List Editor + ///RecipeListEdit [rest of string was truncated]";. /// internal static string lang_fr { get { @@ -169,22 +174,20 @@ internal class Resources { } /// - /// 查找类似 AcreEditor=Modifica Sezioni - ///ActivityEditor=Modifica Record - ///BuildingEditor=Modifica Edifici + /// Looks up a localized string similar to AchievementEditor=Modifica Record + ///BuildingHelp=Aiuto Costruzione + ///BulkSpawn=Genera in massa ///FieldItemEditor=Modifica oggetti sul terreno ///FlagEditor=Modifica Flag ///ItemReceivedEditor=Modifica catalogo - ///PatternEditor=Modifica pattern - ///PatternEditorPRO=Modifica pattern Pro - ///PlayerItemEditor=Modifica inventario - ///SimpleHexEditor=Modifica RAM - ///SingleObjectEditor=Modifica proprietà - ///SysBotRAMEdit=SysBotUI - ///SysBotUI=SysBotUI - ///TerrainEditor=Editor del terreno - ///VillagerHouseEditor=Editor casa del villager - ///Acre [字符串的其余部分被截断]"; 的本地化字符串。 + ///LandFlagEditor=Modifica Flag + ///MiscPlayerEditor=Modifica dettagli giocatore + ///MuseumEditor=Modifica Flag + ///PatternEditor=Modifica modelli + ///PatternEditorPRO=Modifica modelli Pro + ///PlayerHouseEditor=Modifica casa del giocatore + ///PlayerHouseFlagEditor=Modifica Flag casa del giocatore + ///PlayerItemEditor=Modifica inve [rest of string was truncated]";. /// internal static string lang_it { get { @@ -193,23 +196,22 @@ internal class Resources { } /// - /// 查找类似 AcreEditor=Acre Editor - ///ActivityEditor=Record Editor - ///BuildingEditor=Building Editor + /// Looks up a localized string similar to AchievementEditor=Record Editor + ///BuildingHelp=Building Help + ///BulkSpawn=Bulk Spawn ///FieldItemEditor=Field Item Editor ///FlagEditor=Flag Editor ///ItemReceivedEditor=Received Item List Editor + ///LandFlagEditor=Flag Editor + ///MiscPlayerEditor=Misc Player Detail Editor + ///MuseumEditor=Flag Editor ///PatternEditor=Pattern Editor ///PatternEditorPRO=Pro Design Editor + ///PlayerHouseEditor=Player House Editor + ///PlayerHouseFlagEditor=Flag Editor ///PlayerItemEditor=Inventory Editor - ///SimpleHexEditor=RAM Edit - ///SingleObjectEditor=Property Editor - ///SysBotRAMEdit=SysBotUI - ///SysBotUI=SysBotUI - ///TerrainEditor=Terrain Editor - ///VillagerHouseEditor=Villager House Editor - ///AcreEditor.B_Cancel=Cancel - ///AcreEditor.B_E [字符串的其余部分被截断]"; 的本地化字符串。 + ///ReactionEditor=Reaction List Editor + ///RecipeListEdit [rest of string was truncated]";. /// internal static string lang_jp { get { @@ -218,23 +220,22 @@ internal class Resources { } /// - /// 查找类似 AcreEditor=Acre Editor - ///ActivityEditor=Record Editor - ///BuildingEditor=Building Editor + /// Looks up a localized string similar to AchievementEditor=Record Editor + ///BuildingHelp=Building Help + ///BulkSpawn=Bulk Spawn ///FieldItemEditor=Field Item Editor ///FlagEditor=Flag Editor ///ItemReceivedEditor=Received Item List Editor + ///LandFlagEditor=Flag Editor + ///MiscPlayerEditor=Misc Player Detail Editor + ///MuseumEditor=Flag Editor ///PatternEditor=Pattern Editor ///PatternEditorPRO=Pro Design Editor + ///PlayerHouseEditor=Player House Editor + ///PlayerHouseFlagEditor=Flag Editor ///PlayerItemEditor=Inventory Editor - ///SimpleHexEditor=RAM Edit - ///SingleObjectEditor=Property Editor - ///SysBotRAMEdit=SysBotUI - ///SysBotUI=SysBotUI - ///TerrainEditor=Terrain Editor - ///VillagerHouseEditor=Villager House Editor - ///AcreEditor.B_Cancel=Cancel - ///AcreEditor.B_E [字符串的其余部分被截断]"; 的本地化字符串。 + ///ReactionEditor=Reaction List Editor + ///RecipeListEdit [rest of string was truncated]";. /// internal static string lang_ko { get { @@ -243,28 +244,27 @@ internal class Resources { } /// - /// 查找类似 AcreEditor=耕地编辑器 - ///ActivityEditor=成就编辑器 - ///BuildingEditor=建筑编辑器 - ///FieldItemEditor=地形编辑器 + /// Looks up a localized string similar to AchievementEditor=记录编辑器 + ///BuildingHelp=建筑帮助 + ///BulkSpawn=Bulk Spawn + ///FieldItemEditor=地皮编辑器 ///FlagEditor=属性编辑器 ///ItemReceivedEditor=收藏清单编辑器 + ///LandFlagEditor=参数编辑器 + ///MiscPlayerEditor=杂项编辑器 + ///MuseumEditor=参数编辑器 ///PatternEditor=设计编辑器 ///PatternEditorPRO=专业设计编辑器 - ///PlayerItemEditor=道具编辑器 - ///SimpleHexEditor=十六进制编辑器 + ///PlayerHouseEditor=玩家房屋编辑器 + ///PlayerHouseFlagEditor=参数编辑器 + ///PlayerItemEditor=物品编辑器 + ///ReactionEditor=反应列表编辑器 + ///RecipeListEditor=Recipe List Editor + ///SaveRoomFloorWallEditor=房间编辑器 + ///SimpleHexEditor=16进制编辑器 + ///SingleItemEditor=物品编辑器 ///SingleObjectEditor=属性编辑器 - ///SysBotRAMEdit=SysBot 界面 - ///SysBotUI=SysBot 界面 - ///TerrainEditor=地形编辑器 - ///VillagerHouseEditor=岛民房屋编辑器 - ///AcreEditor.B_Cancel=取消 - ///AcreEditor.B_Export=导出 - ///AcreEditor.B_Import=导入 - ///AcreEditor.B_Save=保存 - ///AcreEditor.L_AcreList=名称表: - ///AcreEditor.L_Hovered=鼠标划上 - ///ActivityEditor. [字符串的其余部分被截断]"; 的本地化字符串。 + ///SysBotRAMEdit=Sys [rest of string was truncated]";. /// internal static string lang_zhs { get { @@ -273,28 +273,27 @@ internal class Resources { } /// - /// 查找类似 AcreEditor=耕地編輯器 - ///ActivityEditor=成就編輯器 - ///BuildingEditor=建築編輯器 + /// Looks up a localized string similar to AchievementEditor=成就編輯器 + ///BuildingHelp=建築說明 + ///BulkSpawn=Bulk Spawn ///FieldItemEditor=地皮編輯器 ///FlagEditor=屬性編輯器 - ///ItemReceivedEditor=收藏清單編輯器 + ///ItemReceivedEditor=目錄清單編輯器 + ///LandFlagEditor=參數編輯器 + ///MiscPlayerEditor=雜項編輯器 + ///MuseumEditor=博物館編輯器 ///PatternEditor=設計編輯器 - ///PatternEditorPRO=進階設計編輯器 - ///PlayerItemEditor=道具編輯器 - ///SimpleHexEditor=十六進位編輯器 + ///PatternEditorPRO=專業設計編輯器 + ///PlayerHouseEditor=玩家房屋編輯器 + ///PlayerHouseFlagEditor=參數編輯器 + ///PlayerItemEditor=物品編輯器 + ///ReactionEditor=表情編輯器 + ///RecipeListEditor=Recipe List Editor + ///SaveRoomFloorWallEditor=房間編輯器 + ///SimpleHexEditor=16進制編輯器 + ///SingleItemEditor=物品編輯器 ///SingleObjectEditor=屬性編輯器 - ///SysBotRAMEdit=SysBot 介面 - ///SysBotUI=SysBot 介面 - ///TerrainEditor=地形編輯器 - ///VillagerHouseEditor=島民房屋編輯器 - ///AcreEditor.B_Cancel=取消 - ///AcreEditor.B_Export=匯出 - ///AcreEditor.B_Import=匯入 - ///AcreEditor.B_Save=儲存 - ///AcreEditor.L_AcreList=名稱表: - ///AcreEditor.L_Hovered=鼠標劃上 - ///ActivityEditor. [字符串的其余部分被截断]"; 的本地化字符串。 + ///SysBotRAMEdit=SysB [rest of string was truncated]";. /// internal static string lang_zht { get { diff --git a/NHSE.WinForms/Properties/Resources.resx b/NHSE.WinForms/Properties/Resources.resx index fc2f9f9..647441e 100644 --- a/NHSE.WinForms/Properties/Resources.resx +++ b/NHSE.WinForms/Properties/Resources.resx @@ -118,6 +118,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\network\hosts_images.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/NHSE.WinForms/Resources/network/hosts_images.txt b/NHSE.WinForms/Resources/network/hosts_images.txt new file mode 100644 index 0000000..927d00a --- /dev/null +++ b/NHSE.WinForms/Resources/network/hosts_images.txt @@ -0,0 +1 @@ +https://github.com/berichan/NHSE-USB/releases/download/0.01/raw.zip \ No newline at end of file diff --git a/NHSE.WinForms/Subforms/Program/ImageFetcher.Designer.cs b/NHSE.WinForms/Subforms/Program/ImageFetcher.Designer.cs new file mode 100644 index 0000000..383a0c0 --- /dev/null +++ b/NHSE.WinForms/Subforms/Program/ImageFetcher.Designer.cs @@ -0,0 +1,152 @@ +namespace NHSE.WinForms +{ + partial class ImageFetcher + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.PBar_MultiUse = new System.Windows.Forms.ProgressBar(); + this.B_Download = new System.Windows.Forms.Button(); + this.CB_HostSelect = new System.Windows.Forms.ComboBox(); + this.L_Warning = new System.Windows.Forms.Label(); + this.L_Host = new System.Windows.Forms.Label(); + this.L_Status = new System.Windows.Forms.Label(); + this.L_ImgStatus = new System.Windows.Forms.Label(); + this.L_FileSize = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // PBar_MultiUse + // + this.PBar_MultiUse.Location = new System.Drawing.Point(37, 178); + this.PBar_MultiUse.Name = "PBar_MultiUse"; + this.PBar_MultiUse.Size = new System.Drawing.Size(330, 23); + this.PBar_MultiUse.TabIndex = 0; + // + // B_Download + // + this.B_Download.Location = new System.Drawing.Point(125, 149); + this.B_Download.Name = "B_Download"; + this.B_Download.Size = new System.Drawing.Size(156, 23); + this.B_Download.TabIndex = 1; + this.B_Download.Text = "Download Images"; + this.B_Download.UseVisualStyleBackColor = true; + this.B_Download.Click += new System.EventHandler(this.B_Download_Click); + // + // CB_HostSelect + // + this.CB_HostSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.CB_HostSelect.FormattingEnabled = true; + this.CB_HostSelect.Location = new System.Drawing.Point(37, 93); + this.CB_HostSelect.Name = "CB_HostSelect"; + this.CB_HostSelect.Size = new System.Drawing.Size(330, 21); + this.CB_HostSelect.TabIndex = 2; + this.CB_HostSelect.SelectedIndexChanged += new System.EventHandler(this.CB_HostSelect_SelectedIndexChanged); + // + // L_Warning + // + this.L_Warning.Location = new System.Drawing.Point(37, 22); + this.L_Warning.Name = "L_Warning"; + this.L_Warning.Size = new System.Drawing.Size(330, 44); + this.L_Warning.TabIndex = 3; + this.L_Warning.Text = "The developers of this application are not responsible for curating item images. " + + "Images are hosted by third parties and while every effort is made to ensure comp" + + "leteness, this is not guaranteed."; + this.L_Warning.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // L_Host + // + this.L_Host.AutoSize = true; + this.L_Host.Location = new System.Drawing.Point(162, 77); + this.L_Host.Name = "L_Host"; + this.L_Host.Size = new System.Drawing.Size(83, 13); + this.L_Host.TabIndex = 4; + this.L_Host.Text = "Download Host:"; + this.L_Host.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // L_Status + // + this.L_Status.Location = new System.Drawing.Point(37, 204); + this.L_Status.Name = "L_Status"; + this.L_Status.Size = new System.Drawing.Size(330, 22); + this.L_Status.TabIndex = 5; + this.L_Status.Text = "Downloading..."; + this.L_Status.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // L_ImgStatus + // + this.L_ImgStatus.ForeColor = System.Drawing.Color.Red; + this.L_ImgStatus.Location = new System.Drawing.Point(45, 117); + this.L_ImgStatus.Name = "L_ImgStatus"; + this.L_ImgStatus.Size = new System.Drawing.Size(317, 29); + this.L_ImgStatus.TabIndex = 6; + this.L_ImgStatus.Text = "Images now exist. Only repair images if absolutely necessary. Images do NOT need " + + "to be redownloaded when NHSE updates."; + this.L_ImgStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // L_FileSize + // + this.L_FileSize.Location = new System.Drawing.Point(287, 72); + this.L_FileSize.Name = "L_FileSize"; + this.L_FileSize.Size = new System.Drawing.Size(80, 18); + this.L_FileSize.TabIndex = 7; + this.L_FileSize.Text = "00.0MB"; + this.L_FileSize.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // ImageFetcher + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(407, 235); + this.Controls.Add(this.L_FileSize); + this.Controls.Add(this.L_ImgStatus); + this.Controls.Add(this.L_Status); + this.Controls.Add(this.L_Host); + this.Controls.Add(this.L_Warning); + this.Controls.Add(this.CB_HostSelect); + this.Controls.Add(this.B_Download); + this.Controls.Add(this.PBar_MultiUse); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "ImageFetcher"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Item Images"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.ProgressBar PBar_MultiUse; + private System.Windows.Forms.Button B_Download; + private System.Windows.Forms.ComboBox CB_HostSelect; + private System.Windows.Forms.Label L_Warning; + private System.Windows.Forms.Label L_Host; + private System.Windows.Forms.Label L_Status; + private System.Windows.Forms.Label L_ImgStatus; + private System.Windows.Forms.Label L_FileSize; + } +} \ No newline at end of file diff --git a/NHSE.WinForms/Subforms/Program/ImageFetcher.cs b/NHSE.WinForms/Subforms/Program/ImageFetcher.cs new file mode 100644 index 0000000..1982e07 --- /dev/null +++ b/NHSE.WinForms/Subforms/Program/ImageFetcher.cs @@ -0,0 +1,168 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.IO.Compression; +using System.Net; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using NHSE.Core; +using NHSE.Sprites; + +namespace NHSE.WinForms +{ + public sealed partial class ImageFetcher : Form + { + private const string Filename = "image.zip"; + private static string ZipFilePath { get => Path.Combine(ItemSprite.PlatformAppDataPath, Filename); } + + private readonly List AllHosts; + + public ImageFetcher() + { + InitializeComponent(); + L_Status.Text = L_FileSize.Text = string.Empty; + + AllHosts = new List(LoadHosts()); + CB_HostSelect.SelectedIndex = 0; // set outside of initialise to update filesize via HEAD response + + CheckFileStatusLabel(); + } + + private string[] LoadHosts() + { + CB_HostSelect.Items.Clear(); + var hosts = Properties.Resources.hosts_images; + var splitHosts = hosts.Split(new string[] { "\r", "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries); + foreach (var host in splitHosts) + CB_HostSelect.Items.Add(CleanUrl(host)); + + return splitHosts; + } + + private void B_Download_Click(object sender, EventArgs e) + { + var path = ItemSprite.PlatformAppDataPath; + var hostSelected = AllHosts[CB_HostSelect.SelectedIndex]; + + SetUIDownloadState(false); + + L_Status.Text = "Downloading..."; + + try + { + if (!Directory.Exists(path)) + Directory.CreateDirectory(path); + + using (var webClient = new WebClient()) + { + webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed); + webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged); + webClient.DownloadFileAsync(new Uri(hostSelected), ZipFilePath); + } + } +#pragma warning disable CA1031 // Do not catch general exception types + catch (Exception ex) +#pragma warning restore CA1031 // Do not catch general exception types + { + WinFormsUtil.Error(ex.Message, ex.InnerException == null ? string.Empty : ex.InnerException.Message); + SetUIDownloadState(true); + } + } + + private void ProgressChanged(object sender, DownloadProgressChangedEventArgs e) => PBar_MultiUse.Value = e.ProgressPercentage; + + private void Completed(object sender, AsyncCompletedEventArgs e) + { + if (e.Error != null) + { + WinFormsUtil.Error(e.Error.Message, e.Error.InnerException == null ? string.Empty : e.Error.InnerException.Message); + SetUIDownloadState(true); + return; + } + + PBar_MultiUse.Value = 100; + L_Status.Text = "Unzipping..."; + UnzipFile(); + } + + private async void UnzipFile() + { + try + { + var outputFolderPath = ItemSprite.PlatformAppDataImagePath; + + if (Directory.Exists(outputFolderPath)) // overwrite existing + Directory.Delete(outputFolderPath, true); + + Directory.CreateDirectory(outputFolderPath); + + await Task.Run(() => ZipFile.ExtractToDirectory(ZipFilePath, outputFolderPath)); + + SetUIDownloadState(true, true); + } +#pragma warning disable CA1031 // Do not catch general exception types + catch (Exception ex) +#pragma warning restore CA1031 // Do not catch general exception types + { + WinFormsUtil.Error(ex.Message, ex.InnerException == null ? string.Empty : ex.InnerException.Message); + SetUIDownloadState(true); + } + } + + private void SetUIDownloadState(bool val, bool success = false) + { + ControlBox = val; + B_Download.Enabled = val; + PBar_MultiUse.Value = 0; + + L_Status.Text = success ? "Images installed successfully." : string.Empty; + + CheckFileStatusLabel(); + + if (success) + ItemSprite.Initialize(Core.GameInfo.GetStrings("en").itemlist); + + if (File.Exists(ZipFilePath)) + File.Delete(ZipFilePath); + } + + private void CB_HostSelect_SelectedIndexChanged(object sender, EventArgs e) + { + if (AllHosts == null) + return; + + CheckNetworkFileSizeAsync(); + } + + private async void CheckNetworkFileSizeAsync() + { + L_FileSize.Text = string.Empty; + try + { + var webClient = new WebClient(); + await webClient.OpenReadTaskAsync(new Uri(AllHosts[CB_HostSelect.SelectedIndex], UriKind.Absolute)); + + var totalSizeBytes = Convert.ToInt64(webClient.ResponseHeaders["Content-Length"]); + var totalSizeMb = totalSizeBytes / 1e+6; + L_FileSize.Text = totalSizeMb.ToString("0.##") + "MB"; + } + catch (Exception ex) + { + L_FileSize.Text = ex.Message; + } + } + + private string CleanUrl(string url) + { + var uri = new Uri(url); + if (uri.Segments.Length < 2) + return url; + + return $"{uri.Host}/{uri.Segments[1]}"; + } + + private bool CheckFileStatusLabel() => L_ImgStatus.Visible = ItemSprite.SingleSpriteExists; + } +} diff --git a/NHSE.WinForms/Subforms/Program/ImageFetcher.resx b/NHSE.WinForms/Subforms/Program/ImageFetcher.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/NHSE.WinForms/Subforms/Program/ImageFetcher.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file