Save ffxiv font to disk on first download
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Version>1.26.0</Version>
|
||||
<Version>1.26.1</Version>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
+13
-1
@@ -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")
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,8 @@ using ChatTwo.Ipc;
|
||||
using ChatTwo.Resources;
|
||||
using ChatTwo.Ui;
|
||||
using ChatTwo.Util;
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Game.ClientState.Conditions;
|
||||
using Dalamud.Game.ClientState.Objects;
|
||||
using Dalamud.Hooking;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.Plugin;
|
||||
@@ -67,7 +65,6 @@ public sealed class Plugin : IDalamudPlugin
|
||||
|
||||
internal DateTime GameStarted { get; }
|
||||
|
||||
#pragma warning disable CS8618
|
||||
public Plugin()
|
||||
{
|
||||
try
|
||||
@@ -143,7 +140,6 @@ public sealed class Plugin : IDalamudPlugin
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#pragma warning restore CS8618
|
||||
|
||||
// Suppressing this warning because Dispose() is called in Plugin() if the
|
||||
// load fails, so some values may not be initialized.
|
||||
|
||||
Reference in New Issue
Block a user