Example #1
0
        public static void Main(string[] Args)
        {
            DeleteMenu(GetSystemMenu(GetConsoleWindow(), false), SC_CLOSE, MF_BYCOMMAND);

            XmlConfigurator.Configure();

            Console.ForegroundColor = ConsoleColor.White;
            Console.CursorVisible   = false;
            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.UnhandledException += MyHandler;

            StartEverything();

            while (CloudServer.IsLive)
            {
                Console.CursorVisible = true;
                if (ExceptionLogger.DisabledState)
                {
                    Console.Write("cloud> ");
                }

                ConsoleCommandHandler.InvokeCommand(Console.ReadLine());
                continue;
            }
        }
        public static void Main(string[] Args)
        {
            DeleteMenu(GetSystemMenu(GetConsoleWindow(), false), SC_CLOSE, MF_BYCOMMAND);

            XmlConfigurator.Configure();

            Console.ForegroundColor = ConsoleColor.White;
            Console.CursorVisible   = false;
            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.UnhandledException += MyHandler;

            QuasarEnvironment.Initialize();

            while (true)
            {
                Console.CursorVisible = true;
                if (Logging.DisabledState)
                {
                    Console.Write("Emulator »");
                }

                ConsoleCommandHandler.InvokeCommand(Console.ReadLine());
                continue;
            }
        }
        public ConsoleType(Type realType, string consoleName, SerialzeHandler serializer, ConsoleCommandHandler deserializer)
        {
            RealType = realType;
            ConsoleName = consoleName;

            _serializer = serializer;
            _deserializer = deserializer;
        }
Example #4
0
        public static void Main(string[] args)
        {
            StartEverything();

            while (Yupi.IsLive)
            {
                Console.CursorVisible = true;
                ConsoleCommandHandler.InvokeCommand(Console.ReadLine());
            }
        }
        public void AddCommand(string id, ConsoleCommandHandler handler)
        {
            ConsoleCommand newCommand = new ConsoleCommand(id, handler);
            //newCommand.SetFlag( (int)flags );

            if (_commandTable[""].ContainsKey(id))
                _commandTable[""][id] = newCommand;
            else
                _commandTable[""].Add(id, newCommand);
        }
Example #6
0
 public ConsoleCommand(string name, ConsoleCommandHandler cch, string help, Action setup = null)
 {
     _name     = name.ToLower();
     _handler  = cch;
     _helpText = help;
     if (setup != null)
     {
         setup();
     }
 }
Example #7
0
        private ConsoleCommand CreateConsoleCommand(ConsoleAttribute attribute, ConsoleCommandHandler handler)
        {
            ConsoleCommand scommand = new ConsoleCommand();

            if (attribute != null)
            {
                scommand.description = attribute.Description;
                scommand.syntax      = attribute.Syntax;
                scommand.mingmlevel  = attribute.GmLevel;
                scommand.handler     = handler;
            }

            return(scommand);
        }
Example #8
0
        private bool startServer()
        {
            commandHandler = new ConsoleCommandHandler(this);
            var threadcommandreader = new ThreadCommandReader(this);

            threadcommandreader.setDaemon(true);
            threadcommandreader.start();
            ConsoleLogManager.init();
            logger.info("Starting Crafty version " + Crafty.VERSION + "(based on minecraft server version Beta 1.3)");

            logger.info("Loading properties");
            propertyManagerObj = new PropertyManager(new File("server.properties"));
            string s = propertyManagerObj.getStringProperty("server-ip", "");

            onlineMode        = propertyManagerObj.getBooleanProperty("online-mode", true);
            spawnPeacefulMobs = propertyManagerObj.getBooleanProperty("spawn-animals", true);
            pvpOn             = propertyManagerObj.getBooleanProperty("pvp", true);
            InetAddress inetaddress = null;

            if (s.Length > 0)
            {
                inetaddress = InetAddress.getByName(s);
            }
            int i = propertyManagerObj.getIntProperty("server-port", 25565);

            logger.info(
                (new StringBuilder()).append("Starting Minecraft server on ").append(s.Length != 0 ? s : "*").append(":")
                .append(i).toString());
            networkServer = new NetworkListenThread(this, inetaddress, i);
            if (!onlineMode)
            {
                logger.warning("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
                logger.warning("The server will make no attempt to authenticate usernames. Beware.");
                logger.warning(
                    "While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
                logger.warning("To change this, set \"online-mode\" to \"true\" in the server.settings file.");
            }
            configManager = new ServerConfigurationManager(this);
            entityTracker = new EntityTracker(this);
            long   l  = java.lang.System.nanoTime();
            string s1 = propertyManagerObj.getStringProperty("level-name", "world");

            logger.info((new StringBuilder()).append("Preparing level \"").append(s1).append("\"").toString());
            initWorld(new SaveConverterMcRegion(new File(".")), s1);
            logger.info(
                (new StringBuilder()).append("Done (").append(java.lang.System.nanoTime() - l).append(
                    "ns)! For help, type \"help\" or \"?\"").toString());
            return(true);
        }
Example #9
0
        public void Register(string command, ConsoleCommandHandler handler)
        {
            ConsoleCommand scommand;

            ConsoleAttribute[] attribute = handler.Method.GetCustomAttributes(typeof(ConsoleAttribute), true) as ConsoleAttribute[];
            if (attribute != null && attribute.Length > 0)
            {
                scommand = CreateConsoleCommand(attribute[0], handler);
                callback.Add(command.ToUpperInvariant(), scommand);
            }
            else
            {
                throw new SystemException("Cannot register command: no information found");
            }
        }
Example #10
0
        static void Main(string[] args)
        {
            try
            {
                ProjectHub ProjectHub = new ProjectHub();
                ProjectHub.Initialize();
            }
            catch (Exception Error)
            {
                Logging.Write("Error check logs!", ConsoleColor.DarkRed);
                Logging.LogError(Error.ToString());
            }

            while (true)
            {
                Logging.Write("");
                ConsoleCommandHandler.InvokeCommand(Console.ReadLine());
            }
        }
Example #11
0
        static void Main(string[] args)
        {
            System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
            XmlDocument log4netConfig = new XmlDocument();

            log4netConfig.Load(File.OpenRead("log4net.config"));
            log4net.Config.XmlConfigurator.Configure(log4netConfig["log4net"]);

            GameEnvironment.Initialise();
            while (IsRunning)
            {
                #region Console Commands
                if (Console.ReadKey(true).Key == ConsoleKey.Enter)
                {
                    Console.Write("TTT > ");
                    ConsoleCommandHandler.Invoke(Console.ReadLine());
                }
                #endregion
            }
        }
Example #12
0
 protected void RegisterExternal(string path)
 {
     try
     {
         ConsoleCommandHandler handler = CoreService.Find <ConsoleCommandHandler>(path);
         if (handler != null)
         {
             Register(handler);
         }
         else
         {
             HostContext.AddUnhandeldException(new SystemException(string.Format("Cannot find console command: {0}", path)));
         }
     }
     catch (Exception e)
     {
         //do nothing here
         HostContext.AddUnhandeldException(e);
     }
 }
Example #13
0
 public void Register(ConsoleCommandHandler handler)
 {
     reader.Register(handler);
 }
Example #14
0
 public void Register(string command, ConsoleCommandHandler handler)
 {
     reader.Register(command, handler);
 }
Example #15
0
 public ConsoleCommand(string command, ConsoleCommandHandler handler, string help)
 {
     Command = command;
     Handler = handler;
     Help    = help;
 }
Example #16
0
        /// <summary>
        /// Registers the specified command.
        /// </summary>
        /// <param name="command">The command to register.</param>
        /// <param name="argumentLength">Amount of arguments to provide.</param>
        /// <param name="handler">The handler to execute the command.</param>
        /// <returns>True if command was registered; otherwise false.</returns>
        public bool Register(string command, byte argumentLength, ConsoleCommandHandler handler)
        {
            if (this.dictionary.ContainsKey(command) == false)
            {
                this.dictionary.Add(command, new Command(command, argumentLength, handler));
                return true;
            }

            return false;
        }
Example #17
0
 public void RegisterCommand(string command, ConsoleCommandHandler handler, string help)
 {
     commands.Add(command, new ConsoleCommand(command, handler, help));
 }
 internal ConsoleCommand(string id, ConsoleCommandHandler command)
     : base(id)
 {
     _command = command;
 }
Example #19
0
 void NewCommand(string n, ConsoleCommandHandler cch, string help, Action setup = null)
 {
     RegisterCommand(new ConsoleCommand(n, cch, help, setup));
 }
Example #20
0
 public void setHandler(string command, ConsoleCommandHandler handler, string usage = "")
 {
     m_handlers[command] = Tuple.Create(handler, usage);
 }
 public void Register(ConsoleCommandHandler handler)
 {
     reader.Register(handler);
 }
Example #22
0
 /// <summary>
 /// Binds a ConsoleCommandHandler to the specified command
 /// </summary>
 /// <param name="command">The command to which the command handler will be bound</param>
 /// <param name="handler">The command handler to bind to the specified command</param>
 /// <param name="argumentSeparators">The characters with which the command argument string will
 /// be split into separate arguments</param>
 public void BindCommandHandler(string command, ConsoleCommandHandler handler, params char[] argumentSeparators)
 {
     mCommandHandlers[command] = new ConsoleCommandHandlerInfo(handler, argumentSeparators);
 }
Example #23
0
 public ConsoleCommandHandlerInfo(ConsoleCommandHandler handler, char[] separators)
 {
     Handler = handler;
     ArgumentSeparators = separators;
 }
Example #24
0
 /// <summary>
 /// Registers the specified argumentless command.
 /// </summary>
 /// <param name="command">The command to register.</param>
 /// <param name="handler">The handler to execute the command.</param>
 /// <returns>True if command was registered; otherwise false.</returns>
 public bool Register(string command, ConsoleCommandHandler handler)
 {
     return this.Register(command, 0, handler);
 }
 public void Register(string command, ConsoleCommandHandler handler)
 {
     reader.Register(command, handler);
 }
Example #26
0
 /// <summary>
 /// Binds a ConsoleCommandHandler to the specified command
 /// </summary>
 /// <param name="command">The command to which the command handler will be bound</param>
 /// <param name="handler">The command handler to bind to the specified command</param>
 /// <param name="argumentSeparators">The characters with which the command argument string will
 /// be split into separate arguments</param>
 public void BindCommandHandler(string command, ConsoleCommandHandler handler, params char[] argumentSeparators)
 {
     mCommandHandlers[command] = new ConsoleCommandHandlerInfo(handler, argumentSeparators);
 }
Example #27
0
 public ConsoleCommandHandlerInfo(ConsoleCommandHandler handler, char[] separators)
 {
     Handler            = handler;
     ArgumentSeparators = separators;
 }
Example #28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Command"/> class.
 /// </summary>
 /// <param name="name">The name of the command.</param>
 /// <param name="argumentLength">Amount of arguments.</param>
 /// <param name="handler">The handler to execute the command.</param>
 public Command(string name, byte argumentLength, ConsoleCommandHandler handler)
 {
     this.Name = name;
     this.ArgumentLength = argumentLength;
     this.Handler = handler;
 }