public FontLoader(/*Factory factory*/ ResourceManageCore resourceCore, string searchDir) { _factory = new Factory(); //_factory = factory; FileManagerCore.logger.Info(this, "Loading Fonts from " + searchDir); if (resourceCore.getDirectory(searchDir, out ResDirectory resDirectory)) { foreach (string name in resDirectory.getChildFileList()) { if (name.EndsWith(".ttf")) { FileManagerCore.logger.Info(this, "Fonts file found! " + name); resourceCore.getFile(searchDir + "/" + name, out ResFile resfile); DataStream stream = new DataStream(resfile.rawData.Length, true, true); stream.Write(resfile.rawData, 0, resfile.rawData.Length); stream.Position = 0; _fontStreams.Add(new ResourceFontFileStream(stream)); } } } FileManagerCore.logger.Info(this, "Loading Fonts Success!"); Key = new DataStream(sizeof(int) * _fontStreams.Count, true, true); for (int i = 0; i < _fontStreams.Count; i++) { Key.Write(i); } Key.Position = 0; _factory.RegisterFontFileLoader(this); _factory.RegisterFontCollectionLoader(this); }