Ejemplo n.º 1
0
        /// <summary>
        /// Decode command module If known
        /// </summary>
        public static void Decode(string line)
        {
            try
            {
                if (line == null)
                {
                    return;
                }
                if (line.Length < 1)
                {
                    return;
                }

                string[] command;
                string   cmd;

                if (line.IndexOf(" ") > 0)
                {
                    command = line.Split(new char[] { ' ' });
                    cmd     = command[0].ToLower();
                }
                else
                {
                    command = new string[0];
                    cmd     = line.ToLower();
                }

                if (commandList[cmd] != null)
                {
                    BaseCommand bc = (BaseCommand)commandList[cmd];

                    if (bc.ExecInMain)
                    {
                        _job = new Work(command, bc);
                        while (_job != null)
                        {
                            Thread.Sleep(sleep);
                        }
                    }
                    else
                    {
                        bc.Execute(command);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Console[Self].Exception>");
                Console.WriteLine("{0}", e);
            }
        }
Ejemplo n.º 2
0
 public override void OnTick()
 {
     if (World.Loading)
     {
         return;
     }
     if (_job == null)
     {
         return;
     }
     try
     {
         _job.Cmd.Execute(_job.Param);
     }
     catch (Exception e)
     {
         Console.WriteLine("Console[Main].Exception>");
         Console.WriteLine("{0}", e);
     }
     _job = null;
 }