Exemplo n.º 1
0
        //--------------------------------------------------------------------------------
        public static String ConnectorSendCommand(String command)
        {
            if (MainWindowViewModel.IsReconnecting)
            {
                return(null);
            }
            IntPtr pData   = MarshalUTF8.StringToHGlobalUTF8(command);
            var    pResult = SendCommand(pData);
            String result  = MarshalUTF8.PtrToStringUTF8(pResult);

            Marshal.FreeHGlobal(pData);
            FreeMemory(pResult);

            return(result);
        }
Exemplo n.º 2
0
        //--------------------------------------------------------------------------------
        static bool MyCallBack(IntPtr pData)
        {
            string res;
            String data = MarshalUTF8.PtrToStringUTF8(pData);

            FreeMemory(pData);

            res = Transaq_HandleData(data);
            if (res == "server_status")
            {
                New_Status();
            }

            return(true);
        }
Exemplo n.º 3
0
        public static void ConnectorUnInitialize()
        {
            var pResult = UnInitialize();


            if (!pResult.Equals(IntPtr.Zero))
            {
                String result = MarshalUTF8.PtrToStringUTF8(pResult);
                FreeMemory(pResult);
                //log.WriteLog(result);
            }
            else
            {
                //log.WriteLog("UnInitialize() OK");
            }
        }
Exemplo n.º 4
0
        public static bool ConnectorInitialize(String path, Int16 logLevel)
        {
            IntPtr pPath   = MarshalUTF8.StringToHGlobalUTF8(path);
            IntPtr pResult = Initialize(pPath, logLevel);

            if (!pResult.Equals(IntPtr.Zero))
            {
                String result = MarshalUTF8.PtrToStringUTF8(pResult);
                Marshal.FreeHGlobal(pPath);
                FreeMemory(pResult);
                //log.WriteLog(result);
                return(false);
            }
            else
            {
                Marshal.FreeHGlobal(pPath);
                //log.WriteLog("Initialize() OK");
                return(true);
            }
        }