public void LoadExternalAppsFromXML() { #if !PORTABLE var oldPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), GeneralAppInfo.ProductName, SettingsFileInfo.ExtAppsFilesName); #endif var newPath = Path.Combine(SettingsFileInfo.SettingsPath, SettingsFileInfo.ExtAppsFilesName); var xDom = new XmlDocument(); if (File.Exists(newPath)) { Logger.Instance.Info($"Loading External Apps from: {newPath}"); xDom.Load(newPath); } #if !PORTABLE else if (File.Exists(oldPath)) { Logger.Instance.Info($"Loading External Apps from: {oldPath}"); xDom.Load(oldPath); } #endif else { Logger.Instance.Warn("Loading External Apps failed: Could not FIND file!"); return; } if (xDom.DocumentElement == null) { Logger.Instance.Warn("Loading External Apps failed: Could not LOAD file!"); return; } foreach (XmlElement xEl in xDom.DocumentElement.ChildNodes) { var extA = new ExternalTool { DisplayName = xEl.Attributes["DisplayName"].Value, FileName = xEl.Attributes["FileName"].Value, Arguments = xEl.Attributes["Arguments"].Value }; if (xEl.HasAttribute("WaitForExit")) { extA.WaitForExit = bool.Parse(xEl.Attributes["WaitForExit"].Value); } if (xEl.HasAttribute("TryToIntegrate")) { extA.TryIntegrate = bool.Parse(xEl.Attributes["TryToIntegrate"].Value); } Logger.Instance.Info($"Adding External App: {extA.DisplayName} {extA.FileName} {extA.Arguments}"); Runtime.ExternalTools.Add(extA); } _MainForm.SwitchToolBarText(Convert.ToBoolean(mRemoteNG.Settings.Default.ExtAppsTBShowText)); frmMain.Default.AddExternalToolsToToolBar(); }
public override bool Initialize() { if (InterfaceControl.Info != null) { _externalTool = Runtime.GetExtAppByName(Convert.ToString(InterfaceControl.Info.ExtApp)); _externalTool.ConnectionInfo = InterfaceControl.Info; } return base.Initialize(); }
private void StartExternalApp(ExternalTool externalTool) { try { if (SelectedNode.GetTreeNodeType() == TreeNodeType.Connection | SelectedNode.GetTreeNodeType() == TreeNodeType.PuttySession) externalTool.Start(SelectedNode); } catch (Exception ex) { Runtime.MessageCollector.AddExceptionStackTrace("cMenTreeToolsExternalAppsEntry_Click failed (UI.Window.ConnectionTreeWindow)", ex); } }
private void StartExternalApp(ExternalTool externalTool) { try { var interfaceControl = TabController.SelectedTab?.Tag as InterfaceControl; externalTool.Start(interfaceControl?.Info); } catch (Exception ex) { Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "cmenTabExternalAppsEntry_Click failed (UI.Window.ConnectionWindow)" + Environment.NewLine + ex.Message, true); } }