Ejemplo n.º 1
0
 public void StartInputting(string[] args)
 {
     while (true)
     {
         GuiApp.LineRed(Console.ReadLine());
     }
 }
Ejemplo n.º 2
0
 public void StartInputting()
 {
     while (true)
     {
         GuiApp.LineRed(System.Console.ReadLine());
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Initialisiert eine neue Instanz der Klasse <see cref="MainForm" />.
        /// </summary>
        public MainForm()
        {
            this.InitializeComponent();

            this._APPS = GuiApp.GetValidGuiProcesses()
                         .ToArray();
        }
Ejemplo n.º 4
0
        public static int Main(string[] p_Args)
        {
            var guiApp = new GuiApp();

            guiApp.InitializeComponent();
            guiApp.Run();
            return(0);
        }
Ejemplo n.º 5
0
        public Server(string[] args)
        {
            GuiApp.Setup(args);
            ConsoleFunctions.ClearConsole();

            if (!args.Contains("--minimal"))
            {
                for (var i = 0; i < 10; i++)
                {
                    ConsoleFunctions.Write(
                        TextUtils.ToChatText(
                            "\u00A74\u00A7l[ETHO]\u00A7r \u00A7l\u00A7nUSE\u00A77 --minimal\u00A7r \u00A7l\u00A7nIN PROGRAM ARGUMENTS TO FIX ASYNC WRITING OR DEAL W/ IT")
                        );
                }
            }
            ConsoleFunctions.WriteInfoLine("For some reason, writing async in non-minimal console doesn't work.");
            ConsoleFunctions.WriteInfoLine("For some reason, the server doesn't close all threads. Just kill it for now.");
            ConsoleFunctions.WriteInfoLine("Registering default events...");
            EventManager.RegisterDefaultEvents();

            ConsoleFunctions.WriteInfoLine("Loading plugins...");
            PluginManager.RegisterPlugins();

            ConsoleFunctions.WriteInfoLine("Initiating server on {0}", Globals.ProtocolName);
            CurrentDirectory = Directory.GetCurrentDirectory();
            var currentDomain = AppDomain.CurrentDomain;

            currentDomain.UnhandledException += UnhandledException;

            ConsoleFunctions.Pause();
            ConsoleFunctions.WriteInfoLine("Enabling global error handling... ");
            ConsoleFunctions.WriteLine("Enabled.", ConsoleColor.Green);
            ConsoleFunctions.Continue();

            ConsoleFunctions.Pause();
            ConsoleFunctions.WriteInfoLine("Checking if server properties exist... ");
            ConsoleFunctions.WriteLine(LoadSettings() ? "Loading." : "Created.", ConsoleColor.Green);
            ConsoleFunctions.Continue();

            ConsoleFunctions.Pause();
            ConsoleFunctions.WriteInfoLine("Loading server variables... ");
            ConsoleFunctions.WriteLine("Loaded.", ConsoleColor.Green);
            ConsoleFunctions.Continue();

            ConsoleFunctions.Pause();
            ConsoleFunctions.WriteInfoLine("Checking files and directories... ");
            CheckDirectoriesAndFiles();
            ConsoleFunctions.WriteLine("Files are good hopefully.", ConsoleColor.Green);
            ConsoleFunctions.Continue();

            Initiated = true;
        }
Ejemplo n.º 6
0
        private static void Main(string[] args)
        {
            // try {
            GuiApp.Log(new FancyText("Black ", FancyColor.Black)
            {
                Next = new FancyText("DarkBlue ", FancyColor.DarkBlue)
                {
                    Next = new FancyText("DarkGreen ", FancyColor.DarkGreen)
                    {
                        Next = new FancyText("DarkAqua ", FancyColor.DarkAqua)
                        {
                            Next = new FancyText("DarkRed ", FancyColor.DarkRed)
                            {
                                Next = new FancyText("DarkPurple ", FancyColor.DarkPurple)
                                {
                                    Next = new FancyText("Gold ", FancyColor.Gold)
                                    {
                                        Next = new FancyText("Gray ", FancyColor.Gray)
                                        {
                                            Next = new FancyText("DarkGray ", FancyColor.DarkGray)
                                            {
                                                Next = new FancyText("Blue ", FancyColor.Blue)
                                                {
                                                    Next = new FancyText("Green ", FancyColor.Green)
                                                    {
                                                        Next = new FancyText("Aqua ", FancyColor.Aqua)
                                                        {
                                                            Next = new FancyText("Red ", FancyColor.Red)
                                                            {
                                                                Next = new FancyText("Purple ", FancyColor.Purple)
                                                                {
                                                                    Next = new FancyText("Yellow ", FancyColor.Yellow)
                                                                    {
                                                                        Next = new FancyText("White ", FancyColor.White)
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            });
            GuiApp.Log(new FancyText("Black ", FancyColor.Black, FancyColor.Bold)
            {
                Next = new FancyText("DarkBlue ", FancyColor.DarkBlue, FancyColor.Bold)
                {
                    Next = new FancyText("DarkGreen ", FancyColor.DarkGreen, FancyColor.Bold)
                    {
                        Next = new FancyText("DarkAqua ", FancyColor.DarkAqua, FancyColor.Bold)
                        {
                            Next = new FancyText("DarkRed ", FancyColor.DarkRed, FancyColor.Bold)
                            {
                                Next = new FancyText("DarkPurple ", FancyColor.DarkPurple, FancyColor.Bold)
                                {
                                    Next = new FancyText("Gold ", FancyColor.Gold, FancyColor.Bold)
                                    {
                                        Next = new FancyText("Gray ", FancyColor.Gray, FancyColor.Bold)
                                        {
                                            Next = new FancyText("DarkGray ", FancyColor.DarkGray, FancyColor.Bold)
                                            {
                                                Next = new FancyText("Blue ", FancyColor.Blue, FancyColor.Bold)
                                                {
                                                    Next = new FancyText("Green ", FancyColor.Green, FancyColor.Bold)
                                                    {
                                                        Next = new FancyText("Aqua ", FancyColor.Aqua, FancyColor.Bold)
                                                        {
                                                            Next = new FancyText("Red ", FancyColor.Red,
                                                                                 FancyColor.Bold)
                                                            {
                                                                Next = new FancyText("Purple ", FancyColor.Purple,
                                                                                     FancyColor.Bold)
                                                                {
                                                                    Next = new FancyText("Yellow ", FancyColor.Yellow,
                                                                                         FancyColor.Bold)
                                                                    {
                                                                        Next = new FancyText("White Bold",
                                                                                             FancyColor.White, FancyColor.Bold)
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            });
            GuiApp.Log(new FancyText("Black ", FancyColor.Black, FancyColor.Italic)
            {
                Next = new FancyText("DarkBlue ", FancyColor.DarkBlue, FancyColor.Italic)
                {
                    Next = new FancyText("DarkGreen ", FancyColor.DarkGreen, FancyColor.Italic)
                    {
                        Next = new FancyText("DarkAqua ", FancyColor.DarkAqua, FancyColor.Italic)
                        {
                            Next = new FancyText("DarkRed ", FancyColor.DarkRed, FancyColor.Italic)
                            {
                                Next = new FancyText("DarkPurple ", FancyColor.DarkPurple, FancyColor.Italic)
                                {
                                    Next = new FancyText("Gold ", FancyColor.Gold, FancyColor.Italic)
                                    {
                                        Next = new FancyText("Gray ", FancyColor.Gray, FancyColor.Italic)
                                        {
                                            Next = new FancyText("DarkGray ", FancyColor.DarkGray, FancyColor.Italic)
                                            {
                                                Next = new FancyText("Blue ", FancyColor.Blue, FancyColor.Italic)
                                                {
                                                    Next = new FancyText("Green ", FancyColor.Green, FancyColor.Italic)
                                                    {
                                                        Next = new FancyText("Aqua ", FancyColor.Aqua,
                                                                             FancyColor.Italic)
                                                        {
                                                            Next = new FancyText("Red ", FancyColor.Red,
                                                                                 FancyColor.Italic)
                                                            {
                                                                Next = new FancyText("Purple ", FancyColor.Purple,
                                                                                     FancyColor.Italic)
                                                                {
                                                                    Next = new FancyText("Yellow ", FancyColor.Yellow,
                                                                                         FancyColor.Italic)
                                                                    {
                                                                        Next = new FancyText("White Italic",
                                                                                             FancyColor.White, FancyColor.Italic)
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            });
            GuiApp.Log(new FancyText("Black ", FancyColor.Black, FancyColor.Underline)
            {
                Next = new FancyText("DarkBlue ", FancyColor.DarkBlue, FancyColor.Underline)
                {
                    Next = new FancyText("DarkGreen ", FancyColor.DarkGreen, FancyColor.Underline)
                    {
                        Next = new FancyText("DarkAqua ", FancyColor.DarkAqua, FancyColor.Underline)
                        {
                            Next = new FancyText("DarkRed ", FancyColor.DarkRed, FancyColor.Underline)
                            {
                                Next = new FancyText("DarkPurple ", FancyColor.DarkPurple, FancyColor.Underline)
                                {
                                    Next = new FancyText("Gold ", FancyColor.Gold, FancyColor.Underline)
                                    {
                                        Next = new FancyText("Gray ", FancyColor.Gray, FancyColor.Underline)
                                        {
                                            Next = new FancyText("DarkGray ", FancyColor.DarkGray, FancyColor.Underline)
                                            {
                                                Next = new FancyText("Blue ", FancyColor.Blue, FancyColor.Underline)
                                                {
                                                    Next = new FancyText("Green ", FancyColor.Green,
                                                                         FancyColor.Underline)
                                                    {
                                                        Next = new FancyText("Aqua ", FancyColor.Aqua,
                                                                             FancyColor.Underline)
                                                        {
                                                            Next = new FancyText("Red ", FancyColor.Red,
                                                                                 FancyColor.Underline)
                                                            {
                                                                Next = new FancyText("Purple ", FancyColor.Purple,
                                                                                     FancyColor.Underline)
                                                                {
                                                                    Next = new FancyText("Yellow ", FancyColor.Yellow,
                                                                                         FancyColor.Underline)
                                                                    {
                                                                        Next = new FancyText("White Underline",
                                                                                             FancyColor.White, FancyColor.Underline)
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            });
            GuiApp.Log(new FancyText("Black ", FancyColor.Black, FancyColor.Strikethrough)
            {
                Next = new FancyText("DarkBlue ", FancyColor.DarkBlue, FancyColor.Strikethrough)
                {
                    Next = new FancyText("DarkGreen ", FancyColor.DarkGreen, FancyColor.Strikethrough)
                    {
                        Next = new FancyText("DarkAqua ", FancyColor.DarkAqua, FancyColor.Strikethrough)
                        {
                            Next = new FancyText("DarkRed ", FancyColor.DarkRed, FancyColor.Strikethrough)
                            {
                                Next = new FancyText("DarkPurple ", FancyColor.DarkPurple, FancyColor.Strikethrough)
                                {
                                    Next = new FancyText("Gold ", FancyColor.Gold, FancyColor.Strikethrough)
                                    {
                                        Next = new FancyText("Gray ", FancyColor.Gray, FancyColor.Strikethrough)
                                        {
                                            Next = new FancyText("DarkGray ", FancyColor.DarkGray,
                                                                 FancyColor.Strikethrough)
                                            {
                                                Next = new FancyText("Blue ", FancyColor.Blue, FancyColor.Strikethrough)
                                                {
                                                    Next = new FancyText("Green ", FancyColor.Green,
                                                                         FancyColor.Strikethrough)
                                                    {
                                                        Next = new FancyText("Aqua ", FancyColor.Aqua,
                                                                             FancyColor.Strikethrough)
                                                        {
                                                            Next = new FancyText("Red ", FancyColor.Red,
                                                                                 FancyColor.Strikethrough)
                                                            {
                                                                Next = new FancyText("Purple ", FancyColor.Purple,
                                                                                     FancyColor.Strikethrough)
                                                                {
                                                                    Next = new FancyText("Yellow ", FancyColor.Yellow,
                                                                                         FancyColor.Strikethrough)
                                                                    {
                                                                        Next = new FancyText("White Strikethrough",
                                                                                             FancyColor.White, FancyColor.Strikethrough)
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            });
            GuiApp.Log(new FancyText("Black ", FancyColor.Black, FancyColor.Obfuscated)
            {
                Next = new FancyText("DarkBlue ", FancyColor.DarkBlue, FancyColor.Obfuscated)
                {
                    Next = new FancyText("DarkGreen ", FancyColor.DarkGreen, FancyColor.Obfuscated)
                    {
                        Next = new FancyText("DarkAqua ", FancyColor.DarkAqua, FancyColor.Obfuscated)
                        {
                            Next = new FancyText("DarkRed ", FancyColor.DarkRed, FancyColor.Obfuscated)
                            {
                                Next = new FancyText("DarkPurple ", FancyColor.DarkPurple, FancyColor.Obfuscated)
                                {
                                    Next = new FancyText("Gold ", FancyColor.Gold, FancyColor.Obfuscated)
                                    {
                                        Next = new FancyText("Gray ", FancyColor.Gray, FancyColor.Obfuscated)
                                        {
                                            Next = new FancyText("DarkGray ", FancyColor.DarkGray,
                                                                 FancyColor.Obfuscated)
                                            {
                                                Next = new FancyText("Blue ", FancyColor.Blue, FancyColor.Obfuscated)
                                                {
                                                    Next = new FancyText("Green ", FancyColor.Green,
                                                                         FancyColor.Obfuscated)
                                                    {
                                                        Next = new FancyText("Aqua ", FancyColor.Aqua,
                                                                             FancyColor.Obfuscated)
                                                        {
                                                            Next = new FancyText("Red ", FancyColor.Red,
                                                                                 FancyColor.Obfuscated)
                                                            {
                                                                Next = new FancyText("Purple ", FancyColor.Purple,
                                                                                     FancyColor.Obfuscated)
                                                                {
                                                                    Next = new FancyText("Yellow ", FancyColor.Yellow,
                                                                                         FancyColor.Obfuscated)
                                                                    {
                                                                        Next = new FancyText("White Obfuscated",
                                                                                             FancyColor.White, FancyColor.Obfuscated)
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            });
            GuiApp.Start(args);

            /*} catch (Exception e) {
             *  Console.WriteLine(e);
             *  throw;
             * }*/
        }
Ejemplo n.º 7
0
        private void DoKeyStuff(ConsoleKeyInfo key)
        {
            switch (key.Key)
            {
            case ConsoleKey.Tab:
                int rem;
                if (_hinting)
                {
                    _hintIndex++;
                    if (_hintIndex >= _hints.Count)
                    {
                        _hintIndex = 0;
                    }
                    rem = GetSkipAmount(-1, true);
                }
                else
                {
                    _hinting = true;
                    var hints = CommandManager.ParseTab(Globals.ConsoleSender,
                                                        _line.Substring(0, Math.Min(_line.Length, _cursor)));
                    _hints     = hints.Where(s => s.StartsWith(_currentArg)).ToList();
                    _hintIndex = 0;
                    rem        = _currentArg.Length;
                }

                if (_hints.Count == 0)
                {
                    return;
                }

                if (rem > 0)
                {
                    _line = _line.Remove(_cursor - rem, rem);
                }

                AddCursorPos(-rem);

                var hint = _hints[_hintIndex];
                _line = _line.Insert(_cursor, hint);
                AddCursorPos(hint.Length);

                SetCursorPos();
                return;

            case ConsoleKey.Enter:
                System.Console.Write("\n");
                _history.Insert(0, _line);
                GuiApp.LineRed(_line);
                Reset();
                break;

            case ConsoleKey.LeftArrow:
                AddCursorPos(key.Modifiers.HasFlag(ConsoleModifiers.Control) ? -GetSkipAmount(-1, true) : -1);
                break;

            case ConsoleKey.RightArrow:
                AddCursorPos(key.Modifiers.HasFlag(ConsoleModifiers.Control) ? GetSkipAmount(1, false) : 1);
                break;

            case ConsoleKey.UpArrow:
                History(1);
                break;

            case ConsoleKey.DownArrow:
                History(-1);
                break;

            case ConsoleKey.Backspace:
                if (key.Modifiers.HasFlag(ConsoleModifiers.Control))
                {
                    var amount = GetSkipAmount(-1, true);
                    if (amount > 0)
                    {
                        _line = _line.Remove(_cursor - amount, amount);
                    }
                    AddCursorPos(-amount);
                }
                else
                {
                    if (_cursor > 0)
                    {
                        _line = _line.Remove(_cursor - 1, 1);
                    }
                    AddCursorPos(-1);
                }

                break;

            case ConsoleKey.Delete:
                if (key.Modifiers.HasFlag(ConsoleModifiers.Control))
                {
                    var amount = GetSkipAmount(1, false);
                    if (amount > 0 && _cursor < _line.Length)
                    {
                        _line = _line.Remove(_cursor, amount);
                    }
                }
                else
                {
                    if (_cursor < _line.Length)
                    {
                        _line = _line.Remove(_cursor, 1);
                    }
                }

                break;

            default:
                HandleKey();
                break;
            }

            _hinting = false;
            SetCurrentArg();
            SetCursorPos();
        }
Ejemplo n.º 8
0
        private void DoKeyStuff()
        {
            switch (_key.Key)
            {
            case ConsoleKey.End:
                GuiApp.Log(new FancyText($"UwU{new Random().Next()}", FancyColor.Aqua));
                break;

            case ConsoleKey.Tab:
                int rem;
                if (_hinting)
                {
                    _hintIndex++;
                    if (_hintIndex >= _hints.Count)
                    {
                        _hintIndex = 0;
                    }
                    rem = GetSkipAmount(-1, true);
                }
                else
                {
                    _hinting = true;
                    var hints = GetTabbyThingy.GetHints(_line);
                    _hints     = hints.Where(s => s.StartsWith(_currentArg)).ToList();
                    _hintIndex = 0;
                    rem        = _currentArg.Length;
                }

                if (_hints.Count == 0)
                {
                    return;
                }

                if (rem > 0)
                {
                    _line = _line.Remove(_cursor - rem, rem);
                }

                AddCursorPos(-rem);

                var hint = _hints[_hintIndex];
                _line = _line.Insert(_cursor, hint);
                AddCursorPos(hint.Length);

                SetCursorPos();
                return;

            case ConsoleKey.Enter:
                Console.Write("\n");
                _history.Insert(0, _line);
                GuiApp.LineRed(_line);
                Reset();
                break;

            case ConsoleKey.LeftArrow:
                AddCursorPos(_key.Modifiers.HasFlag(ConsoleModifiers.Control) ? -GetSkipAmount(-1, true) : -1);
                break;

            case ConsoleKey.RightArrow:
                AddCursorPos(_key.Modifiers.HasFlag(ConsoleModifiers.Control) ? GetSkipAmount(1, false) : 1);
                break;

            case ConsoleKey.UpArrow:
                History(1);
                break;

            case ConsoleKey.DownArrow:
                History(-1);
                break;

            case ConsoleKey.Backspace:
                if (_key.Modifiers.HasFlag(ConsoleModifiers.Control))
                {
                    var amount = GetSkipAmount(-1, true);
                    if (amount > 0)
                    {
                        _line = _line.Remove(_cursor - amount, amount);
                    }
                    AddCursorPos(-amount);
                }
                else
                {
                    if (_cursor > 0)
                    {
                        _line = _line.Remove(_cursor - 1, 1);
                    }
                    AddCursorPos(-1);
                }

                break;

            case ConsoleKey.Delete:
                if (_key.Modifiers.HasFlag(ConsoleModifiers.Control))
                {
                    var amount = GetSkipAmount(1, false);
                    if (amount > 0 && _cursor < _line.Length)
                    {
                        _line = _line.Remove(_cursor, amount);
                    }
                }
                else
                {
                    if (_cursor < _line.Length)
                    {
                        _line = _line.Remove(_cursor, 1);
                    }
                }

                break;

            default:
                HandleKey();
                break;
            }

            _hinting = false;
            SetCurrentArg();
            SetCursorPos();
        }