Skip to content

Commit

Permalink
Import and Clear ListView options
Browse files Browse the repository at this point in the history
  • Loading branch information
imaboy321 committed Feb 5, 2017
1 parent 19565c1 commit 01cd7f4
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 37 deletions.
Binary file modified .vs/Ledybot/v14/.suo
Binary file not shown.
96 changes: 60 additions & 36 deletions Ledybot/Form1.Designer.cs

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

38 changes: 37 additions & 1 deletion Ledybot/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public MainForm()
Program.ntrClient.InfoReady += getGame;
delLastLog = new LogDelegate(lastLog);
InitializeComponent();

ofd_Injection.Title = "Select an EKX/PKX file";
ofd_Injection.Filter = "Gen 7 pokémon files|*.pk7";
string path = @Application.StartupPath;
Expand Down Expand Up @@ -235,6 +234,33 @@ private static void WriteCSVRow(StringBuilder result, int itemsCount, Func<int,
result.AppendLine();
}

private void ImportCSV()
{
FileStream srcFS;
srcFS = new FileStream(AppDomain.CurrentDomain.BaseDirectory + "\\export.csv", FileMode.Open);
StreamReader srcSR = new StreamReader(srcFS, System.Text.Encoding.Default);
srcSR.ReadLine();
do
{
string ins = srcSR.ReadLine();
if (ins != null)
{
string[] columns = ins.Replace("\"", "").Split(',');

ListViewItem lvi = new ListViewItem(columns[0]);

for (int i = 1; i < columns.Count(); i++)
{
lvi.SubItems.Add(columns[i]);
}

lv_log.Items.Add(lvi);
}
else break;
} while (true);
srcSR.Close();
}

private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
Properties.Settings.Default.IP = tb_IP.Text;
Expand Down Expand Up @@ -501,6 +527,16 @@ public void updateJSON()

}
}

private void btn_Import_Click(object sender, EventArgs e)
{
ImportCSV();
}

private void btn_Clear_Click(object sender, EventArgs e)
{
lv_log.Items.Clear();
}
}

public class DataReadyWaiting
Expand Down

0 comments on commit 01cd7f4

Please sign in to comment.