public static bool isVideoDocument(TLDocument document) { if (document != null) { bool isAnimated = false; bool isVideo = false; int width = 0; int height = 0; for (int a = 0; a < document.Attributes.Count; a++) { TLDocumentAttributeBase attribute = document.Attributes[a]; if (attribute is TLDocumentAttributeVideo videoAttribute) { isVideo = true; width = videoAttribute.W; height = videoAttribute.H; } else if (attribute is TLDocumentAttributeAnimated) { isAnimated = true; } } if (isAnimated && (width > 1280 || height > 1280)) { isAnimated = false; } return(isVideo && !isAnimated); } return(false); }
public static bool IsMusic(TLDocument document, int size) { if (size > 0) { var audioAttribute = document.Attributes.OfType <TLDocumentAttributeAudio>().FirstOrDefault(); if (audioAttribute != null && !audioAttribute.IsVoice) { return(true); } } return(false); }
public static bool IsGif(TLDocument document) { if (document != null && document.MimeType.Equals("video/mp4", StringComparison.OrdinalIgnoreCase)) { return(IsGif(document.Attributes, document.Size)); } return(false); //TLDocumentExternal tLDocumentExternal = document as TLDocumentExternal; //return tLDocumentExternal != null && string.Equals(tLDocumentExternal.Type.ToString(), "gif", 5) && TLMessageBase.IsGif(tLDocumentExternal, null); }
public static bool IsRoundVideo(TLDocument document, int size) { if (size > 0) { var videoAttribute = document.Attributes.OfType <TLDocumentAttributeVideo>().FirstOrDefault(); var animatedAttribute = document.Attributes.OfType <TLDocumentAttributeAnimated>().FirstOrDefault(); if (videoAttribute != null /*&& animatedAttribute == null*/) { return(videoAttribute.IsRoundMessage); } } return(false); }
public static bool isMusicDocument(TLDocument document) { if (document != null) { for (int a = 0; a < document.Attributes.Count; a++) { TLDocumentAttributeBase attribute = document.Attributes[a]; if (attribute is TLDocumentAttributeAudio audioAttribute) { return(!audioAttribute.IsVoice); } } } return(false); }
public static bool isMaskDocument(TLDocument document) { if (document != null) { for (int a = 0; a < document.Attributes.Count; a++) { TLDocumentAttributeBase attribute = document.Attributes[a]; if (attribute is TLDocumentAttributeSticker stickerAttribute && stickerAttribute.IsMask) { return(true); } } } return(false); }
public static bool IsVoice(TLDocument document, int size) { var audioAttribute = document.Attributes.OfType <TLDocumentAttributeAudio>().FirstOrDefault(); return(audioAttribute != null && audioAttribute.IsVoice); }