Fix .NET binding.

This commit is contained in:
levlam 2024-04-25 23:49:18 +03:00
parent 72368062ef
commit 019609c91a
2 changed files with 9 additions and 2 deletions

View File

@ -180,6 +180,9 @@ EOT
if ($type_name == $field_name.'^' || ($type_name == 'Message^' && $field_name == 'ReplyToMessage')) {
$type_name = '::Telegram::Td::Api::'.$type_name;
$end = ' {';
} else if ($class_name == "WebPage" && $field_name == "Stickers" && $type_name == "Array<Sticker^>^") {
$type_name = 'Array<::Telegram::Td::Api::Sticker^>^';
$end = ' {';
}
$full_line = $class_name." property $type_name $field_name$end";
$this->addDocumentation($full_line, <<<EOT

View File

@ -244,8 +244,12 @@ class TlWriterDotNet final : public TL_writer {
if (field_name == class_name) {
fixed_field_name += "Value";
}
if (type_name == field_name + "^" || (type_name == "Message^" && field_name == "ReplyToMessage")) {
auto fixed_type_name = "::Telegram::Td::Api::" + type_name;
auto is_web_page_stickers =
(class_name == "WebPage" && field_name == "Stickers" && type_name == "Array<Sticker^>^");
if (type_name == field_name + "^" || (type_name == "Message^" && field_name == "ReplyToMessage") ||
is_web_page_stickers) {
auto fixed_type_name =
is_web_page_stickers ? "Array<::Telegram::Td::Api::Sticker^>^" : "::Telegram::Td::Api::" + type_name;
std::stringstream ss;
ss << "private:\n";
ss << " " << fixed_type_name << " " << fixed_field_name << "PrivateField;\n";