Save ffxiv font to disk on first download

This commit is contained in:
Infi
2024-06-10 22:15:37 +02:00
parent 70989da680
commit 34b76cc853
3 changed files with 18 additions and 10 deletions
+17 -5
View File
@@ -32,11 +32,23 @@ public class FontManager
{
Plugin = plugin;
var gameSym = new HttpClient().GetAsync("https://img.finalfantasyxiv.com/lds/pc/global/fonts/FFXIV_Lodestone_SSF.ttf")
.Result
.Content
.ReadAsByteArrayAsync()
.Result;
byte[] gameSym;
var filePath = Path.Combine(Plugin.Interface.ConfigDirectory.FullName, "FFXIV_Lodestone_SSF.ttf");
if (File.Exists(filePath))
{
gameSym = File.ReadAllBytes(filePath);
}
else
{
gameSym = new HttpClient().GetAsync("https://img.finalfantasyxiv.com/lds/pc/global/fonts/FFXIV_Lodestone_SSF.ttf")
.Result
.Content
.ReadAsByteArrayAsync()
.Result;
File.WriteAllBytes(filePath, gameSym);
}
_gameSymFont = new FaceData(gameSym);
}