Beispiel #1
0
        // Token: 0x06000009 RID: 9 RVA: 0x00002470 File Offset: 0x00000670
        private DxpSimpleClass.SERVERPARAM[] BrowseServer(string sNodeName, out int nServerCnt)
        {
            nServerCnt = 0;
            IOPCServerList iopcserverList = (IOPCServerList)DxpSimpleClass.CreateInstance(DxpSimpleClass.CLSID_SERVERLIST, sNodeName);

            DxpSimpleClass.SERVERPARAM[] result;
            try
            {
                Guid clsid_DA_ = DxpSimpleClass.CLSID_DA_30;
                DxpSimpleClass.SERVERPARAM[] serverParam = this.GetServerParam(iopcserverList, clsid_DA_, out nServerCnt);
                result = serverParam;
            }
            catch (Exception ex)
            {
#if DEBUG
                Debug.WriteLine(ex);
#endif
                result = null;
            }
            finally
            {
                Marshal.ReleaseComObject(iopcserverList);
                iopcserverList = null;
            }
            return(result);
        }
Beispiel #2
0
        // Token: 0x06000005 RID: 5 RVA: 0x000020D4 File Offset: 0x000002D4
        public bool Connect(string sNodeName, string sServerName)
        {
            if (this.m_OPCServer != null)
            {
                return(true);
            }
            IOPCServerList iopcserverList = (IOPCServerList)DxpSimpleClass.CreateInstance(DxpSimpleClass.CLSID_SERVERLIST, sNodeName);
            bool           result;

            try
            {
                Guid clsid;
                iopcserverList.CLSIDFromProgID(sServerName, out clsid);
                this.m_OPCServer = (IOPCServer)DxpSimpleClass.CreateInstance(clsid, sNodeName);
                if (this.m_OPCServer != null)
                {
                    ((IOPCCommon)this.m_OPCServer).SetClientName("TestClient");
                    this.m_bConnect = true;
                    result          = true;
                }
                else
                {
                    result = false;
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                Debug.WriteLine(ex);
#endif
                result = false;
            }
            finally
            {
                Marshal.ReleaseComObject(iopcserverList);
                iopcserverList = null;
            }
            return(result);
        }