/// public override object Interop(string command, object args) { switch (command) { case "Stepper": return(new Action <string, Action <Exception> >(delegate(string path, Action <Exception> result) { var stepper = new Stepper(); stepper.AddFile(path); stepper.Go(result); })); } throw new ArgumentException("Expected 'Stepper'.", "args"); }
/// public override object Interop(string command, object args) { switch (command) { case "InvokeScriptArguments": return(new Func <string, object[], object[]>(delegate(string script, object[] arguments) { var r = A.InvokeCode(script, arguments); return r.Select(x => x?.BaseObject).ToArray(); })); case "Stepper": return(new Action <string, Action <Exception> >(delegate(string path, Action <Exception> result) { var stepper = new Stepper(); stepper.AddFile(path); stepper.Go(result); })); } throw new ArgumentException("Unknown command.", "command"); }
/// public override object Interop(string command, object args) { switch (command) { case "InvokeScriptArguments": return(new Func <string, object[], object[]>(delegate(string script, object[] arguments) { var res = A.InvokeCode(script, arguments); var ret = new object[res.Count]; for (int i = 0; i < ret.Length; ++i) { var x = res[i]; if (x != null) { if (x.BaseObject is PSCustomObject ps) { ret[i] = x; } else { ret[i] = x.BaseObject; } } } return ret; })); case "Runspace": return(A.Psf.Runspace); case "Stepper": return(new Action <string, Action <Exception> >(delegate(string path, Action <Exception> result) { var stepper = new Stepper(); stepper.AddFile(path); stepper.Go(result); })); } throw new ArgumentException("Unknown command.", "command"); }