public string ConnectorInitialize(string Path, short LogLevel) { IntPtr num1 = MarshalUTF8.StringToHGlobalUTF8(Path); IntPtr num2 = new IntPtr(); IntPtr pData = !Environment.Is64BitProcess ? TXcnConnector.Initialize(num1, (int)LogLevel) : TXcnConnector.Initialize64(num1, (int)LogLevel); if (pData != IntPtr.Zero) { string str = MarshalUTF8.PtrToStringUTF8(pData); Marshal.FreeHGlobal(num1); if (Environment.Is64BitProcess) { TXcnConnector.FreeMemory64(pData); } else { TXcnConnector.FreeMemory(pData); } return(str); } else { Marshal.FreeHGlobal(num1); return(string.Empty); } }
public void MyCallBackEx(IntPtr pData, IntPtr userData) { string data = MarshalUTF8.PtrToStringUTF8(pData); if (Environment.Is64BitProcess) { TXcnConnector.FreeMemory64(pData); } else { TXcnConnector.FreeMemory(pData); } this.RaiseNewDataEvent(data); }
public string ConnectorUnInitialize() { IntPtr num = new IntPtr(); IntPtr pData = !Environment.Is64BitProcess ? TXcnConnector.UnInitialize() : TXcnConnector.UnInitialize64(); if (!(pData != IntPtr.Zero)) { return(string.Empty); } string str = MarshalUTF8.PtrToStringUTF8(pData); if (Environment.Is64BitProcess) { TXcnConnector.FreeMemory64(pData); } else { TXcnConnector.FreeMemory(pData); } return(str); }
public string SendCommand(string command) { IntPtr num1 = MarshalUTF8.StringToHGlobalUTF8(command); IntPtr num2 = new IntPtr(); IntPtr pData = !Environment.Is64BitProcess ? TXcnConnector.SendCommand(num1) : TXcnConnector.SendCommand64(num1); if (!(pData != IntPtr.Zero)) { return(string.Empty); } string str = MarshalUTF8.PtrToStringUTF8(pData); Marshal.FreeHGlobal(num1); if (Environment.Is64BitProcess) { TXcnConnector.FreeMemory64(pData); } else { TXcnConnector.FreeMemory(pData); } return(str); }