I am using tl-language compiler to compile schema of Telegram Api TL language described in https://core.telegram.org/mtproto in C#
There is a compiler that compile tl-language to C# classes https://github.com/everbytes/SharpTL.Compiler
But it can compile new telegram schema at this line:
"params":[
{"name":"flags","type":"#"},
{"name":"report_spam","type":"flags.0?true"}]
,"type":"PeerSettings"}
And it compile it to wrong code:
[TLObject(0x818426CD)]
public partial class PeerSettings : IPeerSettings
{
[TLProperty(1)]
public I# Flags { get; set; }
[TLProperty(2)]
public IFlags0?true ReportSpam { get; set; }
}
Is there any solution in casting in C# codes?
I do not know what is type of this “flags:#” in C#
This type “#” described in https://core.telegram.org/mtproto/TL-formal
user {flags:#} id:flags.0?string first_name:flags.1?string last_name:flags.2?string reserved3:flags.3?False reserved4:flags.4?False = User flags;
In the future, bits 3 and 4 in the flags field may be used to transmit new fields after changing the names and types of the reserved3 and reserved4 fields
2
Answers
this means
int
according to TLGeneratordeep searching around this I think this hash (#) means that dynamic value of variable, in some cases it can be true or false, another cases it can be a sequence of integers nonnegative:
above we got the M and N taking a integer random value > 0
in this another case it can assume a conditional value
req_fields variable is cast only to User object, but in other cases it could be casted
to another kind of object.
maybe the correct way of this TLObject in c# is :
apologises my english is rusty