From 87edc292819a5a992f57b2d2cc036c2a0a19cb11 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 19 Aug 2015 07:48:39 -0700 Subject: [PATCH] Add item name Will be quite easy to add the selection of currentItem and flags later; the List that is generated will be used as the DataSource. --- Main.cs | 4 +- Misc/Data.cs | 48 + NLSE.csproj | 3 + Properties/Resources.Designer.cs | 34 + Properties/Resources.resx | 3 + Resources/text/item_en.txt | 4722 ++++++++++++++++++++++++++++++ Subforms/Garden.cs | 4 +- 7 files changed, 4815 insertions(+), 3 deletions(-) create mode 100644 Resources/text/item_en.txt diff --git a/Main.cs b/Main.cs index 98ca1f6..2319d7e 100644 --- a/Main.cs +++ b/Main.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; @@ -10,7 +11,8 @@ namespace NLSE public partial class Main : Form { internal static string root; - + internal static string[] itemNames = Data.getItemStrings("en"); + internal static List itemList = Data.getCBItems(itemNames); public Main() { // Set up. diff --git a/Misc/Data.cs b/Misc/Data.cs index bb5076f..dc3c514 100644 --- a/Misc/Data.cs +++ b/Misc/Data.cs @@ -1,9 +1,57 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Text; namespace NLSE { + public class Data + { + internal static string[] getItemStrings(string l) + { + string[] storage = new string[0x8000]; + object txt = Properties.Resources.ResourceManager.GetObject("item_" + l); // Fetch File, \n to list. + List rawlist = ((string)txt).Split(new[] { '\n' }).ToList(); + string[] input = rawlist.ToArray(); + + for (int i = 0; i < input.Length; i++) + { + try { + string line = input[i]; + string[] t = line.Split('\t'); + if (t.Length < 2 || t[0].Length != 4 || t[0][0] == '\\') + continue; + + int index = Convert.ToInt32(t[0], 16); + storage[index] = t[1]; + } + catch { } + } + return storage; + } + + internal static List getCBItems(string[] storage) + { + List cbList = new List(); + try + { + for (int i = 0; i < storage.Length; i++) + if (storage[i] != null && storage[i].Length > 0) + cbList.Add(new cbItem + { + Text = storage[i], + Value = i + }); + } + catch { } + return cbList; + } + } + public class cbItem + { + public string Text { get; set; } + public object Value { get; set; } + } public class DataRef { public int Offset, Length; diff --git a/NLSE.csproj b/NLSE.csproj index 0fc2447..ac72d47 100644 --- a/NLSE.csproj +++ b/NLSE.csproj @@ -676,6 +676,9 @@ + + +