using System;
using System.Diagnostics;

namespace Restarter
{
    internal class Core
    {
        private static void Main()
        {
            Console.CursorVisible = false;
            Console.Title = "Emulator Restarter";
            Writer("Starting Emulator Restarter", ConsoleColor.White);
            StartEmulator();
        }

        private static void StartEmulator()
        {
            try
            {
               Process Process = new Process
               {
                   StartInfo = { FileName = "v1_Pub.exe" }
               };
                    Process.Start();
                    Process.WaitForExit();
                    Console.Beep();
                    StartEmulator();
            }
            catch (Exception e)
            {
                Writer(e.Message, ConsoleColor.Red);
            }
            while(true)
            {
            }
        }

        private static void Writer(string Text, ConsoleColor Color)
        {
            DateTime Time = DateTime.Now;
            Console.ForegroundColor = ConsoleColor.White;
            Console.Write("[");
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.Write(Time.ToString("HH:mm"));
            Console.ForegroundColor = ConsoleColor.White;
            Console.Write("]");
            Console.Write(" \x00bb ");
            Console.ForegroundColor = Color;
            Console.Write(Text);
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine();
        }
    }
}
