Add item name

Will be quite easy to add the selection of currentItem and flags later;
the List<cbItem> that is generated will be used as the DataSource.
This commit is contained in:
Kurt
2015-08-19 07:48:39 -07:00
parent 72fa7bc5c8
commit 87edc29281
7 changed files with 4815 additions and 3 deletions

View File

@@ -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<cbItem> itemList = Data.getCBItems(itemNames);
public Main()
{
// Set up.

View File

@@ -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<string> 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<cbItem> getCBItems(string[] storage)
{
List<cbItem> cbList = new List<cbItem>();
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;

View File

@@ -676,6 +676,9 @@
<ItemGroup>
<None Include="Resources\img\acre\acre_196.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\text\item_en.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -1889,5 +1889,39 @@ internal class Resources {
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to // Outside Flowers, Trees, Bushes, Fruit
///009F Red Tulips
///00A0 White Tulips
///00A1 Yellow Tulips
///00A2 Pink Tulips
///00A3 Purple Tulips
///00A4 Black Tulips
///00A5 Orange Tulips
///00A6 White Pansies
///00A7 Yellow Pansies
///00A8 Red Pansies
///00A9 Purple Pansies
///00AA Orange Pansies
///00AB Blue Pansies
///00AC White Comsos
///00AD Red Cosmos
///00AE Sun Cosmos
///00AF Pink Cosmos
///00B0 Orange Cosmos
///00B1 Black Cosmos
///00B2 Red Roses
///00B3 White Roses
///00B4 Yellow Roses
///00B5 Pink Roses
///00B6 Orange Roses
///00B7 Purple Roses [rest of string was truncated]&quot;;.
/// </summary>
internal static string item_en {
get {
return ResourceManager.GetString("item_en", resourceCulture);
}
}
}
}

View File

@@ -667,4 +667,7 @@
<data name="acre_99" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\img\acre\acre_99.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="item_en" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\text\item_en.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
</root>

4722
Resources/text/item_en.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -742,14 +742,14 @@ private void clickCustom(object sender, MouseEventArgs e)
private void reloadCurrentItem(Item item)
{
currentItem = item;
const string itemName = ""; // todo: add item name display
string itemName = Main.itemNames[currentItem.ID];
L_ItemCurrent.Text = String.Format("Current Item: [0x{0}{1}{2}] {3}",
currentItem.Flag2.ToString("X2"), currentItem.Flag1.ToString("X2"), currentItem.ID.ToString("X4"),
itemName);
}
private void hoverItem(Item item, int X, int Y)
{
const string itemName = ""; // todo: add item name display
string itemName = Main.itemNames[item.ID];
L_ItemHover.Text = String.Format("[0x{0}{1}{2}] {3}x{4}: {5}",
item.Flag2.ToString("X2"), item.Flag1.ToString("X2"), item.ID.ToString("X4"),
X.ToString("00"), Y.ToString("00"),