public void FindPAKReferenceInVoicepackAndChangeIntegrationTest() { VoicepackExtended pack = new VoicepackExtended(); pack.LoadFromFile(TestData.VoicepackTheOffice); //Just find Assert.IsTrue(VoicepackCleaner.FindPAKreferenceInVoicepackAndReplace(pack, "HesDead.ogg_System.Byte", null)); //Find and replace Assert.IsTrue(VoicepackCleaner.FindPAKreferenceInVoicepackAndReplace(pack, "HesDead.ogg_System.Byte", "newstring")); //Find replaced string, should not be found Assert.IsFalse(VoicepackCleaner.FindPAKreferenceInVoicepackAndReplace(pack, "HesDead.ogg_System.Byte", null)); //Find new string, should be found Assert.IsTrue(VoicepackCleaner.FindPAKreferenceInVoicepackAndReplace(pack, "newstring", null)); //manually check the right place of the string //should be in HEADSHOT achievement, which is in place 0 //var test = pack.Voicepack.groupManager.achievementList["HEAD_SHOT"].dynamicSounds.sounds[1].pakSoundFile; //Console.WriteLine(test); // pakSoundFile "HesDead.ogg_System.Byte" string HEADSHOT ix 0 // pakSoundPath "RanOver.ogg_System.Byte" string ROAD_KILL ix 3 }
public void FindAndReplacePAKBackupImage() { pack.Voicepack.groupManager.pakBackgroundImage = findMe; Assert.IsTrue(VoicepackCleaner.FindPAKreferenceInVoicepackAndReplace(pack, findMe, replaceWith)); Assert.AreEqual(pack.Voicepack.groupManager.pakBackgroundImage, replaceWith); }
public void FindAndReplaceOldStyleOneSoundPath() { pack.Voicepack.groupManager.achievementList[key] = new AchievementOptions() { pakSoundPath = findMe }; Assert.IsTrue(VoicepackCleaner.FindPAKreferenceInVoicepackAndReplace(pack, findMe, replaceWith)); Assert.AreEqual(pack.Voicepack.groupManager.achievementList[key].pakSoundPath, replaceWith); }
public void FindAndReplaceNewStyleDynamicSounsPath() { var findMe0 = findMe + "0"; var findMe1 = findMe + "1"; var replaceWith1 = replaceWith + "1"; var replaceWith0 = replaceWith + "0"; pack.Voicepack.groupManager.achievementList[key] = VoicepackSampleCreator.CreateDynamicSoundsAchievement(new string[2, 2] { { findMe0, "" }, { findMe1, "" } }); Assert.IsTrue(VoicepackCleaner.FindPAKreferenceInVoicepackAndReplace(pack, findMe1, replaceWith1)); Assert.IsFalse(VoicepackCleaner.FindPAKreferenceInVoicepackAndReplace(pack, findMe1)); Assert.IsTrue(VoicepackCleaner.FindPAKreferenceInVoicepackAndReplace(pack, replaceWith1)); Assert.IsTrue(VoicepackCleaner.FindPAKreferenceInVoicepackAndReplace(pack, findMe0, replaceWith0)); Assert.IsFalse(VoicepackCleaner.FindPAKreferenceInVoicepackAndReplace(pack, findMe0)); Assert.IsTrue(VoicepackCleaner.FindPAKreferenceInVoicepackAndReplace(pack, replaceWith0)); }