mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
Add caption length validation
This commit is contained in:
parent
1697db9d7f
commit
e78a9f68ac
|
|
@ -285,7 +285,7 @@ namespace TLSharp.Core
|
||||||
media = new TLInputMediaUploadedDocument()
|
media = new TLInputMediaUploadedDocument()
|
||||||
{
|
{
|
||||||
file = file,
|
file = file,
|
||||||
caption = caption,
|
Caption = caption,
|
||||||
mime_type = mimeType,
|
mime_type = mimeType,
|
||||||
attributes = attributes
|
attributes = attributes
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,8 @@ namespace TeleSharp.TL
|
||||||
public TLAbsInputFile file {get;set;}
|
public TLAbsInputFile file {get;set;}
|
||||||
public string mime_type {get;set;}
|
public string mime_type {get;set;}
|
||||||
public TLVector<TLAbsDocumentAttribute> attributes {get;set;}
|
public TLVector<TLAbsDocumentAttribute> attributes {get;set;}
|
||||||
public string caption {get;set;}
|
private string caption;
|
||||||
|
public string Caption { get { return caption; } set { caption = value.Length > 200 ? value.Remove(199, value.Length - 199) : value; } }
|
||||||
public TLVector<TLAbsInputDocument> stickers {get;set;}
|
public TLVector<TLAbsInputDocument> stickers {get;set;}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -39,7 +40,7 @@ flags = stickers != null ? (flags | 1) : (flags & ~1);
|
||||||
file = (TLAbsInputFile)ObjectUtils.DeserializeObject(br);
|
file = (TLAbsInputFile)ObjectUtils.DeserializeObject(br);
|
||||||
mime_type = StringUtil.Deserialize(br);
|
mime_type = StringUtil.Deserialize(br);
|
||||||
attributes = (TLVector<TLAbsDocumentAttribute>)ObjectUtils.DeserializeVector<TLAbsDocumentAttribute>(br);
|
attributes = (TLVector<TLAbsDocumentAttribute>)ObjectUtils.DeserializeVector<TLAbsDocumentAttribute>(br);
|
||||||
caption = StringUtil.Deserialize(br);
|
Caption = StringUtil.Deserialize(br);
|
||||||
if ((flags & 1) != 0)
|
if ((flags & 1) != 0)
|
||||||
stickers = (TLVector<TLAbsInputDocument>)ObjectUtils.DeserializeVector<TLAbsInputDocument>(br);
|
stickers = (TLVector<TLAbsInputDocument>)ObjectUtils.DeserializeVector<TLAbsInputDocument>(br);
|
||||||
else
|
else
|
||||||
|
|
@ -56,7 +57,7 @@ bw.Write(flags);
|
||||||
ObjectUtils.SerializeObject(file,bw);
|
ObjectUtils.SerializeObject(file,bw);
|
||||||
StringUtil.Serialize(mime_type,bw);
|
StringUtil.Serialize(mime_type,bw);
|
||||||
ObjectUtils.SerializeObject(attributes,bw);
|
ObjectUtils.SerializeObject(attributes,bw);
|
||||||
StringUtil.Serialize(caption,bw);
|
StringUtil.Serialize(Caption,bw);
|
||||||
if ((flags & 1) != 0)
|
if ((flags & 1) != 0)
|
||||||
ObjectUtils.SerializeObject(stickers,bw);
|
ObjectUtils.SerializeObject(stickers,bw);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue