Пример #1
0
 private void RC_ExportData_Click(object sender, RoutedEventArgs e)
 {
     if (ListBox_Main.SelectedIndex >= 0)
     {
         FWindow.FCurrentAsset = ListBox_Main.SelectedItem.ToString();
         AssetsUtility.ExportAssetData();
     }
 }
Пример #2
0
        private static void LoadAsset(string assetPath)
        {
            PakReader.PakReader reader = AssetsUtility.GetPakReader(assetPath);
            if (reader != null)
            {
                List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(assetPath);
                string           jsonData    = AssetsUtility.GetAssetJsonData(reader, entriesList, true);
                FWindow.FMain.Dispatcher.InvokeAsync(() =>
                {
                    FWindow.FMain.AssetPropertiesBox_Main.Text = jsonData;
                    if (FWindow.FMain.MI_AutoExportRaw.IsChecked)
                    {
                        AssetsUtility.ExportAssetData(assetPath);
                    }
                    if (FWindow.FMain.MI_AutoSaveJson.IsChecked)
                    {
                        AssetsUtility.SaveAssetProperties();
                    }
                });

                if (AssetsUtility.IsValidJson(jsonData))
                {
                    dynamic AssetData = JsonConvert.DeserializeObject(jsonData);
                    JToken  AssetMainToken;
                    if (jsonData.StartsWith("[") && jsonData.EndsWith("]"))
                    {
                        JArray AssetArray = JArray.FromObject(AssetData);
                        AssetMainToken = AssetArray[0];
                    }
                    else if (jsonData.StartsWith("{") && jsonData.EndsWith("}"))
                    {
                        AssetMainToken = AssetData;
                    }
                    else
                    {
                        AssetMainToken = null;
                    }


                    if (AssetMainToken != null && AssetMainToken["export_type"] != null && AssetMainToken["properties"] != null)
                    {
                        ExportType = AssetMainToken["export_type"].Value <string>();
                        DrawingVisual VisualImage = null;
                        switch (ExportType)
                        {
                        case "AthenaBackpackItemDefinition":
                        case "AthenaBattleBusItemDefinition":
                        case "AthenaCharacterItemDefinition":
                        case "AthenaConsumableEmoteItemDefinition":
                        case "AthenaSkyDiveContrailItemDefinition":
                        case "AthenaDanceItemDefinition":
                        case "AthenaEmojiItemDefinition":
                        case "AthenaGliderItemDefinition":
                        case "AthenaItemWrapDefinition":
                        case "AthenaLoadingScreenItemDefinition":
                        case "AthenaMusicPackItemDefinition":
                        case "AthenaPetCarrierItemDefinition":
                        case "AthenaPickaxeItemDefinition":
                        case "AthenaSprayItemDefinition":
                        case "AthenaToyItemDefinition":
                        case "AthenaVictoryPoseItemDefinition":
                        case "FortBannerTokenType":
                        case "AthenaGadgetItemDefinition":
                        case "FortWeaponRangedItemDefinition":
                        case "FortWeaponMeleeItemDefinition":
                        case "FortWeaponMeleeDualWieldItemDefinition":
                        case "FortIngredientItemDefinition":
                        case "FortVariantTokenType":
                        case "FortAmmoItemDefinition":
                        case "FortHeroType":
                        case "FortDefenderItemDefinition":
                        case "FortContextTrapItemDefinition":
                        case "FortTrapItemDefinition":
                        case "FortCardPackItemDefinition":
                        case "FortPlaysetGrenadeItemDefinition":
                        case "FortConsumableAccountItemDefinition":
                        case "FortBadgeItemDefinition":
                        case "FortCurrencyItemDefinition":
                        case "FortConversionControlItemDefinition":
                        case "FortHomebaseNodeItemDefinition":
                        case "FortPersonalVehicleItemDefinition":
                        case "FortCampaignHeroLoadoutItemDefinition":
                        case "FortNeverPersistItemDefinition":
                        case "FortPersistentResourceItemDefinition":
                        case "FortResourceItemDefinition":
                        case "FortGadgetItemDefinition":
                        case "FortStatItemDefinition":
                        case "FortTokenType":
                        case "FortDailyRewardScheduleTokenDefinition":
                        case "FortWorkerType":
                        case "FortConditionalResourceItemDefinition":
                        case "FortAwardItemDefinition":
                        case "FortChallengeBundleScheduleDefinition":
                        case "FortAbilityKit":
                        case "FortSchematicItemDefinition":
                        case "FortAccoladeItemDefinition":
                            VisualImage = IconCreator.IconCreator.DrawNormalIconKThx(AssetMainToken["properties"].Value <JArray>());
                            break;

                        case "FortChallengeBundleItemDefinition":
                            VisualImage = IconCreator.IconCreator.DrawChallengeKThx(AssetMainToken["properties"].Value <JArray>(), assetPath);
                            break;
                        }
                        if (VisualImage != null)
                        {
                            ImagesUtility.LoadImageAfterExtraction(VisualImage);
                        }
                    }
                }
            }
        }