mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-14 16:27:21 +00:00
Merge pull request #8 from SoujiSeta/master
Testing Pull Request to merge changes to help with mono compatibility.
This commit is contained in:
commit
da11afa639
4 changed files with 61 additions and 45 deletions
|
@ -2770,7 +2770,7 @@ namespace PKHeX
|
|||
}
|
||||
else if ((species == 521) && (gender == 1)) // Unfezant
|
||||
{
|
||||
file = file = "_" + species.ToString() + "f";
|
||||
file = "_" + species.ToString() + "f";
|
||||
}
|
||||
}
|
||||
if (species == 0)
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace PKHeX
|
|||
{
|
||||
if (m_parent.init)
|
||||
{
|
||||
if (InvokeRequired)
|
||||
if (InvokeRequired && IsHandleCreated)
|
||||
Invoke((MethodInvoker)delegate(){Close();});
|
||||
else
|
||||
Close();
|
||||
|
|
80
Misc/Util.cs
80
Misc/Util.cs
|
@ -186,62 +186,56 @@ namespace PKHeX
|
|||
}
|
||||
|
||||
internal static int ToInt32(TextBox tb)
|
||||
{
|
||||
string value = tb.Text;
|
||||
if (String.IsNullOrEmpty(value))
|
||||
{ return 0; }
|
||||
try
|
||||
{ return Int32.Parse(value); }
|
||||
catch
|
||||
{ return 0; }
|
||||
}
|
||||
{
|
||||
string value = tb.Text;
|
||||
return ToInt32(value);
|
||||
}
|
||||
internal static uint ToUInt32(TextBox tb)
|
||||
{
|
||||
string value = tb.Text;
|
||||
if (String.IsNullOrEmpty(value))
|
||||
{ return 0; }
|
||||
try
|
||||
{ return UInt32.Parse(value); }
|
||||
catch
|
||||
{ return 0; }
|
||||
}
|
||||
{
|
||||
string value = tb.Text;
|
||||
return ToUInt32(value);
|
||||
}
|
||||
internal static int ToInt32(MaskedTextBox tb)
|
||||
{
|
||||
string value = tb.Text;
|
||||
if (String.IsNullOrEmpty(value))
|
||||
{ return 0; }
|
||||
try
|
||||
{ return Int32.Parse(value); }
|
||||
catch
|
||||
{ return 0; }
|
||||
return ToInt32(value);
|
||||
}
|
||||
internal static uint ToUInt32(MaskedTextBox tb)
|
||||
{
|
||||
string value = tb.Text;
|
||||
if (String.IsNullOrEmpty(value))
|
||||
{ return 0; }
|
||||
try
|
||||
{ return UInt32.Parse(value); }
|
||||
catch
|
||||
{ return 0; }
|
||||
return ToUInt32(value);
|
||||
}
|
||||
internal static int ToInt32(String value)
|
||||
{
|
||||
if (String.IsNullOrEmpty(value))
|
||||
{ return 0; }
|
||||
if (String.IsNullOrEmpty(value))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
try
|
||||
{ return Int32.Parse(value); }
|
||||
{
|
||||
value = value.TrimEnd(new char[]{'_'});
|
||||
return Int32.Parse(value);
|
||||
}
|
||||
catch
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
internal static uint ToUInt32(String value)
|
||||
{
|
||||
if (String.IsNullOrEmpty(value))
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
try
|
||||
{ return UInt32.Parse(value); }
|
||||
{
|
||||
value = value.TrimEnd(new char[]{'_'});
|
||||
return UInt32.Parse(value);
|
||||
}
|
||||
catch
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
internal static uint getHEXval(TextBox tb)
|
||||
{
|
||||
|
@ -253,12 +247,20 @@ namespace PKHeX
|
|||
internal static int getIndex(ComboBox cb)
|
||||
{
|
||||
int val = 0;
|
||||
try { val = Util.ToInt32(cb.SelectedValue.ToString()); }
|
||||
if (cb.SelectedValue == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
val = Util.ToInt32(cb.SelectedValue.ToString());
|
||||
}
|
||||
catch
|
||||
{
|
||||
val = cb.SelectedIndex;
|
||||
if (val < 0) val = 0;
|
||||
};
|
||||
}
|
||||
return val;
|
||||
}
|
||||
internal static string getOnlyHex(string str)
|
||||
|
|
|
@ -1481,9 +1481,15 @@ namespace PKHeX
|
|||
origin_list.Add(item);
|
||||
}
|
||||
|
||||
/*
|
||||
* Moving the assignment of the Display and ValueMemeber to before the DataSource is assigned
|
||||
as assigning the DataSource causes a onSelectedIndexChanged which causes a call
|
||||
to updateOriginGame which access the SelectedValue property, but since there is no
|
||||
ValueMember assigned it uses the cbItem to string method which returns the Text member
|
||||
*/
|
||||
CB_GameOrigin.DisplayMember = "Text";
|
||||
CB_GameOrigin.ValueMember = "Value";
|
||||
CB_GameOrigin.DataSource = origin_list;
|
||||
CB_GameOrigin.DisplayMember = "Text";
|
||||
CB_GameOrigin.ValueMember = "Value";
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
@ -2789,7 +2795,10 @@ namespace PKHeX
|
|||
int gameorigin = 0;
|
||||
|
||||
// Error handling for unset field
|
||||
try { gameorigin = Util.ToInt32(CB_GameOrigin.SelectedValue.ToString()); }
|
||||
try
|
||||
{
|
||||
gameorigin = Util.ToInt32(CB_GameOrigin.SelectedValue.ToString());
|
||||
}
|
||||
catch { gameorigin = 0; }
|
||||
|
||||
if ((gameorigin <= 12) && (gameorigin >= 7))
|
||||
|
@ -3980,7 +3989,7 @@ namespace PKHeX
|
|||
};
|
||||
for (int i = 0; i < cba.Length; i++)
|
||||
{
|
||||
if (cba[i].BackColor != SystemColors.Window && cba[i].BackColor != Color.Empty)
|
||||
if (cba[i].BackColor != System.Drawing.SystemColors.Control && cba[i].BackColor != Color.Empty)
|
||||
{
|
||||
if (i < 6) // Main Tab
|
||||
tabMain.SelectedIndex = 0;
|
||||
|
@ -6404,6 +6413,11 @@ namespace PKHeX
|
|||
{
|
||||
return Text;
|
||||
}
|
||||
|
||||
public int GetValue()
|
||||
{
|
||||
return Util.ToInt32 (Value.ToString());
|
||||
}
|
||||
}
|
||||
public class SaveGames
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue