public override void Use(Player p, string message) { if (message == "") { Help(p); return; } string[] args = message.Split(' '); Scripting engine = null; if (args.Length == 1) { engine = Scripting.CS; } else if (args[1] == "vb") { engine = Scripting.VB; } else { Help(p); return; } if (!File.Exists(Scripting.SourceDir + "Cmd" + args[0] + engine.Ext)) { Player.Message(p, "File &9Cmd" + args[0] + engine.Ext + " %Snot found."); return; } bool success = false; try { success = engine.Compile(args[0]); } catch (Exception e) { Server.ErrorLog(e); Player.Message(p, "An exception was thrown during compilation."); return; } if (success) { Player.Message(p, "Compiled successfully."); } else { Player.Message(p, "Compilation error. Please check " + Scripting.ErrorPath + " for more information."); } }
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!"); } } else 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!"); } } }