/// <summary>
 /// The DomainConnector and the OpenEngSBCore origin from different DLLs but they both contain the type XLinkConnector.
 /// This method converts between themm.
 /// </summary>
 private OpenEngSBCore.XLinkConnector[] convertBetweenDLLTypes(OOSourceCodeDomain.XLinkConnector[] newArryOfInstalledTools)
 {
     OpenEngSBCore.XLinkConnector[] convertedArray = new OpenEngSBCore.XLinkConnector[newArryOfInstalledTools.Length];
     for (int i = 0; i < newArryOfInstalledTools.Length; i++)
     {
         convertedArray[i] = newArryOfInstalledTools[i].ConvertOSBType <OpenEngSBCore.XLinkConnector>();
     }
     return(convertedArray);
 }
 /// <summary>
 /// Returns the XLinkConnectorView entry to the given XLinkConnector and viewId or null
 /// </summary>
 private OpenEngSBCore.XLinkConnectorView findViewToCurrentlyInstalledTool(OpenEngSBCore.XLinkConnector otherLocalTool, string viewId)
 {
     OpenEngSBCore.XLinkConnectorView otherLocalView = null;
     for (int i = 0; i < otherLocalTool.availableViews.Length; i++)
     {
         if (otherLocalTool.availableViews[i].viewId.Equals(viewId))
         {
             otherLocalView = otherLocalTool.availableViews[i];
             break;
         }
     }
     return(otherLocalView);
 }
        /// <summary>
        /// Triggers the local switching functionality for the given program, using the given viewId ontop of the defined file.
        /// </summary>
        public void triggerLocalSwitch(String programname, String viewId, String filename)
        {
            OpenEngSBCore.XLinkConnector otherLocalTool = findCurrentlyInstalledToolToName(programname);
            if (otherLocalTool == null)
            {
                outputLine("Supplied programname '" + programname + "' unknown.");
                return;
            }
            OpenEngSBCore.XLinkConnectorView otherLocalView = findViewToCurrentlyInstalledTool(otherLocalTool, viewId);

            if (otherLocalView == null)
            {
                outputLine("Supplied viewId '" + viewId + "' unknown to program '" + programname + "'.");
                return;
            }

            WorkingDirectoryFile searchedFile = Program.directoryBrowser.searchForFile(filename);

            if (searchedFile == null)
            {
                outputLine("Specified file was not found.");
                return;
            }
            else
            {
                String xlink = createXLink(searchedFile);
                // TODO remove Hack (hardcoded ConnectorIdKeyname) after correct implementation at OpenEngSB
                xlink += "&" + "connectorId=" + otherLocalTool.id + "&" + blueprint.keyNames.viewIdKeyName + "=" + HttpUtility.UrlEncode(viewId);
                WebRequest      webRequest = WebRequest.Create(xlink);
                HttpWebResponse response   = (HttpWebResponse)webRequest.GetResponse();
                if (response.StatusCode == HttpStatusCode.OK)
                {
                    outputLine("Local switch was triggered.");
                }
                else
                {
                    outputLine("Local switch was not successfull triggered, returned status code was " + (int)response.StatusCode);
                }
            }
        }
 /// <summary>
 /// The DomainConnector and the OpenEngSBCore origin from different DLLs but they both contain the type XLinkConnector.
 /// This method converts between themm.
 /// </summary>
 private OpenEngSBCore.XLinkConnector[] convertBetweenDLLTypes(OOSourceCodeDomain.XLinkConnector[] newArryOfInstalledTools)
 {
     OpenEngSBCore.XLinkConnector[] convertedArray = new OpenEngSBCore.XLinkConnector[newArryOfInstalledTools.Length];
     for (int i = 0; i < newArryOfInstalledTools.Length; i++)
     {
         convertedArray[i] = newArryOfInstalledTools[i].ConvertOSBType<OpenEngSBCore.XLinkConnector>();
     }
     return convertedArray;
 }