private void batLoader(string filename, string safename)
{
try
{
bool skip = false;
string opconfig = null;
if (File.Exists(filename))
{
source = filename;
string[] loadbat = File.ReadAllLines(filename);
bool found = false;
foreach (string line in loadbat)
{
string[] sepline = line.Split('\\');
if (sepline[sepline.Count() - 1].ToLower().Replace("@","").Trim().StartsWith("cudaminer"))
{
found = true;
string[] divi = sepline[sepline.Count() - 1].Split(' ');
int indkeep = 0;
foreach (string div in divi)
{
indkeep++;
if (div.Contains("-H"))
{
switch (divi[indkeep])
{
case "0":
CBcores.SelectedIndex = 1;
break;
case "1":
CBcores.SelectedIndex = 2;
break;
default:
CBcores.SelectedIndex = 0;
break;
}
skip = true;
}
else if (div.Contains("-i"))
{
switch (divi[indkeep])
{
case "0":
chkInter.Checked = false;
break;
default:
chkInter.Checked = true;
break;
}
skip = true;
}
else if (div.Contains("-o"))
{
TBstrat.Text = divi[indkeep];
tbnickname.Text = safename.Replace(".bat", "");
skip = true;
}
else if (div.Contains("-O"))
{
String[] wrksplit = divi[indkeep].Split(':');
tbWorker.Text = wrksplit[0];
TBpass.Text = wrksplit[1];
skip = true;
}
else if (div.Contains("-u"))
{
tbWorker.Text = divi[indkeep];
skip = true;
}
else if (div.Contains("-p"))
{
TBpass.Text = divi[indkeep];
skip = true;
}
else if (skip)
{
skip = false;
}
else if (!div.ToLower().Contains("cudaminer"))
{
opconfig += div + " ";
}
}
tbConfig.Text = opconfig;
TBstrat.ForeColor = Color.Black;
}
}
if (!found)
{
MessageBox.Show("Selected file does not have a cudaminer command!");
}
}
}
catch { MessageBox.Show("Unable to load miner file."); }
}