public kOSException(String message, ExecutionContext context) : this(message) { this.LineNumber = context.Line; this.Context = context; this.Program = context.FindClosestParentOfType<ContextRunProgram>(); }
public ImmediateMode(ExecutionContext parent) : base(parent) { StdOut("kOS Operating System"); StdOut("KerboScript v" + Core.VersionInfo.ToString()); StdOut(""); bool autoexecExists = false; if (SelectedVolume.GetByName("autoexec") != null) { autoexecExists = true; } else { Volume ArchiveVolume = GetVolume("Archive"); if (ArchiveVolume.GetByName("autoexec") != null) { Add("copy autoexec from archive."); autoexecExists = true; } } if (autoexecExists) { StdOut("Executing autoexec..."); Add("run autoexec."); } else { StdOut("Autoexec was not found."); } StdOut("Proceed."); }
public Atmosphere(CelestialBody body, ExecutionContext context) { BodyRef = body; AddSuffix("HEIGHT", null, ()=>{ return BodyRef.atmosphereDepth; }); AddSuffix("OXYGEN", null, () => { return BodyRef.atmosphere && BodyRef.atmosphereContainsOxygen; }); AddSuffix("SEALEVELPRESSURE", null, () => { return BodyRef.atmospherePressureSeaLevel; }); }
public ImmediateMode(ExecutionContext parent) : base(parent) { StdOut("kOS Operating System Build " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Revision); StdOut("KerboScript v0.8"); StdOut(""); StdOut("Proceed."); }
public ImmediateMode(ExecutionContext parent) : base(parent) { StdOut("kOS Operating System"); StdOut("KerboScript v" + Core.VersionInfo.ToString()); StdOut(""); StdOut("Proceed."); }
public InterpreterBootup(ExecutionContext parent) : base(parent) { //ShowAnimationFrame(0); PrintAt("BOOTING UP...", 22, 20); State = ExecutionState.WAIT; }
public Expression(String text, ExecutionContext context) { this.executionContext = context; text = text.Trim(); Text = text; UnwrapFullBrackets(ref text); Process(text); }
public InterpreterEdit(String fileName, ExecutionContext parent) : base(parent) { File = SelectedVolume.GetByName(fileName); if (File == null) { File = new File(fileName); File.Add(""); } CursorX = 0; CursorY = 2; }
public static Command Get(String input, ExecutionContext context, int line) { try { Command retCommand = Get(input, context); retCommand.Line = line; return retCommand; } catch (kOSException e) { e.LineNumber = line; throw e; } }
public Expression(String text, ExecutionContext context) { this.executionContext = context; text = text.Trim(); Text = text; if (!Utils.DelimterMatch (text)) { throw new kOSException ("Error: mismatching delimiter."); } UnwrapFullBrackets(ref text); Process(text); }
public Expression(String text, ExecutionContext context) { this.executionContext = context; text = text.Trim(); Text = text; if (!CheckForBrackets(text)) { throw new kOSException("Bracket matching error."); } UnwrapFullBrackets(ref text); Process(text); }
public static Command Get(String input, ExecutionContext context) { input = input.Trim();//.Replace("\n", " "); foreach (var kvp in CommandRegistry.Bindings) { Match match = Regex.Match(input, kvp.Key, RegexOptions.IgnoreCase); if (match.Success) { var command = (Command)Activator.CreateInstance(kvp.Value, match, context); return command; } } throw new kOSException("Syntax Error.", context); }
public ImmediateMode(ExecutionContext parent) : base(parent) { //StdOut("kOS Operating System"); //StdOut("KerboScript v" + Core.VersionInfo.ToString()); for (var y = 13; y < 16; y++) { string output = ""; for (var x = 11; x < 16; x++) { output += ((char)((y*16) + x)).ToString(); } if (y == 15) output += " v" + Core.VersionInfo.ToString(); StdOut(output); } StdOut(""); StdOut(""); StdOut("Proceed."); }
public Body(CelestialBody target, ExecutionContext context) { this.Context = context; this.BodyRef = target; AddSuffix("NAME", null, () => { return BodyRef.name; }); AddSuffix("DESCRIPTION", null, () => { return BodyRef.bodyDescription; }); AddSuffix("MASS", null, () => { return BodyRef.Mass; }); AddSuffix("POSITION", null, () => { return new Vector(BodyRef.position); }); AddSuffix("ALTITUDE", null, () => { return BodyRef.orbit.altitude; }); AddSuffix("APOAPSIS", null, () => { return BodyRef.orbit.ApA; }); AddSuffix("PERIAPSIS", null, () => { return BodyRef.orbit.PeA; }); AddSuffix("VELOCITY", null, () => { return new Vector(BodyRef.orbit.GetVel()); }); AddSuffix("DISTANCE", null, () => { return (float)GetDistance(); }); AddSuffix("BODY", null, () => { return new Body(BodyRef.orbit.referenceBody, Context); }); AddSuffix("MU", null, () => { return BodyRef.gravParameter; }); AddSuffix("ROTATIONPERIOD", null, () => { return BodyRef.rotationPeriod; }); AddSuffix("RADIUS", null, () => { return BodyRef.Radius; }); AddSuffix("GRAVITY", null, () => { return BodyRef.gravParameter; }); AddSuffix("OCEANIC", null, () => { return BodyRef.ocean; }); AddSuffix("ATMOSPHERE", null, () => { return new Atmosphere(BodyRef, Context); }); AddSuffix("ATM", null, () => { return new Atmosphere(BodyRef, Context); }); }
public CommandSetOff(Match regexMatch, ExecutionContext context) : base(regexMatch, context) { }
public Command(String input, ExecutionContext context) : base(context) { this.Input = input; }
public virtual void Push(ExecutionContext newChild) { ChildContext = newChild; }
public CommandBreak(Match regexMatch, ExecutionContext context) : base(regexMatch, context) { }
public CommandBlock(String directInput, ExecutionContext context) : base(Regex.Match(directInput, "^([\\S\\s]*)$"), context) { }
public CommandToggle(Match regexMatch, ExecutionContext context) : base(regexMatch, context) { }
public CommandVesselListings(Match regexMatch, ExecutionContext context) : base(regexMatch, context) { }
public CommandShutdown(Match regexMatch, ExecutionContext context) : base(regexMatch, context) { }
public CommandReboot(Match regexMatch, ExecutionContext context) : base(regexMatch, context) { }
public VesselTarget(Vessel target, ExecutionContext context) { this.context = context; this.target = target; }
public ExecutionContext(ExecutionContext parent) { this.ParentContext = parent; }
public CommandVesselStage(Match regexMatch, ExecutionContext context) : base(regexMatch, context) { }
public CommandClearScreen(Match regexMatch, ExecutionContext context) : base(regexMatch, context) { }
public BodyTarget(CelestialBody target, ExecutionContext context) { this.context = context; Target = target; }
public static String Evaluate(String text, ExecutionContext context) { Expression e = new Expression(text, context); return e.GetValue().ToString(); }
public CommandOnEvent(Match regexMatch, ExecutionContext context) : base(regexMatch, context) { }
public virtual void Update(float time) { // Process Command locks foreach (Command command in new List<Command>(CommandLocks)) { command.Update(time); } if (ChildContext != null) { if (ChildContext.State == ExecutionState.DONE) { ChildContext = null; } else { ChildContext.Update(time); } } }
public CommandUntilLoop(Match regexMatch, ExecutionContext context) : base(regexMatch, context) { }
public CommandDeclareVar(Match regexMatch, ExecutionContext context) : base(regexMatch, context) { }
public CommandPrintAt(Match regexMatch, ExecutionContext context) : base(regexMatch, context) { }
public Body(String name, ExecutionContext context) : this(VesselUtils.GetBodyByName(name), context) { }
public Command(Match regexMatch, ExecutionContext context) : base(context) { this.RegexMatch = regexMatch; }
public Command(Match regexMatch, ExecutionContext context) : base(context) { Input = regexMatch.ToString(); this.RegexMatch = regexMatch; }
public CommandSetTerminator(Match regexMatch, ExecutionContext context) : base(regexMatch, context) { }
public CommandDelete(Match regexMatch, ExecutionContext context) : base(regexMatch, context) { }
public kOSException(String message, ExecutionContext context) : this (message) { this.LineNumber = context.Line; this.Context = context; this.Program = context.FindClosestParentOfType<ContextRunProgram>(); }