Esempio n. 1
0
        private void ThePersonalityTestShouldHaveBeenProperlyPatched()
        {
            var baseromProject = ApplicationViewModel.CurrentSolution.GetAllProjects().FirstOrDefault(p => p is BaseRomProject) as BaseRomProject;

            if (baseromProject == null)
            {
                Assert.Fail("Failed to find a BaseRomProject");
            }

            var originalScript = Path.Combine(baseromProject.GetRawFilesDir(), "RomFS", "script", "event", "other", "seikakushindan", "seikakushindan.lua");

            if (!File.Exists(originalScript))
            {
                Assert.Inconclusive("Failed to find original personality test script: " + originalScript);
            }

            var modifiedScript = Path.Combine(Environment.CurrentDirectory, "extracted-rom", "RomFS", "script", "event", "other", "seikakushindan", "seikakushindan.lua");

            if (!File.Exists(modifiedScript))
            {
                Assert.Fail("Failed to find modified personality test script: " + modifiedScript);
            }

            var originalScriptContents = LuaDecompiler.DecompileScript(File.ReadAllBytes(originalScript));
            var modifiedScriptContents = LuaDecompiler.DecompileScript(File.ReadAllBytes(modifiedScript));

            Assert.AreNotEqual(originalScriptContents, modifiedScriptContents, "The personality test script should be different than what it was before being patched.");
            Assert.IsTrue(modifiedScriptContents.Contains("WINDOW:SysMsg(200000)"), "The modified script should contain 'WINDOW:SysMsg(200000)', which is evidence of Sky Editor's modifications.");
        }