private void fontToolStripMenuItem_Click(object sender, EventArgs e)
{
FontDialog d = new FontDialog();
d.Font = rtbFont;
DialogResult result = d.ShowDialog();
if (result == DialogResult.OK && (!rtbFont.Name.Equals(d.Font.Name) || (rtbFont.Style != d.Font.Style) || (rtbFont.Size != d.Font.Size)))
{
rtbFont = d.Font;
foreach (FixedRichTextBox rtb in scripts)
{
rtb.SelectAll();
rtb.SelectionFont = d.Font;
rtb.DeselectAll();
rtbNotes.SelectAll();
rtbNotes.SelectionFont = d.Font;
rtbNotes.DeselectAll();
rtb.Font = d.Font;
rtbNotes.Font = d.Font;
}
string[] ini = File.ReadAllLines(System.Windows.Forms.Application.StartupPath + @"\Data\BattleScriptPro.ini");
List<string> newIni = new List<string>();
foreach (string s in ini)
{
if (s.StartsWith("font="))
{
string[] line = s.Split('=');
line[1] = d.Font.Name;
newIni.Add(line[0] + "=" + line[1]);
}
else if (s.StartsWith("fontstyle="))
{
string[] line = s.Split('=');
line[1] = d.Font.Style.ToString();
newIni.Add(line[0] + "=" + line[1]);
}
else if (s.StartsWith("fontsize="))
{
string[] line = s.Split('=');
line[1] = d.Font.SizeInPoints.ToString();
newIni.Add(line[0] + "=" + line[1]);
}
else
{
newIni.Add(s);
}
}
File.WriteAllLines(System.Windows.Forms.Application.StartupPath + @"\Data\BattleScriptPro.ini", newIni.ToArray());
}
}