Beispiel #1
0
        static public void Start()
        {
            if (Instance != null)
            {
                return;
            }

            Instance = new ConsoleMgr();

            try
            {
                Instance.LoadConsoleHandler();
            }
            catch (Exception e)
            {
                Log.Error("ConsoleMgr", "Can not load : " + e.ToString());
            }

            while (Instance._IsRunning)
            {
                string line;

                try
                {
                    line = Console.ReadLine();
                }
                catch
                {
                    // Console fermée
                    break;
                }

                if (line == null)
                {
                    break;
                }

                lock (Console.Out)
                {
                    if (line.StartsWith("."))
                    {
                        line = line.Substring(1);

                        if (!Instance.ExecuteCommand(line))
                        {
                            Log.Error("ConsoleMgr", "Command not found");
                        }
                    }
                    else
                    {
                        CleanLine(line.Length);
                    }
                }
            }
        }
Beispiel #2
0
        public static void Start()
        {
            if (Instance != null)
                return;

            Instance = new ConsoleMgr();

            try
            {
                Instance.LoadConsoleHandler();
            }
            catch (Exception e)
            {
                Log.Error("ConsoleMgr", "Can not load : " + e.ToString());
            }

            while (Instance._IsRunning)
            {
                string line;

                try
                {
                    line = Console.ReadLine();
                }
                catch
                {
                    // Console fermée
                    break;
                }

                if ( line == null )
                {
                    break;
                }

                lock (Console.Out)
                {

                    if (line.StartsWith("."))
                    {
                        line = line.Substring(1);

                        if (!Instance.ExecuteCommand(line))
                            Log.Error("ConsoleMgr", "Command not found");
                    }else CleanLine(line.Length);
                }
            }
        }