From a441bfe92955c2a2be269ad6d9d67098040a44c0 Mon Sep 17 00:00:00 2001 From: Li Date: Wed, 28 Feb 2024 14:01:08 +1300 Subject: [PATCH] Fix spelling of behavior --- McDecryptor/Config.cs | 2 +- McDecryptor/Program.cs | 83 +++++++++++++++++++++++------------------ McDecryptor/default.cfg | 6 +-- 3 files changed, 51 insertions(+), 40 deletions(-) diff --git a/McDecryptor/Config.cs b/McDecryptor/Config.cs index 39aef83..07eb148 100644 --- a/McDecryptor/Config.cs +++ b/McDecryptor/Config.cs @@ -64,7 +64,7 @@ namespace McDecryptor searchModules.Add("skin_packs"); searchModules.Add("world_templates"); searchModules.Add("persona"); - searchModules.Add("behaviour_packs"); + searchModules.Add("behavior_packs"); searchModules.Add("resource"); } private static void rebaseLocalData() diff --git a/McDecryptor/Program.cs b/McDecryptor/Program.cs index 709f9f8..9e8dbcc 100644 --- a/McDecryptor/Program.cs +++ b/McDecryptor/Program.cs @@ -176,7 +176,7 @@ namespace McDecryptor break; } - catch (Exception) { } + catch (Exception e) { Console.WriteLine("Error: " + e.Message); } } @@ -194,51 +194,62 @@ namespace McDecryptor counter++; } - new Thread(() => + + Console.WriteLine("Decrypting: " + cListing.Name); + Directory.CreateDirectory(outFolder); + CopyDirectory(cListing.Path, outFolder); + try { - Console.WriteLine("Decrypting: " + cListing.Name); - Directory.CreateDirectory(outFolder); - CopyDirectory(cListing.Path, outFolder); - try + string levelDatFile = Path.Combine(outFolder, "level.dat"); + string skinsJsonFile = Path.Combine(outFolder, "skins.json"); + string oldSchoolZipe = Path.Combine(outFolder, "content.zipe"); + + Marketplace.DecryptContents(outFolder); + + if (Config.CrackPacks) { - string levelDatFile = Path.Combine(outFolder, "level.dat"); - string skinsJsonFile = Path.Combine(outFolder, "skins.json"); - string oldSchoolZipe = Path.Combine(outFolder, "content.zipe"); + if (File.Exists(oldSchoolZipe)) + Marketplace.CrackZipe(oldSchoolZipe); - Marketplace.DecryptContents(outFolder); + if (File.Exists(levelDatFile)) + Marketplace.CrackLevelDat(levelDatFile); - if (Config.CrackPacks) - { - if (File.Exists(oldSchoolZipe)) - Marketplace.CrackZipe(oldSchoolZipe); - - if (File.Exists(levelDatFile)) - Marketplace.CrackLevelDat(levelDatFile); - - if (File.Exists(skinsJsonFile)) - Marketplace.CrackSkinsJson(skinsJsonFile); - } - - if (Config.ZipPacks) - { - string ext = ""; - if (File.Exists(levelDatFile)) - ext += ".mctemplate"; - else - ext += ".mcpack"; - - ZipFile.CreateFromDirectory(outFolder, outFolder + ext, CompressionLevel.NoCompression, false); - Directory.Delete(outFolder, true); - } + if (File.Exists(skinsJsonFile)) + Marketplace.CrackSkinsJson(skinsJsonFile); } - catch (Exception) + + if (Config.ZipPacks) { - Console.Error.WriteLine("Failed to decrypt: " + cListing.Name); + Console.WriteLine("Zipping: " + cListing.Name); + + string ext = ""; + if (File.Exists(levelDatFile)) + ext += ".mctemplate"; + else if (false) + ext += ".mcaddon"; + else + ext += ".mcpack"; + + string fname = outFolder + ext; + + if (File.Exists(fname)) + File.Delete(fname); + + ZipFile.CreateFromDirectory(outFolder, fname, CompressionLevel.NoCompression, false); Directory.Delete(outFolder, true); } + } + catch (Exception e) + { + Console.Error.WriteLine("Failed to decrypt: " + cListing.Name+ " "+e.Message); + Directory.Delete(outFolder, true); + } + - }).Start(); } + + Console.WriteLine("Finished."); + Console.ReadKey(); } } diff --git a/McDecryptor/default.cfg b/McDecryptor/default.cfg index 01490b8..8bdc072 100644 --- a/McDecryptor/default.cfg +++ b/McDecryptor/default.cfg @@ -28,17 +28,17 @@ RealmsPremiumCache: $LOCALCACHE\premiumcache CrackThePacks: yes # Should i zip packs to .mcpack/.mctemplate -ZipThePacks: no +ZipThePacks: yes # Where to output the decrypted data, (deafult to install into the game) -OutputFolder: $LOCALSTATE\games\com.mojang +OutputFolder: $EXECDIR\output_packs # You can also add more search locations ontop of the default ones. # Do this by using AdditionalSearchDir and a path, it will look there # for packs. # You can use AdditionalModuleDir to add new folders to look for encrypted data inside of the search folders -# normally it'll just look inside say "resource_packs" "skin_packs" "persona" etc +# normally it'll just look inside say "resource_packs" "skin_packs" "persona", "behaviour packs" etc #AdditionalSearchDir: C:\Some\Folder\With\ResourcePacks #AdditionalSearchDir: C:\Some\Other\Folder\With\ResourcePacks