Move cbItem to ComboItem

This commit is contained in:
Kaphotics 2016-07-09 15:34:38 -07:00
parent bd8d5fecc7
commit 592390d1ca
7 changed files with 32 additions and 35 deletions

View file

@ -146,7 +146,7 @@ namespace PKHeX
public static string[] metXY_00000, metXY_30000, metXY_40000, metXY_60000 = { };
public static string[] wallpapernames, puffs = { };
public static bool unicode;
public static List<Util.cbItem> MoveDataSource, ItemDataSource, SpeciesDataSource, BallDataSource, NatureDataSource, AbilityDataSource, VersionDataSource;
public static List<ComboItem> MoveDataSource, ItemDataSource, SpeciesDataSource, BallDataSource, NatureDataSource, AbilityDataSource, VersionDataSource;
public static volatile bool formInitialized, fieldsInitialized, fieldsLoaded;
private static int colorizedbox = -1;

8
Misc/ComboItem.cs Normal file
View file

@ -0,0 +1,8 @@
namespace PKHeX
{
public class ComboItem
{
public string Text { get; set; }
public int Value { get; set; }
}
}

View file

@ -254,7 +254,7 @@
<Compile Include="Misc\SplashScreen.Designer.cs">
<DependentUpon>SplashScreen.cs</DependentUpon>
</Compile>
<Compile Include="Util\cbItem.cs" />
<Compile Include="Misc\ComboItem.cs" />
<Compile Include="Util\DataUtil.cs" />
<Compile Include="Util\FormUtil.cs" />
<Compile Include="Util\ImageUtil.cs" />

View file

@ -303,7 +303,7 @@ namespace PKHeX
{
string result;
string nn = pk6.Nickname;
string a = (Util.cbItem)arg.SelectedItem == null ? arg.Text ?? "ERROR" : ((Util.cbItem)arg.SelectedItem).Text;
string a = (ComboItem)arg.SelectedItem == null ? arg.Text ?? "ERROR" : ((ComboItem)arg.SelectedItem).Text;
int mem = Util.getIndex(m);
bool enabled = false;

View file

@ -246,21 +246,21 @@ namespace PKHeX
CB_GameOrigin.ValueMember =
CB_HPType.ValueMember = "Value";
var Any = new Util.cbItem {Text = "Any", Value = -1};
var Any = new ComboItem {Text = "Any", Value = -1};
var DS_Species = new List<Util.cbItem>(Main.SpeciesDataSource);
var DS_Species = new List<ComboItem>(Main.SpeciesDataSource);
DS_Species.RemoveAt(0); DS_Species.Insert(0, Any); CB_Species.DataSource = DS_Species;
var DS_Item = new List<Util.cbItem>(Main.ItemDataSource);
var DS_Item = new List<ComboItem>(Main.ItemDataSource);
DS_Item.Insert(0, Any); CB_HeldItem.DataSource = DS_Item;
var DS_Nature = new List<Util.cbItem>(Main.NatureDataSource);
var DS_Nature = new List<ComboItem>(Main.NatureDataSource);
DS_Nature.Insert(0, Any); CB_Nature.DataSource = DS_Nature;
var DS_Ability = new List<Util.cbItem>(Main.AbilityDataSource);
var DS_Ability = new List<ComboItem>(Main.AbilityDataSource);
DS_Ability.Insert(0, Any); CB_Ability.DataSource = DS_Ability;
var DS_Version = new List<Util.cbItem>(Main.VersionDataSource);
var DS_Version = new List<ComboItem>(Main.VersionDataSource);
DS_Version.Insert(0, Any); CB_GameOrigin.DataSource = DS_Version;
string[] hptypes = new string[Main.types.Length - 2]; Array.Copy(Main.types, 1, hptypes, 0, hptypes.Length);
@ -268,7 +268,7 @@ namespace PKHeX
DS_Type.Insert(0, Any); CB_HPType.DataSource = DS_Type;
// Set the Move ComboBoxes too..
var DS_Move = new List<Util.cbItem>(Main.MoveDataSource);
var DS_Move = new List<ComboItem>(Main.MoveDataSource);
DS_Move.RemoveAt(0); DS_Move.Insert(0, Any);
{
foreach (ComboBox cb in new[] { CB_Move1, CB_Move2, CB_Move3, CB_Move4 })

View file

@ -37,7 +37,7 @@ namespace PKHeX
}
// DataSource Providing
internal static List<cbItem> getCBList(string textfile, string lang)
internal static List<ComboItem> getCBList(string textfile, string lang)
{
// Set up
string[] inputCSV = getStringList(textfile);
@ -63,15 +63,15 @@ namespace PKHeX
Array.Sort(sortedList);
// Arrange the input data based on original number
return sortedList.Select(s => new cbItem
return sortedList.Select(s => new ComboItem
{
Text = s,
Value = indexes[Array.IndexOf(unsortedList, s)]
}).ToList();
}
internal static List<cbItem> getCBList(string[] inStrings, params int[][] allowed)
internal static List<ComboItem> getCBList(string[] inStrings, params int[][] allowed)
{
List<cbItem> cbList = new List<cbItem>();
List<ComboItem> cbList = new List<ComboItem>();
if (allowed?.First() == null)
allowed = new[] { Enumerable.Range(0, inStrings.Length).ToArray() };
@ -87,7 +87,7 @@ namespace PKHeX
Array.Sort(sortedChoices);
// Add the rest of the items
cbList.AddRange(sortedChoices.Select(s => new cbItem
cbList.AddRange(sortedChoices.Select(s => new ComboItem
{
Text = s,
Value = list[Array.IndexOf(unsortedChoices, s)]
@ -95,7 +95,7 @@ namespace PKHeX
}
return cbList;
}
internal static List<cbItem> getOffsetCBList(List<cbItem> cbList, string[] inStrings, int offset, int[] allowed)
internal static List<ComboItem> getOffsetCBList(List<ComboItem> cbList, string[] inStrings, int offset, int[] allowed)
{
if (allowed == null)
allowed = Enumerable.Range(0, inStrings.Length).ToArray();
@ -114,22 +114,22 @@ namespace PKHeX
Array.Sort(sortedChoices);
// Add the rest of the items
cbList.AddRange(sortedChoices.Select(s => new cbItem
cbList.AddRange(sortedChoices.Select(s => new ComboItem
{
Text = s,
Value = allowed[Array.IndexOf(unsortedChoices, s)]
}));
return cbList;
}
internal static List<cbItem> getVariedCBList(string[] inStrings, int[] stringNum, int[] stringVal)
internal static List<ComboItem> getVariedCBList(string[] inStrings, int[] stringNum, int[] stringVal)
{
// Set up
List<cbItem> newlist = new List<cbItem>();
List<ComboItem> newlist = new List<ComboItem>();
for (int i = 4; i > 1; i--) // add 4,3,2
{
// First 3 Balls are always first
cbItem ncbi = new cbItem
ComboItem ncbi = new ComboItem
{
Text = inStrings[i],
Value = i
@ -147,24 +147,24 @@ namespace PKHeX
Array.Sort(sortedballs);
// Add the rest of the balls
newlist.AddRange(sortedballs.Select(s => new cbItem
newlist.AddRange(sortedballs.Select(s => new ComboItem
{
Text = s,
Value = stringVal[Array.IndexOf(ballnames, s)]
}));
return newlist;
}
internal static List<cbItem> getUnsortedCBList(string textfile)
internal static List<ComboItem> getUnsortedCBList(string textfile)
{
// Set up
List<cbItem> cbList = new List<cbItem>();
List<ComboItem> cbList = new List<ComboItem>();
string[] inputCSV = getStringList(textfile);
// Gather our data from the input file
for (int i = 1; i < inputCSV.Length; i++)
{
string[] inputData = inputCSV[i].Split(',');
cbItem ncbi = new cbItem
ComboItem ncbi = new ComboItem
{
Text = inputData[1],
Value = Convert.ToInt32(inputData[0])

View file

@ -1,11 +0,0 @@
namespace PKHeX
{
public partial class Util
{
public class cbItem
{
public string Text { get; set; }
public int Value { get; set; }
}
}
}