diff --git a/td/generate/DotnetTlDocumentationGenerator.php b/td/generate/DotnetTlDocumentationGenerator.php index d32492c8..674cbe13 100644 --- a/td/generate/DotnetTlDocumentationGenerator.php +++ b/td/generate/DotnetTlDocumentationGenerator.php @@ -54,7 +54,7 @@ class DotnetTlDocumentationGenerator extends TlDocumentationGenerator case 'string': return 'String^'; case 'bytes': - return 'Array^'; + return 'Array^'; case 'bool': case 'int': case 'long': @@ -210,7 +210,7 @@ EOT while (substr($field_type, $pos, 6) === 'Array<') { $pos += 6; } - if (substr($field_type, $pos, 6) !== 'String' && ucfirst(substr($field_type, $pos)) === substr($field_type, $pos)) { + if (substr($field_type, $pos, 4) !== 'BYTE' && substr($field_type, $pos, 6) !== 'String' && ucfirst(substr($field_type, $pos)) === substr($field_type, $pos)) { $field_type = substr($field_type, 0, $pos).'::Telegram::Td::Api::'.substr($field_type, $pos); } $full_constructor .= $colon.$field_type.' '.$this->getParameterName($name, $class_name); diff --git a/td/generate/tl_writer_dotnet.h b/td/generate/tl_writer_dotnet.h index 276f4ba3..01295805 100644 --- a/td/generate/tl_writer_dotnet.h +++ b/td/generate/tl_writer_dotnet.h @@ -158,7 +158,7 @@ class TlWriterDotNet : public TL_writer { return "String^"; } if (name == "Bytes") { - return "Array^"; + return "Array^"; } if (name == "Vector") { @@ -288,7 +288,8 @@ class TlWriterDotNet : public TL_writer { while (field_type.substr(pos, 6) == "Array<") { pos += 6; } - if (field_type.substr(pos, 6) != "String" && to_upper(field_type[pos]) == field_type[pos]) { + if (field_type.substr(pos, 4) != "BYTE" && field_type.substr(pos, 6) != "String" && + to_upper(field_type[pos]) == field_type[pos]) { field_type = field_type.substr(0, pos) + "::Telegram::Td::Api::" + field_type.substr(pos); } ss << field_type << " " << to_camelCase(a.name); @@ -383,7 +384,7 @@ class TlWriterDotNet : public TL_writer { } else { ss << ", "; } - bool need_bytes = gen_field_type(it) == "Array^" || gen_field_type(it) == "Array^>^"; + bool need_bytes = gen_field_type(it) == "Array^" || gen_field_type(it) == "Array^>^"; ss << (need_bytes ? "Bytes" : "") << "FromUnmanaged(from." << gen_native_field_name(it.name) << ")"; } ss << ");\n}\n"; diff --git a/td/tl/tl_dotnet_object.h b/td/tl/tl_dotnet_object.h index ea1c8366..a1afce34 100644 --- a/td/tl/tl_dotnet_object.h +++ b/td/tl/tl_dotnet_object.h @@ -63,7 +63,7 @@ inline String^ FromUnmanaged(const std::string &from) { } inline auto CLRCALL BytesFromUnmanaged(const std::string &from) { - Array^ res = REF_NEW Vector(static_cast(from.size())); + Array^ res = REF_NEW Vector(static_cast(from.size())); ArrayIndexType i = 0; for (auto b : from) { ArraySet(res, i++, b); @@ -160,7 +160,7 @@ inline std::string ToUnmanaged(String ^from) { return string_to_unmanaged(from); } -inline std::string ToUnmanaged(Array^ from) { +inline std::string ToUnmanaged(Array^ from) { if (!from) { return std::string(); }