private void ClearBtn_Click(object sender, EventArgs e)
{
int Counter = 0;
string[] fileNames = Directory.GetFiles(Path.Combine(Program.RootPath, "Web", "Bf2Stats", "Cache"));
foreach (string fileName in fileNames)
{
try
{
File.Delete(fileName);
Counter++;
}
catch { }
}
MessageBox.Show(
String.Format("Successfully cleared {0} of {1} cached files.", Counter, fileNames.Length),
"Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information
);
}