public FontGenerator LoadFont(string directory, FontDescription description, params FontEffect[] effects) { var fontDirectory = Path.GetFullPath(Path.Combine(context.MapsetPath, directory)); if (fontDirectories.Contains(fontDirectory)) { throw new InvalidOperationException($"This effect already generated a font inside \"{fontDirectory}\""); } fontDirectories.Add(fontDirectory); var fontGenerator = new FontGenerator(directory, description, effects, context.ProjectPath, context.MapsetPath); fontGenerators.Add(fontGenerator); var cachePath = fontCacheDirectory; if (Directory.Exists(cachePath)) { var path = Path.Combine(cachePath, HashHelper.GetMd5(fontGenerator.Directory) + ".yaml"); if (File.Exists(path)) { var cachedFontRoot = Util.Misc.WithRetries(() => TinyToken.Read(path), canThrow: false); if (cachedFontRoot != null) { fontGenerator.HandleCache(cachedFontRoot); } } } return(fontGenerator); }