public void ReloadRestart()
{
ZetaDia.Service.Games.LeaveGame();
System.Threading.Thread.Sleep(12000);
BotMain.Stop();
#region save tmp file
string fp = [B]Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments)[/B] + "\\BWTmp.xml";
System.IO.Stream s = null;
System.IO.StreamWriter w = null;
try
{
try
{
if (System.IO.File.Exists(fp))
{
System.IO.File.Delete(fp);
}
}
catch (Exception failed) { Logging.Write(LogLevel.Verbose, "Error: " + failed.Message); }
s = System.IO.File.Open(fp, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write, System.IO.FileShare.Read);
w = new System.IO.StreamWriter(s);
lock (this)
{
w.Write(reloadProfileXml.Text);
}
}
catch (Exception ex)
{
Logging.Write("Error: " + ex.Message);
}
finally
{
if (null != w)
{
w.Close();
w.Dispose();
w = null;
}
if (null != s)
{
s.Close();
s.Dispose();
s = null;
}
}
#endregion
Zeta.CommonBot.ProfileManager.Load([B]Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments)[/B] + "\\BWTmp.xml");
BotMain.Start();
}