コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }