Exemplo n.º 1
0
        //--------------------------------------------------------------------------------
        public static String ConnectorSendCommand(String command)
        {
            IntPtr pData   = MarshalUTF8.StringToHGlobalUTF8(command);
            IntPtr 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 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);
            }
        }
Exemplo n.º 4
0
        public static void ConnectorUnInitialize()
        {
            if (statusDisconnected.WaitOne(statusTimeout))
            {
                IntPtr pResult = UnInitialize();

                if (!pResult.Equals(IntPtr.Zero))
                {
                    String result = MarshalUTF8.PtrToStringUTF8(pResult);
                    FreeMemory(pResult);
                    log.WriteLog(result);
                }
                else
                {
                    log.WriteLog("UnInitialize() OK");
                }
            }
            else
            {
                log.WriteLog("WARNING! Не дождались статуса disconnected. UnInitialize() не выполнено.");
            }
        }