private void radioButtons_CheckedChanged(object sender, EventArgs e)
{
RadioButton originator = (RadioButton)sender;
if (originator.Checked)
{
List <string> newIni = new List <string>();
string name = originator.Name.Substring(5);
string filePath = System.Windows.Forms.Application.StartupPath + @"\Data\BattleScriptPro.ini";
if (originator.Parent == this.Controls["grpBoxComments"])
{
if (File.Exists(filePath))
{
string[] ini = File.ReadAllLines(filePath);
switch (name)
{
case "SemiColon":
name = ";;";
break;
case "BackSlash":
name = "//";
break;
case "Apostrophe":
name = "''";
break;
default:
name = "::";
break;
}
foreach (string s in ini)
{
if (s.StartsWith("commentString"))
{
newIni.Add("commentString=" + name);
}
else
{
newIni.Add(s);
}
}
parent.ChangeCommentString(name);
File.WriteAllLines(filePath, newIni.ToArray());
}
}
else if (originator.Parent == this.Controls["grpBoxDecMode"])
{
if (File.Exists(filePath))
{
string[] ini = File.ReadAllLines(filePath);
foreach (string s in ini)
{
if (s.StartsWith("decompileMode"))
{
newIni.Add("decompileMode=" + name);
}
else
{
newIni.Add(s);
}
}
parent.ChangeDecompileMode(name);
File.WriteAllLines(filePath, newIni.ToArray());
}
}
else
{
if (File.Exists(filePath))
{
string[] ini = File.ReadAllLines(filePath);
foreach (string s in ini)
{
if (s.StartsWith("numberDecompileMode"))
{
newIni.Add("numberDecompileMode=" + name);
}
else
{
newIni.Add(s);
}
}
parent.ChangeNumberDecompileMode(name);
File.WriteAllLines(filePath, newIni.ToArray());
}
}
}
}