// 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); }
// Token: 0x0600000B RID: 11 RVA: 0x000025B0 File Offset: 0x000007B0 private static object CreateInstance(Guid clsid, string hostName) { DxpSimpleClass.COSERVERINFO coserverinfo = default(DxpSimpleClass.COSERVERINFO); DxpSimpleClass.MULTI_QI[] array = new DxpSimpleClass.MULTI_QI[1]; GCHandle gchandle = GCHandle.Alloc(DxpSimpleClass.IID_IUnknown, GCHandleType.Pinned); array[0].iid = gchandle.AddrOfPinnedObject(); array[0].pItf = null; array[0].hr = 0u; try { uint clsctx_ALL = DxpSimpleClass.CLSCTX_ALL; coserverinfo.pwszName = hostName; DxpSimpleClass.CoCreateInstanceEx(ref clsid, null, clsctx_ALL, ref coserverinfo, 1u, array); } catch (Exception ex) { #if DEBUG Debug.WriteLine(ex); #endif return(null); } gchandle.Free(); return(array[0].pItf); }
// Token: 0x06000006 RID: 6 RVA: 0x00002170 File Offset: 0x00000370 public bool Read(string[] sItemIDArray, out object[] oValueArray, out short[] wQualityArray, out OpcRcw.Da.FILETIME[] fTimeArray, out int[] nErrorArray) { int num = sItemIDArray.Count <string>(); int[] array = new int[num]; for (int i = 0; i < num; i++) { array[i] = 0; } int[] array2 = new int[num]; oValueArray = new object[num]; wQualityArray = new short[num]; fTimeArray = new OpcRcw.Da.FILETIME[num]; nErrorArray = new int[num]; bool result; try { IOPCItemIO iopcitemIO = (IOPCItemIO)this.m_OPCServer; IntPtr intPtr; IntPtr intPtr2; IntPtr intPtr3; IntPtr intPtr4; iopcitemIO.Read(num, sItemIDArray, array, out intPtr, out intPtr2, out intPtr3, out intPtr4); IntPtr intPtr5 = intPtr; IntPtr ptr = intPtr3; Marshal.Copy(intPtr4, nErrorArray, 0, num); Marshal.Copy(intPtr2, wQualityArray, 0, num); for (int j = 0; j < num; j++) { if (array2[j] == 0) { oValueArray[j] = Marshal.GetObjectForNativeVariant(intPtr5); } else { oValueArray[j] = "Error Value"; } fTimeArray[j] = (OpcRcw.Da.FILETIME)Marshal.PtrToStructure(ptr, typeof(OpcRcw.Da.FILETIME)); DxpSimpleClass.VariantClear(intPtr5); Marshal.DestroyStructure(ptr, typeof(OpcRcw.Da.FILETIME)); intPtr5 = (IntPtr)(intPtr5.ToInt32() + 16); ptr = (IntPtr)(ptr.ToInt32() + Marshal.SizeOf(typeof(OpcRcw.Da.FILETIME))); } Marshal.FreeCoTaskMem(intPtr); Marshal.FreeCoTaskMem(intPtr3); Marshal.FreeCoTaskMem(intPtr4); Marshal.FreeCoTaskMem(intPtr2); result = true; } catch (Exception ex) { #if DEBUG Debug.WriteLine(ex); #endif result = false; } return(result); }
// 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); }