public EasyBlock Run(EasyAPI api, string type = "public") { var cmd = new EasyCommands(api); switch (type) { case "private": cmd.handle(this.GetCustomData()); break; default: cmd.handle(this.GetPublicText()); break; } return(this); }
/*** Constructor ***/ public EasyAPI(IMyGridTerminalSystem grid, IMyProgrammableBlock me, Action <string> echo, TimeSpan elapsedTime, string commandArgument = "EasyCommand") { this.clock = this.start = DateTime.Now.Ticks; this.delta = 0; this.GridTerminalSystem = EasyAPI.grid = grid; this.Echo = echo; this.ElapsedTime = elapsedTime; this.ArgumentActions = new Dictionary <string, List <Action> >(); this.CommandActions = new Dictionary <string, List <Action <int, string[]> > >(); this.Schedule = new List <EasyInterval>(); this.Intervals = new List <EasyInterval>(); this.commands = new EasyCommands(this); // Get the Programmable Block that is running this script (thanks to LordDevious and LukeStrike) this.Self = new EasyBlock(me); this.Reset(); }