public override void Execute(Engine engine) { ProcessStartInfo info = new ProcessStartInfo(engine.Expand(FileName)); //info.UseShellExecute = false; if (Arguments != null) info.Arguments = engine.Expand(Arguments); if (Directory != null) info.WorkingDirectory = engine.Expand(Directory); Process.Start(info); }
public MainWindow() { InitializeComponent(); engine = Engine.Load("config.xml"); session = new Session(engine); session.WidgetChanged += (sender, widget) => UpdateWidget(widget); session.CommandExecuted += (sender, lvl) => ClearInput(); session.ExceptionThrown += (sender, e) => DisplayException(e); session.ScopeChanged += (sender, cmd) => ClearInput(); noMatch.Content = "No completion"; }
public void ExecuteCommand(Engine eng, Level lvl) { // Execute or change scope if (!lvl.Command.Executable) { Scope = lvl.Command; } else if (lvl.Execute(this)) { // Only raise event and exit if command is actually executed CommandExecuted?.Invoke(this, lvl); // TODO: separate config & event if (eng.AutoExit) Application.Current.Shutdown(); } }
public static Engine Load(string file) { try { using (FileStream fs = File.OpenRead(file)) return (Engine)serializer.Deserialize(fs); } catch (FileNotFoundException) { Engine engine = new Engine(); engine.Save(file); return engine; } }
public override void Execute(Engine engine) { Application.Current.Shutdown(Code); }
public override void Execute(Engine engine) { engine.Variables[engine.Expand(Name)] = engine.Expand(Value); }
public abstract void Execute(Engine engine);
public Session(Engine eng) { Engine = eng; Scope = eng.Main; }