Пример #1
0
        public override void Use(Player p, string message)
        {
            if (message == "" || message.IndexOf(' ') != -1)
            {
                Help(p); return;
            }
            bool success = false;

            try
            {
                success = Scripting.Compile(message);
            }
            catch (Exception e)
            {
                Server.ErrorLog(e);
                Player.SendMessage(p, "An exception was thrown during compilation.");
                return;
            }
            if (success)
            {
                Player.SendMessage(p, "Compiled successfully.");
            }
            else
            {
                Player.SendMessage(p, "Compilation error.  Please check compile.log for more information.");
            }
        }
Пример #2
0
        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                Help(p); return;
            }
            bool success = false;

            string[] param = message.Split(' ');
            string   name  = param[0];

            if (param.Length == 1)
            {
                if (File.Exists("extra/commands/source/Cmd" + message + ".cs"))
                {
                    try
                    {
                        success = Scripting.Compile(message);
                    }
                    catch (Exception e)
                    {
                        Server.ErrorLog(e);
                        Player.SendMessage(p, "An exception was thrown during compilation.");
                        return;
                    }
                    if (success)
                    {
                        Player.SendMessage(p, "Compiled successfully.");
                    }
                    else
                    {
                        Player.SendMessage(p, "Compilation error.  Please check compile.log for more information.");
                    }
                    return;
                }
                else
                {
                    Player.SendMessage(p, "file &9Cmd" + message + ".cs " + Server.DefaultColor + "not found!");
                }
            }
            if (param[1] == "vb")
            {
                message = message.Remove(message.Length - 3, 3);
                if (File.Exists("extra/commands/source/Cmd" + message + ".vb"))
                {
                    try
                    {
                        success = ScriptingVB.Compile(name);
                    }
                    catch (Exception e)
                    {
                        Server.ErrorLog(e);
                        Player.SendMessage(p, "An exception was thrown during compilation.");
                        return;
                    }
                    if (success)
                    {
                        Player.SendMessage(p, "Compiled successfully.");
                    }
                    else
                    {
                        Player.SendMessage(p, "Compilation error.  Please check compile.log for more information.");
                    }
                    return;
                }
                else
                {
                    Player.SendMessage(p, "file &9Cmd" + message + ".vb " + Server.DefaultColor + "not found!");
                }
            }
        }