Beispiel #1
0
 /// <summary>
 /// Attempts to save the SSBH supported file to given filepath
 /// </summary>
 /// <param name="filePath"></param>
 /// <param name="file"></param>
 public static void TrySaveSsbhFile(string filePath, SsbhFile file)
 {
     using (var exporter = new SsbhExporter(filePath))
     {
         exporter.WriteSsbhFile(file);
     }
 }
Beispiel #2
0
        private static void TestFileExport <T>(string inputFile) where T : SsbhFile
        {
            Ssbh.TryParseSsbhFile(inputFile, out T file);

            var stream = new MemoryStream();

            using (var exporter = new SsbhExporter(stream))
            {
                exporter.WriteSsbhFile(file);
            }

            // Saving the output is only needed if the bytes differ.
            if (!Enumerable.SequenceEqual(File.ReadAllBytes(inputFile), stream.ToArray()))
            {
                Console.WriteLine($"{Path.GetFileName(inputFile)} did not export 1:1");
                File.WriteAllBytes($"{inputFile}.out", stream.ToArray());
            }
            else
            {
                Console.WriteLine($"1:1 Export for type {typeof(T).Name}");
            }
        }
Beispiel #3
0
 /// <summary>
 /// Attempts to save the SSBH supported file to given filepath
 /// </summary>
 /// <param name="filePath"></param>
 /// <param name="file"></param>
 public static void TrySaveSsbhFile(string filePath, SsbhFile file)
 {
     SsbhExporter.WriteSsbhFile(filePath, file, true);
 }
Beispiel #4
0
 /// <summary>
 /// This pretty much exists for MATL's only
 /// </summary>
 /// <param name="exporter"></param>
 public virtual void PostWrite(SsbhExporter exporter)
 {
 }