private void ExportPlayerBtn_Click(object sender, EventArgs e)
{
// Create export directory if it doesnt exist yet
string sPath = Path.Combine(Paths.DocumentsFolder, "Player Backups");
if (!Directory.Exists(sPath))
Directory.CreateDirectory(sPath);
// Have user select folder
FolderSelect.FolderSelectDialog Dialog = new FolderSelect.FolderSelectDialog();
Dialog.InitialDirectory = sPath;
Dialog.Title = "Select folder to export player to";
if (Dialog.ShowDialog())
{
try
{
StatsManager.ExportPlayerXml(sPath, Pid, Player["name"].ToString());
Notify.Show("Player Exported Successfully", String.Format("{0} ({1})", Player["name"].ToString(), Pid), AlertType.Success);
}
catch (DbConnectException Ex)
{
HttpServer.Stop();
ExceptionForm.ShowDbConnectError(Ex);
this.Close();
}
catch (Exception E)
{
using (ExceptionForm EForm = new ExceptionForm(E, false))
{
EForm.Message = "Unable to export player because an exception was thrown!";
EForm.ShowDialog();
}
}
}
}