Remove embedded profile image data
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
namespace MareSynchronos.Services;
|
||||
|
||||
public record MareProfileData(bool IsFlagged, bool IsNSFW, string Base64ProfilePicture, string Base64SupporterPicture, string Description)
|
||||
public record MareProfileData(bool IsFlagged, bool IsNSFW, string Base64ProfilePicture, string Description)
|
||||
{
|
||||
public Lazy<byte[]> ImageData { get; } = new Lazy<byte[]>(Convert.FromBase64String(Base64ProfilePicture));
|
||||
public Lazy<byte[]> SupporterImageData { get; } = new Lazy<byte[]>(string.IsNullOrEmpty(Base64SupporterPicture) ? [] : Convert.FromBase64String(Base64SupporterPicture));
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -91,6 +91,7 @@ public class PopoutProfileUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
_textureWrap?.Dispose();
|
||||
_lastProfilePicture = mareProfile.ImageData.Value;
|
||||
|
||||
_textureWrap = _uiSharedService.LoadImage(_lastProfilePicture);
|
||||
}
|
||||
|
||||
|
||||
@@ -957,6 +957,16 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
|
||||
public IDalamudTextureWrap LoadImage(byte[] imageData)
|
||||
{
|
||||
if (imageData.Length == 0)
|
||||
{
|
||||
return _textureProvider.CreateEmpty(new()
|
||||
{
|
||||
Width = 256,
|
||||
Height = 256,
|
||||
DxgiFormat = 3,
|
||||
Pitch = 1024
|
||||
}, cpuRead: false, cpuWrite: false);
|
||||
}
|
||||
return _textureProvider.CreateFromImageAsync(imageData).Result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user