Skip to content

Commit

Permalink
Giveaway Detail Detection, Mass Remove Fix
Browse files Browse the repository at this point in the history
Details for pokemon filled in with drag and drop
Can now mass delete details
Optional Folder no longer required
  • Loading branch information
imaboy321 committed Jan 25, 2017
1 parent e490503 commit 74f7135
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 4 deletions.
Binary file modified .vs/Ledybot/v14/.suo
Binary file not shown.
1 change: 0 additions & 1 deletion Ledybot/GDInput.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 64 additions & 1 deletion Ledybot/GDInput.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Linq;
using System.Windows.Forms;

namespace Ledybot
Expand Down Expand Up @@ -67,7 +68,69 @@ private void GDInput_DragDrop(object sender, DragEventArgs e)
}
else
{
tb_Default.Text = input;
if(Path.GetExtension(input) == ".pk7")
{
//byte[] pkmEncrypted =
Program.pkhex.Data = System.IO.File.ReadAllBytes(input);
nud_DexNumber.Value = Program.pkhex.Species;
int level = Program.PKTable.getLevel(Program.pkhex.Species, (int) Program.pkhex.EXP);
int gender = Program.pkhex.Gender;
if(level < 11)
{
cmb_Levels.SelectedIndex = 0;
}
else if(level < 21)
{
cmb_Levels.SelectedIndex = 1;
}
else if(level < 31)
{
cmb_Levels.SelectedIndex = 2;
}
else if(level < 41)
{
cmb_Levels.SelectedIndex = 3;
}
else if(level < 51)
{
cmb_Levels.SelectedIndex = 4;
}
else if(level < 61)
{
cmb_Levels.SelectedIndex = 5;
}
else if(level < 71)
{
cmb_Levels.SelectedIndex = 6;
}
else if(level < 81)
{
cmb_Levels.SelectedIndex = 7;
}
else if(level < 91)
{
cmb_Levels.SelectedIndex = 8;
}
else
{
cmb_Levels.SelectedIndex = 9;
}
switch(gender)
{
case 0:
cmb_Gender.SelectedIndex = 0;
break;
case 1:
cmb_Gender.SelectedIndex = 1;
break;
default:
cmb_Gender.SelectedIndex = 0;
break;
}
tb_Default.Text = input;
tb_Specific.Text = Path.GetDirectoryName(input) + "\\" + Path.GetFileNameWithoutExtension(input) + "\\";
}

}
}
}
Expand Down
9 changes: 7 additions & 2 deletions Ledybot/GiveawayDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private void loadDetails()
details.ReadXml(Application.StartupPath + "\\giveawaydetails.xml");
}

foreach(DataRow row in details.Rows)
foreach (DataRow row in details.Rows)
{
Program.f1.giveawayDetails.Add((int)row[0], new Tuple<string, string, int, int, int, ArrayList>(row[1].ToString(), row[2].ToString(), (int)row[3], (int)row[4], (int)row[5], new ArrayList()));
}
Expand All @@ -52,7 +52,7 @@ private void btn_Add_Click(object sender, EventArgs e)
GDInput input = new GDInput();
if (input.ShowDialog(this) == DialogResult.OK)
{
if (input.specific != "")
if (input.def != "" || input.specific != "")
{
if (Program.f1.giveawayDetails.ContainsKey(input.dex))
{
Expand All @@ -66,6 +66,8 @@ private void btn_Add_Click(object sender, EventArgs e)
}
}
}
if (input.specific != "")
Directory.CreateDirectory(input.specific);
details.Rows.Add(input.dex, input.def, input.specific, input.gender + 1, input.level + 1, input.count, 0);
Program.f1.giveawayDetails.Add(input.dex, new Tuple<string, string, int, int, int, ArrayList>(input.def, input.specific, input.gender + 1, input.level + 1, input.count, new ArrayList()));
}
Expand All @@ -82,7 +84,10 @@ private void btn_Delete_Click(object sender, EventArgs e)
{
DataRow dr = details.Rows[i];
if (dr[0].ToString() == row.Cells[0].Value.ToString())
{
dr.Delete();
break;
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions Ledybot/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ static class Program
public static Boolean Connected = false;
public static MainForm f1;
public static LookupTable PKTable;
public static PKHeX pkhex;
public static GiveawayDetails gd;
public static BanlistDetails bld;
/// <summary>
Expand All @@ -23,6 +24,7 @@ static void Main()
scriptHelper = new ScriptHelper();
helper = new RemoteControl();
PKTable = new LookupTable();
pkhex = new PKHeX();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
f1 = new MainForm();
Expand Down

0 comments on commit 74f7135

Please sign in to comment.