private void OpenPatch(string file) { var patches = Directory.GetFiles(MpqArchiveSet.GetGameDirFromReg(), "Data\\wow-update-*.mpq"); var prefix = MpqLocale.GetPrefix(file); foreach (var patch in patches) { // hack due to multiple variants of game world in current client (world.mpq + oldworld.mpq), which can't be used at same time if (patch.Contains("oldworld")) { continue; } bool r = StormLib.SFileOpenPatchArchive(handle, patch, prefix, 0); } }
private void OpenPatch(string file) { var gamedir = MpqArchiveSet.GetGameDirFromReg(); var patches = Directory.GetFiles(gamedir, "Data\\wow-update-*.mpq").ToList(); var prefix = MpqLocale.GetPrefix(file); if (prefix != "base") { patches.RemoveAll(s => s.Contains("base")); var localePatches = Directory.GetFiles(gamedir, String.Format("Data\\{0}\\wow-update-*.mpq", prefix)); patches.AddRange(localePatches); } foreach (var patch in patches) { prefix = MpqLocale.GetPrefix(file); var pref = MpqLocale.GetPrefixForPatch(patch); if (pref != "locale") { prefix = String.Empty; } Console.WriteLine("Adding patch: {0} with prefix {1}", Path.GetFileName(patch), prefix != String.Empty ? "\"" + prefix + "\"" : "\"\""); bool r = StormLib.SFileOpenPatchArchive(handle, patch, prefix, 0); if (!r) { Console.WriteLine("Failed to add patch: {0}", Path.GetFileName(patch)); } else { Console.WriteLine("Added patch: {0}", Path.GetFileName(patch)); } } }