public void Test() { var path = Path.Combine(TestContext.CurrentContext.TestDirectory, "Files", "Fonts"); var files = Directory.GetFiles(path, "*.vfont"); foreach (var file in files) { var shader = new ValveFont(); var decryptedFont = shader.Read(file); using (var decryptedStream = new MemoryStream(decryptedFont)) using (var expected = new FileStream(Path.ChangeExtension(file, "ttf"), FileMode.Open, FileAccess.Read)) { FileAssert.AreEqual(expected, decryptedStream); } } }
private static void ParseVFont(string path) { lock (ConsoleWriterLock) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("--- Loading font file \"{0}\" ---", path); Console.ResetColor(); } var font = new ValveFont(); try { var output = font.Read(path); if (Options.OutputFile != null) { var fileName = Path.GetFileName(path); fileName = Path.ChangeExtension(fileName, "ttf"); DumpFile(fileName, output); } } catch (Exception e) { lock (ConsoleWriterLock) { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine(e); Console.ResetColor(); } } }