public static string DecryptBinFile(string binFile, string outputFolderPath)
        {
            var binFileWOE = Path.GetFileNameWithoutExtension(binFile);

            Console.Out.WriteLine("Extracting " + binFileWOE + ".bin...");

            var finalOutPath = Path.ChangeExtension(Path.Combine(outputFolderPath, binFile.Substring(binFile.LastIndexOf("GameData\\") + 9)), ".xml");

            Directory.CreateDirectory(Path.GetDirectoryName(finalOutPath));

            using (var outputStream = File.Create(finalOutPath))
            {
                BinaryDecrypter.DecryptBinaryFile(binFile, outputStream);
            }

            return(finalOutPath);
        }
        private string DecryptBinFile(string outputFolderPath, string binFile, string subdir)
        {
            var binFileWOE = Path.GetFileNameWithoutExtension(binFile);

            // Skip profanity as it has no value for us
            if (binFileWOE.StartsWith("profanity", StringComparison.OrdinalIgnoreCase))
            {
                return("");
            }

            var outSubdirs = Path.GetDirectoryName(Path.Combine(outputFolderPath, subdir));

            Console.Out.WriteLine("Extracting " + binFileWOE + ".bin...");

            if (outSubdirs != "")
            {
                Directory.CreateDirectory(outSubdirs);
            }
            var finalOutPath  = Path.Combine(outSubdirs, binFileWOE);
            var finalXmlPath  = finalOutPath + ".xml";
            var finalJsonPath = finalOutPath + ".json";

            using (var outputXmlFile = File.Create(finalXmlPath))
            {
                BinaryDecrypter.DecryptBinaryFile(binFile, outputXmlFile);
            }

            if (string.Equals("world", binFileWOE, StringComparison.OrdinalIgnoreCase) || (!subdir.StartsWith("cluster") && !subdir.StartsWith("templates")))
            {
                var xmlDocument       = new XmlDocument();
                var xmlReaderSettings = new XmlReaderSettings
                {
                    IgnoreComments = true
                };
                var xmlReader = XmlReader.Create(finalXmlPath, xmlReaderSettings);
                xmlDocument.Load(xmlReader);
                File.WriteAllText(finalJsonPath, JsonConvert.SerializeXmlNode(xmlDocument, Newtonsoft.Json.Formatting.Indented, false));
            }

            return(finalOutPath);
        }