private async Task ResolveOfficialData() { using (var client = new HttpClient()) { // clientTexts var cmd = new JObject(); cmd["cmd"] = "ClientTextMetaDatas"; cmd["languageId"] = JToken.FromObject(LoginConfig.DefaultLanguageId); var clientTexts = await client.PostAsync("http://auth-useu.flyff-legacy.com/Api.ashx", new StringContent(WPDUtil.Transform(cmd.ToString(), "E"))) .Result.Content.ReadAsStringAsync(); ClientTexts = new List <WPDClientTexts>(); var clientTextsObj = JObject.Parse(clientTexts); var texts = new WPDClientTexts(); texts.DeserializeFromBase64String(WPDUtil.UnZipFromBase64(clientTextsObj["clientTexts"].ToObject <string>())); ClientTexts.Add(texts); // systemSettings var systemSettings = await client.PostAsync("http://auth-useu.flyff-legacy.com/Api.ashx", new StringContent("iqj50z9l1no7FFb3DFDCptsx/V6fvA9IWAr0VTncFmssilWtIzfhMbj47ZPYgFUntCBb5rhQDw9Vm/YfciqWSQ==")) .Result.Content.ReadAsStringAsync(); var systemSettingsObj = JObject.Parse(systemSettings); SystemSettings = systemSettingsObj["systemSettings"].ToObject <List <SystemSetting> >(); // gameAssetBundles var assetBundles = await client.PostAsync("http://auth-useu.flyff-legacy.com/Api.ashx", new StringContent("ASLSWps5IKooLJRL3iSyy90lZ/rU9GA2OAtMxIRPymA=")) .Result.Content.ReadAsStringAsync(); var assetBundlesObj = JObject.Parse(assetBundles); GameAssetBundles = assetBundlesObj["gameAssetBundles"].ToObject <List <GameAssetBundle> >(); // imageResources var imageResources = await client.PostAsync("http://auth-useu.flyff-legacy.com/Api.ashx", new StringContent("MsyFTWwwCoXatcd94okYZXz96tp5wnj4u7RfXjYUR9civXXRkEiJtJ7PrssWIN18")) .Result.Content.ReadAsStringAsync(); var imageResourcesObj = JObject.Parse(imageResources); ImageResources = imageResourcesObj["imageResources"].ToObject <List <ImageResource> >(); } }
private async void btnStart_Click(object sender, EventArgs e) { btnStart.Enabled = false; btnBrowse.Enabled = false; rbClientTexts.Enabled = false; rbGameData.Enabled = false; Cursor = Cursors.WaitCursor; ControlBox = false; exitToolStripMenuItem.Enabled = false; if (rbClientTexts.Checked) { foreach (var file in Files) { await Task.Run(() => { using (var stream = new FileStream(file, FileMode.Open)) { var formatter = new BinaryFormatter(); var clientTextsBase64 = (string)formatter.Deserialize(stream); var clientTexts = new WPDClientTexts(); try { clientTexts.DeserializeFromBase64String(clientTextsBase64); } catch (Exception) { MessageBox.Show($"File: {file} was invalid!", "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Warning); } var jsonEncoded = JsonConvert.SerializeObject(clientTexts, Formatting.Indented); var output = Path.Combine(Path.GetDirectoryName(file), Path.GetFileNameWithoutExtension(file) + "_unpacked.json"); using (var outStream = new FileStream(output, FileMode.Create)) using (var writer = new StreamWriter(outStream)) { writer.WriteLine(jsonEncoded); } } }); progressBar.Increment(1); } MessageBox.Show($"Done unpacking {Files.Count} ClientTexts.", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (rbGameData.Checked) { foreach (var file in Files) { await Task.Run(() => { using (var stream = new FileStream(file, FileMode.Open)) { var formatter = new BinaryFormatter(); var gameDataBase64 = (string)formatter.Deserialize(stream); var gameDatas = new WPDGameDatas(); try { gameDatas.DeserializeFromBase64String(gameDataBase64); } catch (Exception) { MessageBox.Show($"File: {file} was invalid!", "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Warning); } var jObj = JObject.FromObject(gameDatas); var output = Path.Combine(Path.GetDirectoryName(file), "GameDatas"); if (!Directory.Exists(output)) { Directory.CreateDirectory(output); } foreach (var obj in jObj) { using (var outStream = new FileStream(Path.Combine(output, $"{obj.Key}.json"), FileMode.Create)) using (var writer = new StreamWriter(outStream)) { writer.WriteLine(obj.Value.ToString()); } } } }); progressBar.Increment(1); } MessageBox.Show($"Done unpacking {Files.Count} GameDatas.", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information); } btnStart.Enabled = true; btnBrowse.Enabled = true; rbClientTexts.Enabled = true; rbGameData.Enabled = true; Cursor = Cursors.Default; ControlBox = true; exitToolStripMenuItem.Enabled = true; }