ToBytes TL.Serialization helper.

Warning: do not use for long-term storage because TL structures can change in future layers and may not be deserializable
This commit is contained in:
Wizou 2025-11-05 15:00:48 +01:00
parent 9ec2f31f72
commit d6fdcab440
4 changed files with 14 additions and 7 deletions

View file

@ -181,11 +181,11 @@ public class MTProtoGenerator : IIncrementalGenerator
break;
case "System.Collections.Generic.Dictionary<long, TL.User>":
readTL.AppendLine($"r.{member.Name} = reader.ReadTLDictionary<User>();");
writeTl.AppendLine($"writer.WriteTLVector({member.Name}.Values.ToArray());");
writeTl.AppendLine($"writer.WriteTLVector({member.Name}?.Values.ToArray());");
break;
case "System.Collections.Generic.Dictionary<long, TL.ChatBase>":
readTL.AppendLine($"r.{member.Name} = reader.ReadTLDictionary<ChatBase>();");
writeTl.AppendLine($"writer.WriteTLVector({member.Name}.Values.ToArray());");
writeTl.AppendLine($"writer.WriteTLVector({member.Name}?.Values.ToArray());");
break;
case "object":
readTL.AppendLine($"r.{member.Name} = reader.ReadTLObject();");