diff --git a/Lagrange.Core/Message/Entity/ImageEntity.cs b/Lagrange.Core/Message/Entity/ImageEntity.cs index 350217e34..bf0c7ab4e 100644 --- a/Lagrange.Core/Message/Entity/ImageEntity.cs +++ b/Lagrange.Core/Message/Entity/ImageEntity.cs @@ -22,6 +22,8 @@ public class ImageEntity : IMessageEntity public string FilePath { get; set; } = string.Empty; + public byte[] ImageMd5 { get; set; } = Array.Empty(); + public uint ImageSize { get; set; } public string ImageUrl { get; set; } = string.Empty; @@ -55,7 +57,7 @@ public ImageEntity(byte[] file) FilePath = ""; ImageStream = new Lazy(() => new MemoryStream(file)); } - + public ImageEntity(Stream stream) { FilePath = ""; @@ -97,12 +99,13 @@ IEnumerable IMessageEntity.PackElement() { PictureSize = new Vector2(index.Info.Width, index.Info.Height), FilePath = index.Info.FileName, + ImageMd5 = index.Info.FileHash.UnHex(), ImageSize = index.Info.FileSize, MsgInfo = extra, SubType = (int)extra.ExtBizInfo.Pic.BizType, }; } - + if (elems.NotOnlineImage is { } image) { if (image.OrigUrl.Contains("&fileid=")) // NTQQ's shit @@ -111,18 +114,19 @@ IEnumerable IMessageEntity.PackElement() { PictureSize = new Vector2(image.PicWidth, image.PicHeight), FilePath = image.FilePath, + ImageMd5 = image.PicMd5, ImageSize = image.FileLen, ImageUrl = $"{BaseUrl}{image.OrigUrl}", Summary = image.PbRes.Summary, SubType = image.PbRes.SubType }; - } return new ImageEntity { PictureSize = new Vector2(image.PicWidth, image.PicHeight), FilePath = image.FilePath, + ImageMd5 = image.PicMd5, ImageSize = image.FileLen, ImageUrl = $"{LegacyBaseUrl}{image.OrigUrl}", Summary = image.PbRes.Summary, @@ -159,7 +163,7 @@ IEnumerable IMessageEntity.PackElement() return null; } - + private static int GetImageTypeFromFaceOldData(CustomFace face) { if (face.OldData == null || face.OldData.Length < 5)