Esempio n. 1
0
        public TdClient(ITdLibBindings bindings)
        {
            _tdJsonClient = new TdJsonClient(bindings);

            _tasks = new ConcurrentDictionary <int, Action <TdApi.Object> >();

            _receiver           = new Receiver(_tdJsonClient);
            _receiver.Received += OnReceived;
            _receiver.AuthorizationStateChanged += OnAuthorizationStateChanged;
        }
Esempio n. 2
0
        private static string Execute(ITdLibBindings bindings, IntPtr handle, string data)
        {
            var ptr = Interop.StringToIntPtr(data);

            try
            {
                var res = bindings.ClientExecute(handle, ptr);
                return(Interop.IntPtrToString(res));
            }
            finally
            {
                Interop.FreeIntPtr(ptr);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Synchronously send JSON string to TDLib and get response
 /// </summary>
 public static string GlobalExecute(ITdLibBindings bindings, string data)
 => Execute(bindings, IntPtr.Zero, data);
Esempio n. 4
0
 public TdJsonClient(ITdLibBindings bindings)
 {
     Bindings = bindings;
     _handle  = Bindings.ClientCreate();
 }
        public static void SetLogFilePath(this ITdLibBindings bindings, string path)
        {
            var ptr = Interop.StringToIntPtr(path);

            bindings.SetLogFilePath(ptr);
        }
 public static void SetLogVerbosityLevel(this ITdLibBindings bindings, TdLogLevel level)
 {
     bindings.SetLogVerbosityLevel((int)level);
 }