Esempio n. 1
0
        /// <summary>
        /// 获取指定管脚路径的外部管脚变量。
        /// </summary>
        public IConnector GetExternalConnector(string connPath)
        {
            if (string.IsNullOrEmpty(connPath))
            {
                return(null);
            }

            string cpuName   = ViConnType.RetrieveCpuName(connPath);
            string planName  = ViConnType.RetrievePlanName(connPath);
            string blockName = ViConnType.RetrieveBlockName(connPath);
            string connName  = ViConnType.RetrieveConnectorName(connPath);

            if (string.IsNullOrEmpty(cpuName) || string.IsNullOrEmpty(planName))
            {
                return(null);
            }
            if (!this.CPU.Key.Equals(cpuName, StringComparison.OrdinalIgnoreCase))
            {
                return(null);
            }
            ICfcEditorInfo editor = this.GetCfcEditor(planName, true) as ICfcEditorInfo;

            if (editor == null)
            {
                return(null);
            }

            return(editor.GetConnector(connPath));
        }
Esempio n. 2
0
        /// <summary>
        /// 注册 CFC 管脚。
        /// </summary>
        /// <param name="connector">注册目标</param>
        /// <param name="doConnect">注册前是否需要进行跨CFC连线?</param>
        public void RegisterConnector(IConnector connector, bool doConnect = true)
        {
            if (doConnect && this.RegisteredConnector != null)
            {
                if (this.RegisteredConnector.CanConnectToExtConnector(connector))
                {
                    this.ConnectToExtConn(connector);
                }
                else if (connector != null && !ViConnType.RetrievePlanName(connector.Path).Equals(ViConnType.RetrievePlanName(this.RegisteredConnector.Path), StringComparison.OrdinalIgnoreCase))
                {
                    string         file1  = ViConnType.RetrievePlanName(this.RegisteredConnector.Path);
                    ICfcEditorInfo editor = this.GetCfcEditor(file1, false) as ICfcEditorInfo;
                    editor.DisSelectConnector(this.RegisteredConnector);
                }
            }

            this.RegisteredConnector = connector;
        }