|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
using System;
|
|
|
|
|
using Microsoft.Maui.Controls;
|
|
|
|
|
using Models.Interfaces;
|
|
|
|
|
|
|
|
|
|
namespace Models.Game
|
|
|
|
@ -25,5 +26,16 @@ namespace Models.Game
|
|
|
|
|
byte[] imageBytes = File.ReadAllBytes(imagePath);
|
|
|
|
|
return Convert.ToBase64String(imageBytes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Retrieve an image from a string encoded in base64
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="imageString"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public ImageSource RetrieveImage(string imageString)
|
|
|
|
|
{
|
|
|
|
|
byte[] imageBytes = Convert.FromBase64String(imageString);
|
|
|
|
|
return ImageSource.FromStream(() => new MemoryStream(imageBytes));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|