Example #1
0
        public string ConnectorInitialize(string Path, short LogLevel)
        {
            IntPtr num1  = MarshalUTF8.StringToHGlobalUTF8(Path);
            IntPtr num2  = new IntPtr();
            IntPtr pData = !Environment.Is64BitProcess ? TXmlConnector.Initialize(num1, (int)LogLevel) : TXmlConnector.Initialize64(num1, (int)LogLevel);

            if (pData != IntPtr.Zero)
            {
                string str = MarshalUTF8.PtrToStringUTF8(pData);
                Marshal.FreeHGlobal(num1);
                if (Environment.Is64BitProcess)
                {
                    TXmlConnector.FreeMemory64(pData);
                }
                else
                {
                    TXmlConnector.FreeMemory(pData);
                }
                return(str);
            }
            else
            {
                Marshal.FreeHGlobal(num1);
                return(string.Empty);
            }
        }
Example #2
0
        private void MyCallBackEx(IntPtr pData, IntPtr userData)
        {
            string data = MarshalUTF8.PtrToStringUTF8(pData);

            if (Environment.Is64BitProcess)
            {
                TXmlConnector.FreeMemory64(pData);
            }
            else
            {
                TXmlConnector.FreeMemory(pData);
            }
            this.RaiseNewDataEvent(data);
        }
Example #3
0
        public string ConnectorUnInitialize()
        {
            IntPtr num   = new IntPtr();
            IntPtr pData = !Environment.Is64BitProcess ? TXmlConnector.UnInitialize() : TXmlConnector.UnInitialize64();

            if (!(pData != IntPtr.Zero))
            {
                return(string.Empty);
            }
            string str = MarshalUTF8.PtrToStringUTF8(pData);

            if (Environment.Is64BitProcess)
            {
                TXmlConnector.FreeMemory64(pData);
            }
            else
            {
                TXmlConnector.FreeMemory(pData);
            }
            return(str);
        }
Example #4
0
        public string SendCommand(string command)
        {
            IntPtr num1  = MarshalUTF8.StringToHGlobalUTF8(command);
            IntPtr num2  = new IntPtr();
            IntPtr pData = !Environment.Is64BitProcess ? TXmlConnector.SendCommand(num1) : TXmlConnector.SendCommand64(num1);

            if (!(pData != IntPtr.Zero))
            {
                return(string.Empty);
            }
            string str = MarshalUTF8.PtrToStringUTF8(pData);

            Marshal.FreeHGlobal(num1);
            if (Environment.Is64BitProcess)
            {
                TXmlConnector.FreeMemory64(pData);
            }
            else
            {
                TXmlConnector.FreeMemory(pData);
            }
            return(str);
        }