Esempio n. 1
0
        private void TestJsonOnFile(string file, UE4Version version)
        {
            Debug.WriteLine(file);
            var tester = new UAsset(Path.Combine("TestJson", file), version);

            Assert.IsTrue(tester.VerifyBinaryEquality());
            Assert.IsTrue(CheckAllExportsParsedCorrectly(tester));

            string jsonSerializedAsset = tester.SerializeJson();

            File.WriteAllText(Path.Combine("TestJson", "raw.json"), jsonSerializedAsset);

            var tester2 = UAsset.DeserializeJson(File.ReadAllText(Path.Combine("TestJson", "raw.json")));

            tester2.Write(Path.Combine("TestJson", "MODIFIED.uasset"));

            // For the assets we're testing binary equality is maintained and can be used as a metric of success, but binary equality is not guaranteed for most assets
            Assert.IsTrue(File.ReadAllBytes(Path.Combine("TestJson", file)).SequenceEqual(File.ReadAllBytes(Path.Combine("TestJson", "MODIFIED.uasset"))));
        }