/// <summary> /// First, we translate the input (which could be any supported language) to Pi. /// Then we convert that to Pi text and send to current server. /// </summary> private bool Execute(string input) { if (string.IsNullOrEmpty(input)) { // get refresh of remote data stack _peer.Remote?.Continue(" "); return(true); } try { if (PreProcess(input)) { return(true); } if (!_context.Translate(input, out var cont)) { return(Error(_context.Error)); } return(_peer.Execute(cont.ToText())); } catch (Exception e) { Error(e.Message); _peer.Execute($"Error: {e.Message} {e.InnerException?.Message}"); } return(false); }
private void ExecutePi() { var pi = piInput.Lines[piInput.GetLineFromCharIndex(piInput.SelectionStart)]; if (_local) { Perform(() => _context.ExecPi(pi)); } else { Perform(() => _peer.Execute(pi)); } }
private bool Execute(string input) { if (string.IsNullOrEmpty(input)) { return(true); } if (PreProcess(input)) { return(true); } try { input = input.Replace('\'', '`'); if (!_pyro.Translate(input, out var cont)) { return(Error(_pyro.Error)); } if (!_peer.Execute(cont.ToText())) { return(Error(_peer.Error)); } } catch (Exception e) { return(Error($"{e.Message}: {e.InnerException?.Message}")); } WriteStack(); return(true); }