From 22e64ea3ee000bfba8dae011727acd2fb67d6d20 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Fri, 21 Apr 2023 16:31:57 +0200
Subject: [PATCH] added some helpers
---
src/TL.Helpers.cs | 7 +++++++
src/TL.Schema.cs | 2 +-
src/TL.cs | 6 +++---
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs
index 463d3bc..1fb8141 100644
--- a/src/TL.Helpers.cs
+++ b/src/TL.Helpers.cs
@@ -492,6 +492,13 @@ namespace TL
public static implicit operator InputStickerSetID(StickerSet stickerSet) => new() { id = stickerSet.id, access_hash = stickerSet.access_hash };
}
+ partial class MessageEntity
+ {
+ public string Type { get { var name = GetType().Name; return name[(name.IndexOf("MessageEntity") + 13)..]; } }
+ public int Offset { get => offset; set => offset = value; }
+ public int Length { get => length; set => length = value; }
+ }
+
partial class InputChannel
{
/// Channel identifier
diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs
index ca343c3..bff0d83 100644
--- a/src/TL.Schema.cs
+++ b/src/TL.Schema.cs
@@ -6754,7 +6754,7 @@ namespace TL
}
/// Message entities, representing styled text in a message See Derived classes: , , , , , , , , , , , , , , , , , , , ,
- public abstract class MessageEntity : IObject
+ public abstract partial class MessageEntity : IObject
{
/// Offset of message entity within message (in UTF-16 code units)
public int offset;
diff --git a/src/TL.cs b/src/TL.cs
index 20659c9..1c4fab8 100644
--- a/src/TL.cs
+++ b/src/TL.cs
@@ -42,9 +42,9 @@ namespace TL
public Exception Exception;
}
- internal static class Serialization
+ public static class Serialization
{
- internal static void WriteTLObject(this BinaryWriter writer, T obj) where T : IObject
+ public static void WriteTLObject(this BinaryWriter writer, T obj) where T : IObject
{
if (obj == null) { writer.WriteTLNull(typeof(T)); return; }
var type = obj.GetType();
@@ -66,7 +66,7 @@ namespace TL
}
}
- internal static IObject ReadTLObject(this BinaryReader reader, uint ctorNb = 0)
+ public static IObject ReadTLObject(this BinaryReader reader, uint ctorNb = 0)
{
if (ctorNb == 0) ctorNb = reader.ReadUInt32();
if (ctorNb == Layer.GZipedCtor)