public void Main(string argument) { List <IMyTextPanel> TTYs = new List <IMyTextPanel>(); GridTerminalSystem.GetBlocksOfType <IMyTextPanel>(TTYs, (IMyTextPanel x) => x.CustomName.Contains("TTY") && x.CubeGrid.Equals(Me.CubeGrid)); BaconShell.Environment env = new BaconShell.Environment(this, GridTerminalSystem, new BaconDebug("debug", GridTerminalSystem, this, 99)); BaconShell bs = new BaconShell(env); for (int i_TTY = 0; i_TTY < TTYs.Count; i_TTY++) { IMyTextPanel TTY = TTYs[i_TTY]; string stdin = TTY.GetPrivateText(); if (!stdin.Equals("")) { StringBuilder stdout = new StringBuilder(); string[] command = stdin.Split(new Char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < command.Length; i++) { BaconArgs Args = BaconArgs.parse(command[i]); stdout.Append(bs.runCommand(Args, env).ToString()); } TTY.WritePrivateText(""); TTY.WritePublicText(stdout.ToString()); } } }
private void CheckCommandsChanged() { string currentText = m_private ? #pragma warning disable CS0618 TextPanel.GetPrivateText() : #pragma warning restore CS0618 TextPanel.GetPublicText(); if (currentText == m_panelText) { return; } m_panelText = currentText; GetAutopilotActions(); }
public string GetPrivateText() { string ret = ""; IMyTextPanel textPanel = Block as IMyTextPanel; if (textPanel != null) { ret = textPanel.GetPrivateText(); } return(ret); }
private void updatePresets() { timPresets.Clear(); timPresets.Add("Clear", ""); Echo(".. Parsing presets"); var rows = s.GetPrivateText().Split('\n'); if (rows.Length > 0) { for (int i = 0; i < rows.Length; i++) { string[] values = rows[i].Split('|'); if (values.Length > 1) { timPresets.Add(values[0], values[1]); } } } }
private void run(string args) { DasMenuArgs MenuArgs = new DasMenuArgs(args, ARGS_SPLIT); DasMenuTextPanelRepository TextPanelRepository = new DasMenuTextPanelRepository(GridTerminalSystem); DasMenuFactory MenuFactory = new DasMenuFactory(GridTerminalSystem); IMyTextPanel TextPanel = TextPanelRepository.findLcd(MenuArgs.getLcdPattern()); if (TextPanel != null) { string SelectedItemUid = TextPanelRepository.readStateFromTextPanel(TextPanel); DasMenuConfig MenuConfig = new DasMenuConfig(TextPanel.GetPrivateText()); DasMenuItem RootItem = MenuFactory.createFromConfig(MenuConfig); DasMenuView View = new DasMenuView(); DasMenuItem CurrentItem = getCurrentItem(MenuArgs, RootItem, SelectedItemUid); string content = View.getContent(RootItem, MenuConfig, CurrentItem); TextPanel.WritePublicText(content); Echo(content); TextPanelRepository.saveStateToTextPanel(TextPanel, CurrentItem.getUid()); } }
public void UpdatePrivate(bool show = false) { if (FontSize != _panel.GetValueFloat("FontSize")) { _panel.SetValueFloat("FontSize", FontSize); } // no need to update if the text has not changed. if (_panel.GetPrivateText() != _privateString.ToString()) { _panel.WritePrivateText(_privateString.ToString()); if (show) { if (ForceRedraw) { _panel.ShowTextureOnScreen(); } _panel.ShowPrivateTextOnScreen(); } } }
private List <BfGps> getGpsWaypoints(IMyTextPanel TextPanel) { Dictionary <string, BfGps> Waypoints = new Dictionary <string, BfGps>(); List <IMyTextPanel> Panels = getPipeFromTextPanel(TextPanel); Panels.Add(TextPanel); for (int i = 0; i < Panels.Count; i++) { IMyTextPanel TempPanel = Panels[i]; Waypoints = addWaypointsToDict(TempPanel.CustomName, Waypoints); Waypoints = addWaypointsToDict(TempPanel.GetPublicText(), Waypoints); Waypoints = addWaypointsToDict(TempPanel.GetPrivateTitle(), Waypoints); Waypoints = addWaypointsToDict(TempPanel.GetPrivateText(), Waypoints); } List <BfGps> GpsPoints = new List <BfGps>(); foreach (KeyValuePair <string, BfGps> item in Waypoints) { GpsPoints.Add(item.Value); } return(GpsPoints); }
public string getConfig() { return(TextPanel.GetPrivateText()); }