private void ExceptionHandler_FormClosed(object sender, FormClosedEventArgs e) { DialogResult r = MessageBox.Show("Would you like to try and recover from this error? Some progress might be lost.", "Exception Handler", MessageBoxButtons.YesNo); if (r == System.Windows.Forms.DialogResult.Yes) { using (StreamWriter sw = new StreamWriter("recoveryinformation.dat")) { sw.WriteLine("status=" + Program.AppStatus); if (Program.AppStatus == Utility.AppStatus.Updating || Program.AppStatus == Utility.AppStatus.Connecting) { sw.WriteLine("server.ip=" + MainForm.Instance.Server.Address); sw.WriteLine("server.port=" + MainForm.Instance.Server.Port); sw.WriteLine("server.name=" + MainForm.Instance.Server.Name); } sw.Flush(); sw.Close(); sw.Dispose(); } Application.Restart(); return; } CloseProgram.Invoke(); Process.GetCurrentProcess().Kill(); }
static void Main(string[] args) { var exit = ""; Console.Title = "rOBOt"; Console.OutputEncoding = System.Text.Encoding.Unicode; Console.ForegroundColor = ConsoleColor.Green; DrawGame paintSurface = new DrawGame(); SurfaceBase surfaceDimensions = new SurfaceBase(); Questionaries questionary = new Questionaries(); List <Coordinates> dangerCoordinates = new List <Coordinates>(); Console.WriteLine(Tittle.MartianRobot); Console.ResetColor(); Thread.Sleep(50); surfaceDimensions = questionary.DefineSurface(); while (exit != "E") { paintSurface.Paint(surfaceDimensions, dangerCoordinates, null, null, null); Console.SetCursorPosition(5, 24); Console.WriteLine("Enter to continue. For Exit type `E`:"); exit = Console.ReadLine().ToString().ToUpper(); Console.Clear(); } Console.WriteLine($"Danger coordinates:"); Console.WriteLine($"--------"); foreach (var dangerUbication in dangerCoordinates) { Console.WriteLine($"X: {dangerUbication.XPosition}, Y: {dangerUbication.YPosition} "); } Thread.Sleep(6000); CloseProgram.Close(); }