mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2025-12-06 06:52:01 +01:00
minor logging
This commit is contained in:
parent
e53293b8e6
commit
4ee62a4273
|
|
@ -14,6 +14,9 @@ using System.Threading.Tasks;
|
||||||
using TL;
|
using TL;
|
||||||
using static WTelegram.Encryption;
|
using static WTelegram.Encryption;
|
||||||
|
|
||||||
|
//TODO: include XML comments in nuget
|
||||||
|
//TODO: make assembly versions match nuget package version
|
||||||
|
|
||||||
namespace WTelegram
|
namespace WTelegram
|
||||||
{
|
{
|
||||||
public sealed class Client : IDisposable
|
public sealed class Client : IDisposable
|
||||||
|
|
@ -150,7 +153,7 @@ namespace WTelegram
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Helpers.Log(1, $"Sending {msg.GetType().Name}... (seqno {seqno})");
|
Helpers.Log(1, $"Sending {msg.GetType().Name,-50} #{(short)msgId.GetHashCode():X4})");
|
||||||
//TODO: Implement MTProto 2.0
|
//TODO: Implement MTProto 2.0
|
||||||
using var clearStream = new MemoryStream(1024); //TODO: choose a useful capacity
|
using var clearStream = new MemoryStream(1024); //TODO: choose a useful capacity
|
||||||
using var clearWriter = new BinaryWriter(clearStream, Encoding.UTF8);
|
using var clearWriter = new BinaryWriter(clearStream, Encoding.UTF8);
|
||||||
|
|
@ -302,6 +305,7 @@ namespace WTelegram
|
||||||
rpcResult.result = Schema.DeserializeValue(reader, _lastRpcResultType);
|
rpcResult.result = Schema.DeserializeValue(reader, _lastRpcResultType);
|
||||||
else
|
else
|
||||||
rpcResult.result = Schema.Deserialize<ITLObject>(reader);
|
rpcResult.result = Schema.Deserialize<ITLObject>(reader);
|
||||||
|
Helpers.Log(1, $" → {rpcResult.result.GetType().Name,-50} #{(short)reqMsgId.GetHashCode():X4})");
|
||||||
return rpcResult;
|
return rpcResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ namespace WTelegram
|
||||||
{
|
{
|
||||||
public static class Helpers
|
public static class Helpers
|
||||||
{
|
{
|
||||||
public static readonly System.Text.Json.JsonSerializerOptions JsonOptions = new(System.Text.Json.JsonSerializerDefaults.Web) { IncludeFields = true };
|
public static readonly System.Text.Json.JsonSerializerOptions JsonOptions = new(System.Text.Json.JsonSerializerDefaults.Web) { IncludeFields = true, WriteIndented = true };
|
||||||
|
|
||||||
public static V GetOrCreate<K, V>(this Dictionary<K, V> dictionary, K key) where V : new()
|
public static V GetOrCreate<K, V>(this Dictionary<K, V> dictionary, K key) where V : new()
|
||||||
=> dictionary.TryGetValue(key, out V value) ? value : dictionary[key] = new V();
|
=> dictionary.TryGetValue(key, out V value) ? value : dictionary[key] = new V();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue