public BF2sConfig()
{
InitializeComponent();
// Get a list of all medal data
string[] medalList = Directory.GetFiles(PythonPath, "medal_data_*.py");
foreach (string file in medalList)
{
// Remove the path to the file
string fileF = file.Remove(0, PythonPath.Length + 1);
// Remove .py extension, and add it to the list of files
fileF = fileF.Remove(fileF.Length - 3, 3).Replace("medal_data_", "");
MedalData.Items.Add(fileF);
MedalList.Add(fileF);
}
// Use the stream reader to load the config
try
{
LoadConfig();
}
catch (Exception e)
{
MessageBox.Show(
"Unable to Read/Write to the Bf2Statistics Config python file:" + Environment.NewLine
+ Environment.NewLine + "Error: " + e.Message,
"Error", MessageBoxButtons.OK, MessageBoxIcon.Warning
);
// Close this form
this.Load += (s, ev) => Close();
}
}