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; }
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); } }
/// <summary> /// Synchronously send JSON string to TDLib and get response /// </summary> public static string GlobalExecute(ITdLibBindings bindings, string data) => Execute(bindings, IntPtr.Zero, data);
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); }