public static bool ExtractFile(string from, string to) { try { CASC.SaveFileTo(from, to, LocaleFlags.All); return(true); } catch { return(false); } }
private static void ExtractFile(CASCHandler cascHandler, ulong hash, string file, string dest) { Console.Write("Extracting '{0}'...", file); try { if (hash != 0) { cascHandler.SaveFileTo(hash, dest, file); } else { cascHandler.SaveFileTo(file, dest); } Console.WriteLine(" Ok!"); } catch (Exception exc) { Console.WriteLine($" Error ({exc.Message})!"); Logger.WriteLine(exc.Message); } }
private static void ExtractFile(CASCHandler cascHandler, string file, string dest) { Console.Write("Extracting '{0}'...", file); try { cascHandler.SaveFileTo(file, dest); Console.WriteLine(" Ok!"); } catch (Exception exc) { Console.WriteLine(" Error!"); Logger.WriteLine(exc.Message); } }
static void Main(string[] args) { if (args.Length != 4) { Console.WriteLine("Invalid arguments count!"); Console.WriteLine("Usage: CASCConsole <pattern> <destination> <localeFlags> <contentFlags>"); return; } Console.WriteLine("Settings:"); Console.WriteLine(" WowPath: {0}", Settings.Default.StoragePath); Console.WriteLine(" OnlineMode: {0}", Settings.Default.OnlineMode); Console.WriteLine("Loading..."); BackgroundWorkerEx bgLoader = new BackgroundWorkerEx(); bgLoader.ProgressChanged += BgLoader_ProgressChanged; CASCConfig config = Settings.Default.OnlineMode ? CASCConfig.LoadOnlineStorageConfig(Settings.Default.Product, "us") : CASCConfig.LoadLocalStorageConfig(Settings.Default.StoragePath); CASCHandler cascHandler = CASCHandler.OpenStorage(config, bgLoader); string pattern = args[0]; string dest = args[1]; LocaleFlags locale = (LocaleFlags)Enum.Parse(typeof(LocaleFlags), args[2]); ContentFlags content = (ContentFlags)Enum.Parse(typeof(ContentFlags), args[3]); cascHandler.Root.LoadListFile(Path.Combine(Environment.CurrentDirectory, "listfile.txt"), bgLoader); CASCFolder root = cascHandler.Root.SetFlags(locale, content); Console.WriteLine("Loaded."); Console.WriteLine("Extract params:", pattern, dest, locale); Console.WriteLine(" Pattern: {0}", pattern); Console.WriteLine(" Destination: {0}", dest); Console.WriteLine(" LocaleFlags: {0}", locale); Console.WriteLine(" ContentFlags: {0}", content); Wildcard wildcard = new Wildcard(pattern, true, RegexOptions.IgnoreCase); foreach (var file in root.GetFiles()) { if (wildcard.IsMatch(file.FullName)) { Console.Write("Extracting '{0}'...", file.FullName); try { cascHandler.SaveFileTo(file.FullName, dest); Console.WriteLine(" Ok!"); } catch (Exception exc) { Console.WriteLine(" Error!"); Logger.WriteLine(exc.Message); } } } Console.WriteLine("Extracted."); }
static void Main(string[] args) { //byte[] keyBytes = new byte[16]; //ArmadilloCrypt crypt = new ArmadilloCrypt(keyBytes); //string buildconfigfile = "9f6048f8bd01f38ec0be83f4a9fe5a10"; //byte[] data = File.ReadAllBytes(buildconfigfile); //byte[] IV = buildconfigfile.Substring(16).ToByteArray(); //unsafe //{ // fixed (byte* ptr = keyBytes) // { // for (ulong i = 0; i < ulong.MaxValue; i++) // { // for (ulong j = 0; j < ulong.MaxValue; j++) // { // byte[] decrypted = crypt.DecryptFile(IV, data); // if (decrypted[0] == 0x23 && decrypted[1] == 0x20 && decrypted[2] == 0x42 && decrypted[3] == 0x75) // { // Console.WriteLine("key found: {0} {1} ?", i, j); // } // *(ulong*)ptr = j; // if (j % 1000000 == 0) // Console.WriteLine("{0}/{1}", j, ulong.MaxValue); // } // *(ulong*)(ptr + 8) = i; // } // } //} if (args.Length != 4) { Console.WriteLine("Invalid arguments count!"); Console.WriteLine("Usage: CASCConsole <pattern> <destination> <localeFlags> <contentFlags>"); return; } Console.WriteLine("Settings:"); Console.WriteLine(" WowPath: {0}", Settings.Default.StoragePath); Console.WriteLine(" OnlineMode: {0}", Settings.Default.OnlineMode); Console.WriteLine("Loading..."); BackgroundWorkerEx bgLoader = new BackgroundWorkerEx(); bgLoader.ProgressChanged += BgLoader_ProgressChanged; //CASCConfig.LoadFlags |= LoadFlags.Install; CASCConfig config = Settings.Default.OnlineMode ? CASCConfig.LoadOnlineStorageConfig(Settings.Default.Product, "us") : CASCConfig.LoadLocalStorageConfig(Settings.Default.StoragePath); CASCHandler cascHandler = CASCHandler.OpenStorage(config, bgLoader); string pattern = args[0]; string dest = args[1]; LocaleFlags locale = (LocaleFlags)Enum.Parse(typeof(LocaleFlags), args[2]); ContentFlags content = (ContentFlags)Enum.Parse(typeof(ContentFlags), args[3]); cascHandler.Root.LoadListFile(Path.Combine(Environment.CurrentDirectory, "listfile.txt"), bgLoader); CASCFolder root = cascHandler.Root.SetFlags(locale, content); //cascHandler.Root.MergeInstall(cascHandler.Install); Console.WriteLine("Loaded."); Console.WriteLine("Extract params:"); Console.WriteLine(" Pattern: {0}", pattern); Console.WriteLine(" Destination: {0}", dest); Console.WriteLine(" LocaleFlags: {0}", locale); Console.WriteLine(" ContentFlags: {0}", content); Wildcard wildcard = new Wildcard(pattern, true, RegexOptions.IgnoreCase); foreach (var file in CASCFolder.GetFiles(root.Entries.Select(kv => kv.Value))) { if (wildcard.IsMatch(file.FullName)) { Console.Write("Extracting '{0}'...", file.FullName); try { cascHandler.SaveFileTo(file.FullName, dest); Console.WriteLine(" Ok!"); } catch (Exception exc) { Console.WriteLine(" Error!"); Logger.WriteLine(exc.Message); } } } Console.WriteLine("Extracted."); }