Esempio n. 1
0
        public static void ExportAssetData(string fPath = null)
        {
            string fullPath = fPath == null?TreeViewUtility.GetFullPath(FWindow.TVItem) + "/" + FWindow.FCurrentAsset : fPath;

            PakReader.PakReader reader = GetPakReader(fullPath);
            if (reader != null)
            {
                List <FPakEntry> entriesList = GetPakEntries(fullPath);
                foreach (FPakEntry entry in entriesList)
                {
                    string path       = FProp.Default.FOutput_Path + "\\Exports\\" + entry.Name;
                    string pWExt      = FoldersUtility.GetFullPathWithoutExtension(entry.Name);
                    string subfolders = pWExt.Substring(0, pWExt.LastIndexOf("/", StringComparison.InvariantCultureIgnoreCase));

                    Directory.CreateDirectory(FProp.Default.FOutput_Path + "\\Exports\\" + subfolders);
                    Stream stream = reader.GetPackageStream(entry);
                    using (var fStream = File.OpenWrite(path))
                        using (stream)
                        {
                            stream.CopyTo(fStream);
                        }

                    if (File.Exists(path))
                    {
                        new UpdateMyConsole(Path.GetFileName(path), CColors.Blue).Append();
                        new UpdateMyConsole(" successfully exported", CColors.White, true).Append();
                    }
                    else //just in case
                    {
                        new UpdateMyConsole("Bruh moment\nCouldn't export ", CColors.White).Append();
                        new UpdateMyConsole(Path.GetFileName(path), CColors.Blue, true).Append();
                    }
                }
            }
        }
Esempio n. 2
0
        private static void DrawImageFromTagData(string assetPath, string quantity, int y, int mode = 0)
        {
            PakReader.PakReader reader = AssetsUtility.GetPakReader(assetPath);
            if (reader != null)
            {
                List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(assetPath);
                string           jsonData    = AssetsUtility.GetAssetJsonData(reader, entriesList);

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

                    if (AssetMainToken != null)
                    {
                        JArray AssetProperties = AssetMainToken["properties"].Value <JArray>();
                        DrawLargeSmallImage(AssetProperties, quantity, y, mode);
                    }
                }
            }
        }
Esempio n. 3
0
        private static string GetAssetInfos(bool isFromDataGrid = false)
        {
            StringBuilder sb = new StringBuilder();

            string fullPath = isFromDataGrid ? FWindow.FCurrentAsset : TreeViewUtility.GetFullPath(FWindow.TVItem) + "/" + FWindow.FCurrentAsset;

            PakReader.PakReader reader = AssetsUtility.GetPakReader(fullPath);
            if (reader != null)
            {
                List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(fullPath);
                foreach (FPakEntry entry in entriesList)
                {
                    sb.Append(
                        "\n- PAK File:\t" + Path.GetFileName(reader.Name) +
                        "\n- Path:\t\t" + entry.Name +
                        "\n- Position:\t" + entry.Pos +
                        "\n- Size:\t\t" + AssetsUtility.GetReadableSize(entry.UncompressedSize) +
                        "\n- Encrypted:\t" + entry.Encrypted +
                        "\n"
                        );
                }
            }

            if (isFromDataGrid)
            {
                string selectedName = fullPath.Substring(fullPath.LastIndexOf("/") + 1);
                if (selectedName.EndsWith(".uasset"))
                {
                    selectedName = selectedName.Substring(0, selectedName.LastIndexOf('.'));
                }
                FWindow.FCurrentAsset = selectedName;
            }
            return(sb.ToString());
        }
Esempio n. 4
0
 public static void DrawWeaponStats(string file, string rowname)
 {
     if (WeaponsStatsArray == null)
     {
         //this will catch the full path if asset exists to be able to grab his PakReader and List<FPakEntry>
         string filepath = AssetEntries.AssetEntriesDict.Where(x => x.Key.Contains("/" + file + ".uasset")).Select(d => d.Key).FirstOrDefault();
         if (!string.IsNullOrEmpty(filepath))
         {
             PakReader.PakReader reader = AssetsUtility.GetPakReader(filepath.Substring(0, filepath.LastIndexOf(".")));
             if (reader != null)
             {
                 List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(filepath.Substring(0, filepath.LastIndexOf(".")));
                 string           jsonData    = AssetsUtility.GetAssetJsonData(reader, entriesList, true);
                 if (AssetsUtility.IsValidJson(jsonData))
                 {
                     dynamic AssetData  = JsonConvert.DeserializeObject(jsonData);
                     JArray  AssetArray = JArray.FromObject(AssetData);
                     WeaponsStatsArray = AssetArray[0]["rows"].Value <JArray>();
                     SearchWeaponStats(rowname);
                 }
             }
         }
     }
     else
     {
         SearchWeaponStats(rowname);
     }
 }
        public static void DrawUserFacingFlag(JToken uFF)
        {
            if (ItemCategoriesArray == null)
            {
                PakReader.PakReader reader = AssetsUtility.GetPakReader("/FortniteGame/Content/Items/ItemCategories");
                if (reader != null)
                {
                    List <FPakEntry> entriesList = AssetsUtility.GetPakEntries("/FortniteGame/Content/Items/ItemCategories");
                    string           jsonData    = AssetsUtility.GetAssetJsonData(reader, entriesList, true);
                    if (AssetsUtility.IsValidJson(jsonData))
                    {
                        dynamic AssetData  = JsonConvert.DeserializeObject(jsonData);
                        JArray  AssetArray = JArray.FromObject(AssetData);
                        JToken  tertiaryCategoriesToken = AssetsUtility.GetPropertyTag <JToken>(AssetArray[0]["properties"].Value <JArray>(), "TertiaryCategories");
                        if (tertiaryCategoriesToken != null)
                        {
                            ItemCategoriesArray = tertiaryCategoriesToken["data"].Value <JArray>();

                            string uFFTargeted = uFF.Value <string>().Substring("Cosmetics.UserFacingFlags.".Length);
                            SearchUserFacingFlag(uFFTargeted);
                        }
                    }
                }
            }
            else
            {
                string uFFTargeted = uFF.Value <string>().Substring("Cosmetics.UserFacingFlags.".Length);
                SearchUserFacingFlag(uFFTargeted);
            }
        }
Esempio n. 6
0
        private static void GetSerieAsset(JToken serieToken, JToken rarityToken)
        {
            //this will catch the full path if asset exists to be able to grab his PakReader and List<FPakEntry>
            string seriesFullPath = AssetEntries.AssetEntriesDict.Where(x => x.Key.ToLowerInvariant().Contains("/" + serieToken.Value <string>().ToLowerInvariant() + ".uasset")).Select(d => d.Key).FirstOrDefault();

            if (!string.IsNullOrEmpty(seriesFullPath))
            {
                string path = seriesFullPath.Substring(0, seriesFullPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase));
                PakReader.PakReader reader = AssetsUtility.GetPakReader(path);
                if (reader != null)
                {
                    List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(path);
                    string           jsonData    = AssetsUtility.GetAssetJsonData(reader, entriesList);

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

                        if (AssetMainToken != null)
                        {
                            JArray propertiesArray = AssetMainToken["properties"].Value <JArray>();
                            if (propertiesArray != null)
                            {
                                JArray colorsArray = AssetsUtility.GetPropertyTagStruct <JArray>(propertiesArray, "Colors", "properties");
                                if (colorsArray != null)
                                {
                                    DrawSerieBackground(colorsArray);
                                }

                                JToken backgroundTextureToken = AssetsUtility.GetPropertyTagText <JToken>(propertiesArray, "BackgroundTexture", "asset_path_name");
                                if (backgroundTextureToken != null)
                                {
                                    string imagePath = FoldersUtility.FixFortnitePath(backgroundTextureToken.Value <string>());
                                    DrawSerieImage(imagePath);
                                }
                            }
                        }
                    }
                }
                else
                {
                    DrawNormalRarity(rarityToken);
                }
            }
            else
            {
                DrawNormalRarity(rarityToken);
            }
        }
Esempio n. 7
0
        private static void DrawFeaturedImage(JArray AssetProperties, string displayAssetPath)
        {
            PakReader.PakReader reader = AssetsUtility.GetPakReader(displayAssetPath);
            if (reader != null)
            {
                List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(displayAssetPath);
                string           jsonData    = AssetsUtility.GetAssetJsonData(reader, entriesList);

                if (AssetsUtility.IsValidJson(jsonData))
                {
                    FWindow.FCurrentAsset = Path.GetFileName(displayAssetPath);

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

                    if (AssetMainToken != null)
                    {
                        JArray displayAssetProperties = AssetMainToken["properties"].Value <JArray>();
                        switch (displayAssetPath.Substring(displayAssetPath.LastIndexOf("/", StringComparison.InvariantCultureIgnoreCase) + 1))
                        {
                        case "DA_Featured_Glider_ID_070_DarkViking":
                        case "DA_Featured_CID_319_Athena_Commando_F_Nautilus":
                            JArray TileImageProperties = AssetsUtility.GetPropertyTagStruct <JArray>(displayAssetProperties, "TileImage", "properties");
                            if (TileImageProperties != null)
                            {
                                DrawFeaturedImageFromDisplayAssetProperty(AssetProperties, TileImageProperties);
                            }
                            break;

                        default:
                            JArray DetailsImageProperties = AssetsUtility.GetPropertyTagStruct <JArray>(displayAssetProperties, "DetailsImage", "properties");
                            if (DetailsImageProperties != null)
                            {
                                DrawFeaturedImageFromDisplayAssetProperty(AssetProperties, DetailsImageProperties);
                            }
                            break;
                        }
                    }
                }
            }
        }
Esempio n. 8
0
        public static void GetHeroPerk(JArray AssetProperties)
        {
            JToken heroGameplayDefinitionToken = AssetsUtility.GetPropertyTagImport <JToken>(AssetProperties, "HeroGameplayDefinition");

            if (heroGameplayDefinitionToken != null)
            {
                string assetPath = AssetEntries.AssetEntriesDict.Where(x => x.Key.ToLowerInvariant().Contains("/" + heroGameplayDefinitionToken.Value <string>().ToLowerInvariant() + ".")).Select(d => d.Key).FirstOrDefault();
                if (!string.IsNullOrEmpty(assetPath))
                {
                    PakReader.PakReader reader = AssetsUtility.GetPakReader(assetPath);
                    if (reader != null)
                    {
                        List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(assetPath.Substring(0, assetPath.Length - ".uasset".Length));
                        string           jsonData    = AssetsUtility.GetAssetJsonData(reader, entriesList);

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

                            if (AssetMainToken != null)
                            {
                                JArray heroGameplayProperties = AssetMainToken["properties"].Value <JArray>();
                                if (heroGameplayProperties != null)
                                {
                                    _borderY = 518;
                                    _textY   = 550;
                                    _imageY  = 519;

                                    DrawHeroPerk(heroGameplayProperties);
                                    DrawTierAbilityKits(heroGameplayProperties);

                                    //RESIZE
                                    IconCreator.ICDrawingContext.DrawRectangle(Brushes.Transparent, null, new Rect(new Point(0, 0), new Size(515, 560 + 35 * 3)));
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 9
0
 private static Dictionary <string, Dictionary <string, string> > GetLocResDict(string LocResPath)
 {
     PakReader.PakReader reader = AssetsUtility.GetPakReader(LocResPath);
     if (reader != null)
     {
         List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(LocResPath);
         foreach (FPakEntry entry in entriesList)
         {
             if (string.Equals(Path.GetExtension(entry.Name.ToLowerInvariant()), ".locres"))
             {
                 using (var s = reader.GetPackageStream(entry))
                     return(new LocResFile(s).Entries);
             }
         }
     }
     return(null);
 }
Esempio n. 10
0
        private void RC_ExportData_Click(object sender, RoutedEventArgs e)
        {
            if (DataGrid_Search.SelectedIndex >= 0)
            {
                FileInfo item         = (FileInfo)DataGrid_Search.SelectedItem;
                string   selectedName = item.Name;
                if (selectedName.EndsWith(".uasset"))
                {
                    selectedName = selectedName.Substring(0, selectedName.LastIndexOf('.'));
                }

                PakReader.PakReader reader = AssetsUtility.GetPakReader(selectedName);
                if (reader != null)
                {
                    List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(selectedName);
                    foreach (FPakEntry entry in entriesList)
                    {
                        string path       = FProp.Default.FOutput_Path + "\\Exports\\" + entry.Name;
                        string pWExt      = FoldersUtility.GetFullPathWithoutExtension(entry.Name);
                        string subfolders = pWExt.Substring(0, pWExt.LastIndexOf("/", StringComparison.InvariantCultureIgnoreCase));

                        Directory.CreateDirectory(FProp.Default.FOutput_Path + "\\Exports\\" + subfolders);
                        Stream stream = reader.GetPackageStream(entry);
                        using (var fStream = File.OpenWrite(path))
                            using (stream)
                            {
                                stream.CopyTo(fStream);
                            }

                        if (File.Exists(path))
                        {
                            new UpdateMyConsole(Path.GetFileName(path), CColors.Blue).Append();
                            new UpdateMyConsole(" successfully exported", CColors.White, true).Append();
                        }
                        else //just in case
                        {
                            new UpdateMyConsole("Bruh moment\nCouldn't export ", CColors.White).Append();
                            new UpdateMyConsole(Path.GetFileName(path), CColors.Blue, true).Append();
                        }
                    }
                }
            }
        }
Esempio n. 11
0
        public static string GetAssetJsonDataByPath(string path, bool loadImageInBox = false, string pathEntries = null)
        {
            string jsonData = null;

            PakReader.PakReader reader = GetPakReader(path);
            if (reader != null)
            {
                List <FPakEntry> entriesList = GetPakEntries(pathEntries != null ? pathEntries : path);
                if (entriesList != null)
                {
                    jsonData = GetAssetJsonData(reader, entriesList, loadImageInBox);
                }
                else
                {
                    DebugHelper.WriteLine("Assets: GetAssetJsonDataByPath -> entriesList -> is empty for {0}", path);
                }
            }
            else
            {
                DebugHelper.WriteLine("Assets: No PakReader found for {0}", path);
            }

            return(jsonData);
        }
Esempio n. 12
0
 public static string GetCosmeticSet(string SetTagName)
 {
     if (ItemSetsArray == null)
     {
         PakReader.PakReader reader = AssetsUtility.GetPakReader("/FortniteGame/Content/Athena/Items/Cosmetics/Metadata/CosmeticSets");
         if (reader != null)
         {
             List <FPakEntry> entriesList = AssetsUtility.GetPakEntries("/FortniteGame/Content/Athena/Items/Cosmetics/Metadata/CosmeticSets");
             string           jsonData    = AssetsUtility.GetAssetJsonData(reader, entriesList, true);
             if (AssetsUtility.IsValidJson(jsonData))
             {
                 dynamic AssetData  = JsonConvert.DeserializeObject(jsonData);
                 JArray  AssetArray = JArray.FromObject(AssetData);
                 ItemSetsArray = AssetArray[0]["rows"].Value <JArray>();
                 return(SearchSetDisplayName(SetTagName));
             }
         }
     }
     else
     {
         return(SearchSetDisplayName(SetTagName));
     }
     return(string.Empty);
 }
Esempio n. 13
0
        private static void LoadPAKFiles(bool bAllPAKs = false)
        {
            if (PAKEntries.PAKEntriesList != null && PAKEntries.PAKEntriesList.Any())
            {
                AssetEntries.ArraySearcher    = new Dictionary <string, FPakEntry[]>();
                AssetEntries.AssetEntriesDict = new Dictionary <string, PakReader.PakReader>();

                //MAIN PAKs LOOP
                foreach (PAKInfosEntry Pak in PAKEntries.PAKEntriesList.Where(x => !x.bTheDynamicPAK))
                {
                    if (!string.IsNullOrEmpty(FProp.Default.FPak_MainAES))
                    {
                        DebugHelper.WriteLine($".PAKs: Loading {Pak.ThePAKPath} with key: {FProp.Default.FPak_MainAES}");

                        byte[] AESKey = AESUtility.StringToByteArray(FProp.Default.FPak_MainAES);
                        PakReader.PakReader reader = null;
                        try
                        {
                            reader = new PakReader.PakReader(Pak.ThePAKPath, AESKey);
                        }
                        catch (Exception ex)
                        {
                            DebugHelper.WriteException(ex, Pak.ThePAKPath);

                            if (string.Equals(ex.Message, "The AES key is invalid"))
                            {
                                UIHelper.DisplayError();
                            }
                            else
                            {
                                new UpdateMyConsole(ex.Message, CColors.Red, true).Append(); return;
                            }
                            break;
                        }

                        if (reader != null)
                        {
                            PAKEntries.PAKToDisplay.Add(Path.GetFileName(Pak.ThePAKPath), reader.FileInfos);

                            if (bAllPAKs)
                            {
                                new UpdateMyProcessEvents($"{Path.GetFileNameWithoutExtension(Pak.ThePAKPath)} mount point: {reader.MountPoint}", "Loading").Update();
                            }
                            foreach (FPakEntry entry in reader.FileInfos)
                            {
                                AssetEntries.AssetEntriesDict[entry.Name] = reader;
                                AssetEntries.ArraySearcher[entry.Name]    = reader.FileInfos;
                            }
                        }
                    }
                }

                //DYNAMIC PAKs LOOP
                foreach (PAKInfosEntry Pak in PAKEntries.PAKEntriesList.Where(x => x.bTheDynamicPAK))
                {
                    byte[] AESKey         = null;
                    string AESFromManager = string.Empty;
                    if (AESEntries.AESEntriesList != null && AESEntries.AESEntriesList.Any())
                    {
                        AESFromManager = AESEntries.AESEntriesList.Where(x => string.Equals(x.ThePAKName, Path.GetFileNameWithoutExtension(Pak.ThePAKPath))).Select(x => x.ThePAKKey).FirstOrDefault();
                        if (!string.IsNullOrEmpty(AESFromManager))
                        {
                            DebugHelper.WriteLine($".PAKs: Loading {Pak.ThePAKPath} with key: {AESFromManager}");
                            AESKey = AESUtility.StringToByteArray(AESFromManager);
                        }
                    }

                    if (AESKey != null)
                    {
                        PakReader.PakReader reader = null;
                        try
                        {
                            reader = new PakReader.PakReader(Pak.ThePAKPath, AESKey);
                        }
                        catch (Exception ex)
                        {
                            DebugHelper.WriteException(ex, Pak.ThePAKPath);

                            if (string.Equals(ex.Message, "The AES key is invalid"))
                            {
                                UIHelper.DisplayError(Path.GetFileNameWithoutExtension(Pak.ThePAKPath), AESFromManager);
                            }
                            else
                            {
                                new UpdateMyConsole(ex.Message, CColors.Red, true).Append(); return;
                            }
                            continue;
                        }

                        if (reader != null)
                        {
                            PAKEntries.PAKToDisplay.Add(Path.GetFileName(Pak.ThePAKPath), reader.FileInfos);

                            if (bAllPAKs)
                            {
                                new UpdateMyProcessEvents($"{Path.GetFileNameWithoutExtension(Pak.ThePAKPath)} mount point: {reader.MountPoint}", "Loading").Update();
                            }
                            foreach (FPakEntry entry in reader.FileInfos)
                            {
                                AssetEntries.AssetEntriesDict[entry.Name] = reader;
                                AssetEntries.ArraySearcher[entry.Name]    = reader.FileInfos;
                            }
                        }
                    }
                    else
                    {
                        DebugHelper.WriteLine($".PAKs: No key found for {Pak.ThePAKPath}");
                    }
                }

                AssetTranslations.SetAssetTranslation(FProp.Default.FLanguage);
            }
        }
Esempio n. 14
0
        public static Stream GetChallengeBundleImage(JArray displayStyleArray)
        {
            JToken customBackgroundToken = AssetsUtility.GetPropertyTag <JToken>(displayStyleArray, "CustomBackground");
            JToken displayImageToken     = AssetsUtility.GetPropertyTag <JToken>(displayStyleArray, "DisplayImage");

            if (customBackgroundToken != null && customBackgroundToken["asset_path_name"] != null && customBackgroundToken["asset_path_name"].Value <string>().EndsWith("_Details"))
            {
                string path = FoldersUtility.FixFortnitePath(customBackgroundToken["asset_path_name"].Value <string>());
                if (!string.IsNullOrEmpty(path))
                {
                    ChallengeIconDesign.isBanner = true;
                    return(AssetsUtility.GetStreamImageFromPath(path));
                }
            }
            else if (displayImageToken != null && displayImageToken["asset_path_name"] != null)
            {
                string path = FoldersUtility.FixFortnitePath(displayImageToken["asset_path_name"].Value <string>());
                if (string.Equals(path, "/FortniteGame/Content/Athena/UI/Challenges/Art/TileImages/M_UI_ChallengeTile_PCB"))
                {
                    PakReader.PakReader reader = AssetsUtility.GetPakReader(path);
                    if (reader != null)
                    {
                        List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(path);
                        string           jsonData    = AssetsUtility.GetAssetJsonData(reader, entriesList);

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

                            if (AssetMainToken != null)
                            {
                                JArray renderSwitchProperties = AssetMainToken["properties"].Value <JArray>();
                                if (renderSwitchProperties != null)
                                {
                                    JArray textureParameterArray = AssetsUtility.GetPropertyTagText <JArray>(renderSwitchProperties, "TextureParameterValues", "data")[0]["struct_type"]["properties"].Value <JArray>();
                                    if (textureParameterArray != null)
                                    {
                                        JToken parameterValueToken = AssetsUtility.GetPropertyTagOuterImport <JToken>(textureParameterArray, "ParameterValue");
                                        if (parameterValueToken != null)
                                        {
                                            string texturePath = FoldersUtility.FixFortnitePath(parameterValueToken.Value <string>());
                                            return(AssetsUtility.GetStreamImageFromPath(texturePath));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                else if (!string.IsNullOrEmpty(path))
                {
                    return(AssetsUtility.GetStreamImageFromPath(path));
                }
            }
            return(Application.GetResourceStream(new Uri("pack://application:,,,/Resources/unknown512.png")).Stream);
        }
Esempio n. 15
0
        private static void DrawBannerIcon(string bannerName, int y)
        {
            //this will catch the full path if asset exists to be able to grab his PakReader and List<FPakEntry>
            string assetPath = AssetEntries.AssetEntriesDict.Where(x => x.Key.Contains("/BannerIcons.uasset")).Select(d => d.Key).FirstOrDefault();

            if (!string.IsNullOrEmpty(assetPath))
            {
                PakReader.PakReader reader = AssetsUtility.GetPakReader(assetPath.Substring(0, assetPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase)));
                if (reader != null)
                {
                    List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(assetPath.Substring(0, assetPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase)));
                    string           jsonData    = AssetsUtility.GetAssetJsonData(reader, entriesList);

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

                        if (AssetMainToken != null)
                        {
                            JArray propertiesArray = AssetMainToken["rows"].Value <JArray>();
                            if (propertiesArray != null)
                            {
                                JArray target = AssetsUtility.GetPropertyTagItemData <JArray>(propertiesArray, bannerName, "properties");
                                if (target != null)
                                {
                                    JToken largeImage = target.Where(x => string.Equals(x["name"].Value <string>(), "LargeImage")).FirstOrDefault();
                                    JToken smallImage = target.Where(x => string.Equals(x["name"].Value <string>(), "SmallImage")).FirstOrDefault();
                                    if (largeImage != null || smallImage != null)
                                    {
                                        JToken assetPathName =
                                            largeImage != null ? largeImage["tag_data"]["asset_path_name"] :
                                            smallImage != null ? smallImage["tag_data"]["asset_path_name"] : null;

                                        if (assetPathName != null)
                                        {
                                            string texturePath = FoldersUtility.FixFortnitePath(assetPathName.Value <string>());
                                            using (Stream image = AssetsUtility.GetStreamImageFromPath(texturePath))
                                            {
                                                if (image != null)
                                                {
                                                    BitmapImage bmp = new BitmapImage();
                                                    bmp.BeginInit();
                                                    bmp.CacheOption  = BitmapCacheOption.OnLoad;
                                                    bmp.StreamSource = image;
                                                    bmp.EndInit();
                                                    bmp.Freeze();

                                                    IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(902, y + 3, 64, 64));
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                BitmapImage bmp = new BitmapImage();
                bmp.BeginInit();
                bmp.CacheOption  = BitmapCacheOption.OnLoad;
                bmp.StreamSource = Application.GetResourceStream(new Uri("pack://application:,,,/Resources/unknown512.png")).Stream;
                bmp.EndInit();
                bmp.Freeze();
                IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(902, y + 3, 64, 64));
            }
        }
Esempio n. 16
0
        /// <summary>
        /// this is kinda complex but at the end it only gets quest files names, counts, rewards, rewards quantity and the unlock type of the quests
        /// and repeat the process if he find stage quests
        /// </summary>
        /// <param name="BundleProperties"></param>
        /// <param name="assetPath"></param>
        private static void GetQuestData(JArray BundleProperties, string assetPath)
        {
            PakReader.PakReader reader = AssetsUtility.GetPakReader(assetPath);
            if (reader != null)
            {
                List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(assetPath);
                string           jsonData    = AssetsUtility.GetAssetJsonData(reader, entriesList);

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

                    if (AssetMainToken != null)
                    {
                        JArray AssetProperties = AssetMainToken["properties"].Value <JArray>();
                        if (AssetProperties != null)
                        {
                            string questDescription = string.Empty;
                            long   questCount       = 0;
                            string unlockType       = string.Empty;
                            string rewardPath       = string.Empty;
                            string rewardQuantity   = string.Empty;

                            //this come from the bundle properties array not the quest properties array
                            JToken questUnlockTypeToken = AssetsUtility.GetPropertyTag <JToken>(BundleProperties, "QuestUnlockType");
                            if (questUnlockTypeToken != null)
                            {
                                unlockType = questUnlockTypeToken.Value <string>();
                            }

                            //objectives array to catch the quest description and quest count
                            JArray objectivesDataArray = AssetsUtility.GetPropertyTagText <JArray>(AssetProperties, "Objectives", "data");
                            if (objectivesDataArray != null)
                            {
                                if (objectivesDataArray[0]["struct_name"] != null && objectivesDataArray[0]["struct_type"] != null && string.Equals(objectivesDataArray[0]["struct_name"].Value <string>(), "FortMcpQuestObjectiveInfo"))
                                {
                                    JArray objectivesDataProperties = objectivesDataArray[0]["struct_type"]["properties"].Value <JArray>();

                                    //this description come from the main quest array (not the objectives array)
                                    JToken description_namespace     = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "Description", "namespace");
                                    JToken description_key           = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "Description", "key");
                                    JToken description_source_string = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "Description", "source_string");
                                    if (description_namespace != null && description_key != null && description_source_string != null)
                                    {
                                        questDescription = AssetTranslations.SearchTranslation(description_namespace.Value <string>(), description_key.Value <string>(), description_source_string.Value <string>());
                                    }
                                    else
                                    {
                                        //this description come from the objectives quest array
                                        description_namespace     = AssetsUtility.GetPropertyTagText <JToken>(objectivesDataProperties, "Description", "namespace");
                                        description_key           = AssetsUtility.GetPropertyTagText <JToken>(objectivesDataProperties, "Description", "key");
                                        description_source_string = AssetsUtility.GetPropertyTagText <JToken>(objectivesDataProperties, "Description", "source_string");
                                        if (description_namespace != null && description_key != null && description_source_string != null)
                                        {
                                            questDescription = AssetTranslations.SearchTranslation(description_namespace.Value <string>(), description_key.Value <string>(), description_source_string.Value <string>());
                                        }
                                    }

                                    if (objectivesDataProperties != null)
                                    {
                                        JToken countToken = AssetsUtility.GetPropertyTag <JToken>(objectivesDataProperties, "Count");
                                        if (countToken != null)
                                        {
                                            questCount = countToken.Value <long>();
                                            JToken objectiveCompletionCountToken = AssetsUtility.GetPropertyTag <JToken>(AssetProperties, "ObjectiveCompletionCount");
                                            if (objectiveCompletionCountToken != null)
                                            {
                                                questCount = objectiveCompletionCountToken.Value <long>();
                                            }
                                        }
                                    }
                                }
                            }

                            //rewards array to catch the reward name (not path) and the quantity
                            JArray rewardsDataArray       = AssetsUtility.GetPropertyTagText <JArray>(AssetProperties, "Rewards", "data");
                            JArray hiddenRewardsDataArray = AssetsUtility.GetPropertyTagText <JArray>(AssetProperties, "HiddenRewards", "data");
                            if (rewardsDataArray != null)
                            {
                                if (rewardsDataArray[0]["struct_name"] != null && rewardsDataArray[0]["struct_type"] != null && string.Equals(rewardsDataArray[0]["struct_name"].Value <string>(), "FortItemQuantityPair"))
                                {
                                    try
                                    {
                                        //checking the whole array for the reward
                                        //ignoring all Quest and Token until he find the reward
                                        JToken targetChecker = rewardsDataArray.Where(x =>
                                                                                      !string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value <string>(), "Quest") &&
                                                                                      !string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value <string>(), "Token"))
                                                               .FirstOrDefault()["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][1]["tag_data"];

                                        //checking the whole array for the reward quantity
                                        //ignoring all Quest and Token until he find the reward quantity
                                        JToken targetQuantity = rewardsDataArray.Where(x =>
                                                                                       !string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value <string>(), "Quest") &&
                                                                                       !string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value <string>(), "Token"))
                                                                .FirstOrDefault()["struct_type"]["properties"][1]["tag_data"];

                                        if (targetChecker != null)
                                        {
                                            //this will catch the full path if asset exists to be able to grab his PakReader and List<FPakEntry>
                                            string primaryAssetNameFullPath = AssetEntries.AssetEntriesDict.Where(x => x.Key.ToLowerInvariant().Contains("/" + targetChecker.Value <string>().ToLowerInvariant() + ".uasset")).Select(d => d.Key).FirstOrDefault();
                                            if (!string.IsNullOrEmpty(primaryAssetNameFullPath))
                                            {
                                                rewardPath = primaryAssetNameFullPath.Substring(0, primaryAssetNameFullPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase));
                                            }

                                            if (targetQuantity != null)
                                            {
                                                rewardQuantity = targetQuantity.Value <string>();
                                            }

                                            BundleInfosEntry currentData = new BundleInfosEntry(questDescription, questCount, unlockType, rewardPath, rewardQuantity);
                                            if (!BundleData.Any(item => item.TheQuestDescription.Equals(currentData.TheQuestDescription, StringComparison.InvariantCultureIgnoreCase) && item.TheQuestCount == currentData.TheQuestCount))
                                            {
                                                BundleData.Add(currentData);
                                            }
                                        }
                                        else
                                        {
                                            BundleInfosEntry currentData = new BundleInfosEntry(questDescription, questCount, unlockType, "", "");
                                            if (!BundleData.Any(item => item.TheQuestDescription.Equals(currentData.TheQuestDescription, StringComparison.InvariantCultureIgnoreCase) && item.TheQuestCount == currentData.TheQuestCount))
                                            {
                                                BundleData.Add(currentData);
                                            }
                                        }
                                    }
                                    catch (Exception)
                                    {
                                        if (hiddenRewardsDataArray != null)
                                        {
                                            if (hiddenRewardsDataArray[0]["struct_name"] != null && hiddenRewardsDataArray[0]["struct_type"] != null && string.Equals(hiddenRewardsDataArray[0]["struct_name"].Value <string>(), "FortHiddenRewardQuantityPair"))
                                            {
                                                JArray hiddenRewardPropertiesArray = hiddenRewardsDataArray[0]["struct_type"]["properties"].Value <JArray>();
                                                if (hiddenRewardPropertiesArray != null)
                                                {
                                                    JToken templateIdToken = AssetsUtility.GetPropertyTag <JToken>(hiddenRewardPropertiesArray, "TemplateId");
                                                    if (templateIdToken != null)
                                                    {
                                                        rewardPath = templateIdToken.Value <string>();
                                                    }

                                                    //reward quantity (if 1, this won't be displayed)
                                                    JToken hiddenQuantityToken = AssetsUtility.GetPropertyTag <JToken>(hiddenRewardPropertiesArray, "Quantity");
                                                    if (hiddenQuantityToken != null)
                                                    {
                                                        rewardQuantity = hiddenQuantityToken.Value <string>();
                                                    }

                                                    BundleInfosEntry currentData = new BundleInfosEntry(questDescription, questCount, unlockType, rewardPath, rewardQuantity);
                                                    if (!BundleData.Any(item => item.TheQuestDescription.Equals(currentData.TheQuestDescription, StringComparison.InvariantCultureIgnoreCase) && item.TheQuestCount == currentData.TheQuestCount))
                                                    {
                                                        BundleData.Add(currentData);
                                                    }
                                                }
                                            }
                                        }
                                        else
                                        {
                                            BundleInfosEntry currentData = new BundleInfosEntry(questDescription, questCount, unlockType, "", "");
                                            if (!BundleData.Any(item => item.TheQuestDescription.Equals(currentData.TheQuestDescription, StringComparison.InvariantCultureIgnoreCase) && item.TheQuestCount == currentData.TheQuestCount))
                                            {
                                                BundleData.Add(currentData);
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                BundleInfosEntry currentData = new BundleInfosEntry(questDescription, questCount, unlockType, "", "");
                                if (!BundleData.Any(item => item.TheQuestDescription.Equals(currentData.TheQuestDescription, StringComparison.InvariantCultureIgnoreCase) && item.TheQuestCount == currentData.TheQuestCount))
                                {
                                    BundleData.Add(currentData);
                                }
                            }

                            //catch stage AFTER adding the current quest to the list
                            if (rewardsDataArray != null)
                            {
                                foreach (JToken token in rewardsDataArray)
                                {
                                    JToken targetChecker = token["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"];
                                    if (targetChecker != null && string.Equals(targetChecker.Value <string>(), "Quest"))
                                    {
                                        JToken primaryAssetNameToken = token["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][1]["tag_data"];
                                        if (primaryAssetNameToken != null)
                                        {
                                            //this will catch the full path if asset exists to be able to grab his PakReader and List<FPakEntry>
                                            string primaryAssetNameFullPath = AssetEntries.AssetEntriesDict.Where(x => x.Key.Contains("/" + primaryAssetNameToken.Value <string>())).Select(d => d.Key).FirstOrDefault();
                                            if (!string.IsNullOrEmpty(primaryAssetNameFullPath))
                                            {
                                                new UpdateMyProcessEvents(System.IO.Path.GetFileNameWithoutExtension(primaryAssetNameFullPath), "Waiting").Update();
                                                GetQuestData(BundleProperties, primaryAssetNameFullPath.Substring(0, primaryAssetNameFullPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase)));
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 17
0
        private static void DrawNormalIcon(string path, string quantity, int y, int mode = 0)
        {
            PakReader.PakReader reader = AssetsUtility.GetPakReader(path);
            if (reader != null)
            {
                List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(path);
                string           jsonData    = AssetsUtility.GetAssetJsonData(reader, entriesList);

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

                    if (AssetMainToken != null)
                    {
                        JArray propertiesArray = AssetMainToken["properties"].Value <JArray>();
                        if (propertiesArray != null)
                        {
                            JToken heroToken   = AssetsUtility.GetPropertyTagImport <JToken>(propertiesArray, "HeroDefinition");
                            JToken weaponToken = AssetsUtility.GetPropertyTagImport <JToken>(propertiesArray, "WeaponDefinition");
                            if (heroToken != null)
                            {
                                //this will catch the full path if asset exists to be able to grab his PakReader and List<FPakEntry>
                                string assetPath = AssetEntries.AssetEntriesDict.Where(x => x.Key.ToLowerInvariant().Contains("/" + heroToken.Value <string>().ToLowerInvariant() + ".uasset")).Select(d => d.Key).FirstOrDefault();
                                if (!string.IsNullOrEmpty(assetPath))
                                {
                                    DrawImageFromTagData(assetPath.Substring(0, assetPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase)), quantity, y, mode);
                                }
                            }
                            else if (weaponToken != null)
                            {
                                string weaponName = weaponToken.Value <string>();
                                if (weaponToken.Value <string>().Equals("WID_Harvest_Pickaxe_STWCosmetic_Tier")) //STW PICKAXES MANUAL FIX
                                {
                                    weaponName = "WID_Harvest_Pickaxe_STWCosmetic_Tier_" + FWindow.FCurrentAsset.Substring(FWindow.FCurrentAsset.Length - 1);
                                }

                                //this will catch the full path if asset exists to be able to grab his PakReader and List<FPakEntry>
                                string assetPath = AssetEntries.AssetEntriesDict.Where(x => x.Key.ToLowerInvariant().Contains("/" + weaponName.ToLowerInvariant() + ".uasset")).Select(d => d.Key).FirstOrDefault();
                                if (!string.IsNullOrEmpty(assetPath))
                                {
                                    DrawImageFromTagData(assetPath.Substring(0, assetPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase)), quantity, y, mode);
                                }
                            }
                            else
                            {
                                DrawLargeSmallImage(propertiesArray, quantity, y, mode);
                            }
                        }
                    }
                }
            }
            else
            {
                BitmapImage bmp = new BitmapImage();
                bmp.BeginInit();
                bmp.CacheOption  = BitmapCacheOption.OnLoad;
                bmp.StreamSource = Application.GetResourceStream(new Uri("pack://application:,,,/Resources/unknown512.png")).Stream;
                bmp.EndInit();
                bmp.Freeze();
                IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(902, y + 3, 64, 64));
            }
        }
Esempio n. 18
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);
                        }
                    }
                }
            }
        }
Esempio n. 19
0
        public static string GetAssetJsonData(PakReader.PakReader reader, IEnumerable <FPakEntry> entriesList, bool loadImageInBox = false)
        {
            var currentFileName = Path.GetFileName(entriesList.ElementAt(0).Name.Replace(".uasset", "").Replace(".uexp", "").Replace(".ubulk", ""));

            DebugHelper.WriteLine("Assets: Gathering info about {0}", entriesList.ElementAt(0).Name);

            Stream[] AssetStreamArray = new Stream[3];

            foreach (FPakEntry entry in entriesList)
            {
                switch (Path.GetExtension(entry.Name.ToLowerInvariant()))
                {
                case ".ini":
                    /* FWindow.FMain.Dispatcher.InvokeAsync(() =>
                     * {
                     *   FWindow.FMain.AssetPropertiesBox_Main.SyntaxHighlighting = ResourceLoader.LoadHighlightingDefinition("Ini.xshd");
                     * });*/
                    using (var s = reader.GetPackageStream(entry))
                        using (var r = new StreamReader(s))
                            return(r.ReadToEnd());

                case ".uproject":
                case ".uplugin":
                case ".upluginmanifest":
                    using (var s = reader.GetPackageStream(entry))
                        using (var r = new StreamReader(s))
                            return(r.ReadToEnd());

                case ".locmeta":
                    using (var s = reader.GetPackageStream(entry))
                        return(JsonConvert.SerializeObject(new LocMetaFile(s), Formatting.Indented));

                case ".locres":
                    using (var s = reader.GetPackageStream(entry))
                        return(JsonConvert.SerializeObject(new LocResFile(s).Entries, Formatting.Indented));

                case ".udic":
                    using (var s = reader.GetPackageStream(entry))
                        using (var r = new BinaryReader(s))
                            return(JsonConvert.SerializeObject(new UDicFile(r).Header, Formatting.Indented));

                case ".bin":
                    if (string.Equals(entry.Name, "/FortniteGame/AssetRegistry.bin") || !entry.Name.Contains("AssetRegistry"))     //MEMORY ISSUE
                    {
                        break;
                    }

                    using (var s = reader.GetPackageStream(entry))
                        return(JsonConvert.SerializeObject(new AssetRegistryFile(s), Formatting.Indented));

                default:
                    if (entry.Name.EndsWith(".uasset"))
                    {
                        AssetStreamArray[0] = reader.GetPackageStream(entry);
                    }

                    if (entry.Name.EndsWith(".uexp"))
                    {
                        AssetStreamArray[1] = reader.GetPackageStream(entry);
                    }

                    if (entry.Name.EndsWith(".ubulk"))
                    {
                        AssetStreamArray[2] = reader.GetPackageStream(entry);
                    }
                    break;
                }
            }

            AssetReader ar = GetAssetReader(AssetStreamArray);

            if (ar != null)
            {
                if (loadImageInBox)
                {
                    foreach (ExportObject eo in ar.Exports)
                    {
                        switch (eo)
                        {
                        case Texture2D texture:
                            SKImage image = texture.GetImage();
                            if (image != null)
                            {
                                using (var data = image.Encode())
                                    using (var stream = data.AsStream())
                                    {
                                        /*
                                         * using (Image img = ImagesUtility.GetImageSource(stream))
                                         * {
                                         *  img.Save(FProp.FOutput_Path + "\\Icons\\"+ currentFileName+".png");
                                         *
                                         * }*/
                                        /*  FWindow.FMain.Dispatcher.InvokeAsync(() =>
                                         * {
                                         *    FWindow.FMain.ImageBox_Main.Source = BitmapFrame.Create((BitmapSource)img); //thread safe and fast af
                                         *
                                         *    if (FWindow.FMain.MI_Auto_Save_Images.IsChecked) //auto save images
                                         *    {
                                         *        ImagesUtility.SaveImage(FProp.Default.FOutput_Path + "\\Icons\\" + FWindow.FCurrentAsset + ".png");
                                         *    }
                                         * });*/
                                    }
                            }
                            return(JsonConvert.SerializeObject(texture.textures, Formatting.Indented));

                        case USoundWave sound:
                            using (sound)
                            {
                                byte[] s = readSound(sound);
                                if (s != null)
                                {
                                    //   string path = FProp.FOutput_Path + "\\Sounds\\" + FWindow.FCurrentAsset + ".ogg";
                                    //     File.WriteAllBytes(path, s);

                                    //open sound

                                    /*    if (FProp.Default.FOpenSounds)
                                     *  {
                                     *      FoldersUtility.OpenWithDefaultProgram(path);
                                     *  }*/
                                }

                                GC.Collect();
                                GC.WaitForPendingFinalizers();
                                return(JsonConvert.SerializeObject(sound.base_object, Formatting.Indented));
                            }
                        }
                    }
                }

                string stringData = JsonConvert.SerializeObject(ar.Exports, Formatting.Indented);



                return(stringData);
            }

            return(string.Empty);
        }
Esempio n. 20
0
        public static void DrawIconAmmoData(string path)
        {
            PakReader.PakReader reader = AssetsUtility.GetPakReader(path);
            if (reader != null)
            {
                List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(path);
                string           jsonData    = AssetsUtility.GetAssetJsonData(reader, entriesList);

                if (AssetsUtility.IsValidJson(jsonData))
                {
                    dynamic AssetData = JsonConvert.DeserializeObject(jsonData);
                    JToken  AssetAmmo = JArray.FromObject(AssetData)[0];

                    JToken largePreviewImage = AssetAmmo["properties"].Value <JArray>().Where(x => string.Equals(x["name"].Value <string>(), "LargePreviewImage")).FirstOrDefault();
                    JToken smallPreviewImage = AssetAmmo["properties"].Value <JArray>().Where(x => string.Equals(x["name"].Value <string>(), "SmallPreviewImage")).FirstOrDefault();
                    if (largePreviewImage != null || smallPreviewImage != null)
                    {
                        JToken assetPathName =
                            largePreviewImage != null ? largePreviewImage["tag_data"]["asset_path_name"] :
                            smallPreviewImage != null ? smallPreviewImage["tag_data"]["asset_path_name"] : null;

                        if (assetPathName != null)
                        {
                            string texturePath = FoldersUtility.FixFortnitePath(assetPathName.Value <string>());
                            using (Stream image = AssetsUtility.GetStreamImageFromPath(texturePath))
                            {
                                if (image != null)
                                {
                                    BitmapImage bmp = new BitmapImage();
                                    bmp.BeginInit();
                                    bmp.CacheOption  = BitmapCacheOption.OnLoad;
                                    bmp.StreamSource = image;
                                    bmp.EndInit();
                                    bmp.Freeze();

                                    //RESIZE
                                    IconCreator.ICDrawingContext.DrawRectangle(Brushes.Transparent, null, new Rect(new Point(0, 0), new Size(515, 560)));

                                    //background
                                    IconCreator.ICDrawingContext.DrawRectangle(new SolidColorBrush(ImagesUtility.ParseColorFromHex("#6D6D6D")), null, new Rect(0, 518, 515, 34));

                                    JToken name_namespace     = AssetsUtility.GetPropertyTagText <JToken>(AssetAmmo["properties"].Value <JArray>(), "DisplayName", "namespace");
                                    JToken name_key           = AssetsUtility.GetPropertyTagText <JToken>(AssetAmmo["properties"].Value <JArray>(), "DisplayName", "key");
                                    JToken name_source_string = AssetsUtility.GetPropertyTagText <JToken>(AssetAmmo["properties"].Value <JArray>(), "DisplayName", "source_string");
                                    if (name_namespace != null && name_key != null && name_source_string != null)
                                    {
                                        string displayName = AssetTranslations.SearchTranslation(name_namespace.Value <string>(), name_key.Value <string>(), name_source_string.Value <string>());

                                        Typeface typeface = new Typeface(TextsUtility.FBurbank, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);

                                        FormattedText formattedText =
                                            new FormattedText(
                                                displayName.ToUpperInvariant(),
                                                CultureInfo.CurrentUICulture,
                                                FlowDirection.LeftToRight,
                                                typeface,
                                                25,
                                                Brushes.White,
                                                IconCreator.PPD
                                                );
                                        formattedText.TextAlignment = TextAlignment.Center;
                                        formattedText.MaxTextWidth  = 515;
                                        formattedText.MaxLineCount  = 1;

                                        Point textLocation = new Point(0, 550 - formattedText.Height);

                                        IconCreator.ICDrawingContext.DrawText(formattedText, textLocation);
                                    }

                                    IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(9, 519, 32, 32));
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 21
0
        private static void DrawFeaturedImageFromDisplayAssetProperty(JArray AssetProperties, JArray displayAssetProperties)
        {
            JToken resourceObjectOuterImportToken = AssetsUtility.GetPropertyTagOuterImport <JToken>(displayAssetProperties, "ResourceObject");
            JToken resourceObjectImportToken      = AssetsUtility.GetPropertyTagImport <JToken>(displayAssetProperties, "ResourceObject");

            if (resourceObjectOuterImportToken != null && resourceObjectOuterImportToken.Value <string>() != null)
            {
                string texturePath = FoldersUtility.FixFortnitePath(resourceObjectOuterImportToken.Value <string>());
                if (texturePath.Contains("/FortniteGame/Content/Athena/Prototype/Textures/"))
                {
                    DrawIconImage(AssetProperties, false);
                }
                else
                {
                    using (Stream image = AssetsUtility.GetStreamImageFromPath(texturePath))
                    {
                        if (image != null)
                        {
                            BitmapImage bmp = new BitmapImage();
                            bmp.BeginInit();
                            bmp.CacheOption  = BitmapCacheOption.OnLoad;
                            bmp.StreamSource = image;
                            bmp.EndInit();
                            bmp.Freeze();

                            IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(3, 3, 509, 509));
                        }
                    }

                    if (AssetsLoader.ExportType == "AthenaItemWrapDefinition" && texturePath.Contains("WeaponRenders"))
                    {
                        DrawAdditionalWrapImage(AssetProperties);
                    }
                }
            }
            else if (resourceObjectImportToken != null)
            {
                //this will catch the full path if asset exists to be able to grab his PakReader and List<FPakEntry>
                string renderSwitchPath = AssetEntries.AssetEntriesDict.Where(x => x.Key.Contains("/" + resourceObjectImportToken.Value <string>())).Select(d => d.Key).FirstOrDefault();
                if (!string.IsNullOrEmpty(renderSwitchPath))
                {
                    if (renderSwitchPath.Contains("MI_UI_FeaturedRenderSwitch_") ||
                        renderSwitchPath.Contains("M-Wraps-StreetDemon") ||
                        renderSwitchPath.Contains("/FortniteGame/Content/UI/Foundation/Textures/Icons/Wraps/FeaturedMaterials/"))
                    {
                        PakReader.PakReader reader = AssetsUtility.GetPakReader(renderSwitchPath.Substring(0, renderSwitchPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase)));
                        if (reader != null)
                        {
                            List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(renderSwitchPath.Substring(0, renderSwitchPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase)));
                            string           jsonData    = AssetsUtility.GetAssetJsonData(reader, entriesList);

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

                                if (AssetMainToken != null)
                                {
                                    JArray renderSwitchProperties = AssetMainToken["properties"].Value <JArray>();
                                    if (renderSwitchProperties != null)
                                    {
                                        JArray textureParameterArray = AssetsUtility.GetPropertyTagText <JArray>(renderSwitchProperties, "TextureParameterValues", "data")[0]["struct_type"]["properties"].Value <JArray>();
                                        if (textureParameterArray != null)
                                        {
                                            JToken parameterValueToken = AssetsUtility.GetPropertyTagOuterImport <JToken>(textureParameterArray, "ParameterValue");
                                            if (parameterValueToken != null)
                                            {
                                                string texturePath = FoldersUtility.FixFortnitePath(parameterValueToken.Value <string>());
                                                using (Stream image = AssetsUtility.GetStreamImageFromPath(texturePath))
                                                {
                                                    if (image != null)
                                                    {
                                                        BitmapImage bmp = new BitmapImage();
                                                        bmp.BeginInit();
                                                        bmp.CacheOption  = BitmapCacheOption.OnLoad;
                                                        bmp.StreamSource = image;
                                                        bmp.EndInit();
                                                        bmp.Freeze();

                                                        IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(3, 3, 509, 509));
                                                    }
                                                }

                                                if (AssetsLoader.ExportType == "AthenaItemWrapDefinition" && texturePath.Contains("WeaponRenders"))
                                                {
                                                    DrawAdditionalWrapImage(AssetProperties);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 22
0
        private static void DrawAbilityKit(string assetPath)
        {
            if (!string.IsNullOrEmpty(assetPath))
            {
                PakReader.PakReader reader = AssetsUtility.GetPakReader(assetPath);
                if (reader != null)
                {
                    List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(assetPath);
                    string           jsonData    = AssetsUtility.GetAssetJsonData(reader, entriesList);

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

                        if (AssetMainToken != null)
                        {
                            JArray abilityKitProperties = AssetMainToken["properties"].Value <JArray>();
                            if (abilityKitProperties != null)
                            {
                                JToken name_namespace     = AssetsUtility.GetPropertyTagText <JToken>(abilityKitProperties, "DisplayName", "namespace");
                                JToken name_key           = AssetsUtility.GetPropertyTagText <JToken>(abilityKitProperties, "DisplayName", "key");
                                JToken name_source_string = AssetsUtility.GetPropertyTagText <JToken>(abilityKitProperties, "DisplayName", "source_string");

                                JArray iconBrushArray = AssetsUtility.GetPropertyTagStruct <JArray>(abilityKitProperties, "IconBrush", "properties");
                                if (iconBrushArray != null)
                                {
                                    JToken resourceObjectToken = AssetsUtility.GetPropertyTagOuterImport <JToken>(iconBrushArray, "ResourceObject");
                                    if (resourceObjectToken != null)
                                    {
                                        string texturePath = FoldersUtility.FixFortnitePath(resourceObjectToken.Value <string>());
                                        using (Stream image = AssetsUtility.GetStreamImageFromPath(texturePath))
                                        {
                                            if (image != null)
                                            {
                                                BitmapImage bmp = new BitmapImage();
                                                bmp.BeginInit();
                                                bmp.CacheOption  = BitmapCacheOption.OnLoad;
                                                bmp.StreamSource = image;
                                                bmp.EndInit();
                                                bmp.Freeze();

                                                //background
                                                IconCreator.ICDrawingContext.DrawRectangle(new SolidColorBrush(ImagesUtility.ParseColorFromHex("#6D6D6D")), null, new Rect(0, _borderY, 515, 34));

                                                if (name_namespace != null && name_key != null && name_source_string != null)
                                                {
                                                    string displayName = AssetTranslations.SearchTranslation(name_namespace.Value <string>(), name_key.Value <string>(), name_source_string.Value <string>());

                                                    Typeface typeface = new Typeface(TextsUtility.FBurbank, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);

                                                    FormattedText formattedText =
                                                        new FormattedText(
                                                            displayName.ToUpperInvariant(),
                                                            CultureInfo.CurrentUICulture,
                                                            FlowDirection.LeftToRight,
                                                            typeface,
                                                            25,
                                                            Brushes.White,
                                                            IconCreator.PPD
                                                            );
                                                    formattedText.TextAlignment = TextAlignment.Left;
                                                    formattedText.MaxTextWidth  = 515;
                                                    formattedText.MaxLineCount  = 1;

                                                    Point textLocation = new Point(50, _textY - formattedText.Height);

                                                    IconCreator.ICDrawingContext.DrawText(formattedText, textLocation);
                                                }

                                                IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(9, _imageY, 32, 32));

                                                _borderY += 37;
                                                _textY   += 37;
                                                _imageY  += 37;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 23
0
        private static void GetPAKsFileInfos()
        {
            if (PAKEntries.PAKEntriesList != null && PAKEntries.PAKEntriesList.Any())
            {
                new UpdateMyProcessEvents($"Writing {Path.GetFileName(BACKUP_FILE_PATH)}", "Waiting").Update();
                Directory.CreateDirectory(Path.GetDirectoryName(BACKUP_FILE_PATH));

                using (FileStream fileStream = new FileStream(BACKUP_FILE_PATH, FileMode.Create))
                    using (BinaryWriter writer = new BinaryWriter(fileStream))
                    {
                        DebugHelper.WriteLine("Backup: Gathering info about local .PAK files");
                        foreach (PAKInfosEntry Pak in PAKEntries.PAKEntriesList)
                        {
                            byte[] AESKey = null;
                            if (Pak.bTheDynamicPAK)
                            {
                                if (AESEntries.AESEntriesList != null && AESEntries.AESEntriesList.Any())
                                {
                                    string AESFromManager = AESEntries.AESEntriesList.Where(x => string.Equals(x.ThePAKName, Path.GetFileNameWithoutExtension(Pak.ThePAKPath))).Select(x => x.ThePAKKey).FirstOrDefault();
                                    if (!string.IsNullOrEmpty(AESFromManager))
                                    {
                                        AESKey = AESUtility.StringToByteArray(AESFromManager);
                                    }
                                }
                            }
                            else
                            {
                                AESKey = AESUtility.StringToByteArray(FProp.Default.FPak_MainAES);
                            }

                            if (AESKey != null)
                            {
                                DebugHelper.WriteLine($".PAKs: Backing up {Pak.ThePAKPath} with key: {BitConverter.ToString(AESKey).Replace("-", string.Empty)}");

                                PakReader.PakReader reader = new PakReader.PakReader(Pak.ThePAKPath, AESKey);
                                if (reader != null)
                                {
                                    new UpdateMyProcessEvents($"{Path.GetFileNameWithoutExtension(Pak.ThePAKPath)} mount point: {reader.MountPoint}", "Waiting").Update();

                                    foreach (FPakEntry entry in reader.FileInfos)
                                    {
                                        writer.Write(entry.Offset);
                                        writer.Write(entry.Size);
                                        writer.Write(entry.UncompressedSize);
                                        writer.Write(entry.Encrypted);
                                        writer.Write(entry.StructSize);
                                        writer.Write(entry.Name);
                                        writer.Write(entry.CompressionMethodIndex);
                                    }
                                }
                            }
                            else
                            {
                                DebugHelper.WriteLine($".PAKs: Not backing up {Pak.ThePAKPath} because its key is empty");
                            }
                        }
                    }

                if (new FileInfo(BACKUP_FILE_PATH).Length > 0) //HENCE WE CHECK THE LENGTH
                {
                    DebugHelper.WriteLine($".PAKs: \\Backups\\{Path.GetFileName(BACKUP_FILE_PATH)} successfully created");
                    new UpdateMyProcessEvents($"\\Backups\\{Path.GetFileName(BACKUP_FILE_PATH)} successfully created", "Success").Update();
                }
                else
                {
                    DebugHelper.WriteLine("Backup: File created is empty");

                    File.Delete(BACKUP_FILE_PATH); //WE DELETE THE EMPTY FILE CREATED
                    new UpdateMyProcessEvents($"Error while creating {Path.GetFileName(BACKUP_FILE_PATH)}", "Error").Update();
                }
            }
        }
Esempio n. 24
0
        public static Stream GetStreamImageFromPath(string AssetFullPath)
        {
            PakReader.PakReader reader = GetPakReader(AssetFullPath);
            if (reader != null)
            {
                List <FPakEntry> entriesList      = GetPakEntries(AssetFullPath);
                Stream[]         AssetStreamArray = new Stream[3];
                foreach (FPakEntry entry in entriesList)
                {
                    switch (Path.GetExtension(entry.Name.ToLowerInvariant()))
                    {
                    case ".ini":
                        break;

                    case ".uproject":
                    case ".uplugin":
                    case ".upluginmanifest":
                        break;

                    case ".locmeta":
                        break;

                    case ".locres":
                        break;

                    case ".udic":
                        break;

                    case ".bin":
                        break;

                    default:
                        if (entry.Name.EndsWith(".uasset"))
                        {
                            AssetStreamArray[0] = reader.GetPackageStream(entry);
                        }

                        if (entry.Name.EndsWith(".uexp"))
                        {
                            AssetStreamArray[1] = reader.GetPackageStream(entry);
                        }

                        if (entry.Name.EndsWith(".ubulk"))
                        {
                            AssetStreamArray[2] = reader.GetPackageStream(entry);
                        }
                        break;
                    }
                }

                AssetReader ar = GetAssetReader(AssetStreamArray);
                if (ar != null)
                {
                    ExportObject eo = ar.Exports.FirstOrDefault(x => x is Texture2D);
                    if (eo != null)
                    {
                        SKImage image = ((Texture2D)eo).GetImage();
                        if (image != null)
                        {
                            return(image.Encode().AsStream());
                        }
                    }
                }
            }

            return(null);
        }
Esempio n. 25
0
        public static string GetAssetJsonData(PakReader.PakReader reader, IEnumerable <FPakEntry> entriesList, bool loadImageInBox = false)
        {
            DebugHelper.WriteLine("Assets: Gathering info about {0}", entriesList.ElementAt(0).Name);

            Stream[] AssetStreamArray = new Stream[3];

            foreach (FPakEntry entry in entriesList)
            {
                #region AUTO EXTRACT RAW
                if (FProp.Default.FAutoExtractRaw)
                {
                    string path       = FProp.Default.FOutput_Path + "\\Exports\\" + entry.Name;
                    string pWExt      = FoldersUtility.GetFullPathWithoutExtension(entry.Name);
                    string subfolders = pWExt.Substring(0, pWExt.LastIndexOf("/", StringComparison.InvariantCultureIgnoreCase));

                    Directory.CreateDirectory(FProp.Default.FOutput_Path + "\\Exports\\" + subfolders);
                    Stream stream = reader.GetPackageStream(entry);
                    using (var fStream = File.OpenWrite(path))
                        using (stream)
                        {
                            stream.CopyTo(fStream);
                        }

                    if (File.Exists(path))
                    {
                        DebugHelper.WriteLine("Assets: Successfully extracted data of {0}", entry.Name);

                        new UpdateMyConsole(Path.GetFileName(path), CColors.Blue).Append();
                        new UpdateMyConsole(" successfully exported", CColors.White, true).Append();
                    }
                    else //just in case
                    {
                        DebugHelper.WriteLine("Assets: Couldn't extract data of {0}", entry.Name);

                        new UpdateMyConsole("Bruh moment\nCouldn't export ", CColors.White).Append();
                        new UpdateMyConsole(Path.GetFileName(path), CColors.Blue, true).Append();
                    }
                }
                #endregion

                switch (Path.GetExtension(entry.Name.ToLowerInvariant()))
                {
                case ".ini":
                    FWindow.FMain.Dispatcher.InvokeAsync(() =>
                    {
                        FWindow.FMain.AssetPropertiesBox_Main.SyntaxHighlighting = ResourceLoader.LoadHighlightingDefinition("Ini.xshd");
                    });
                    using (var s = reader.GetPackageStream(entry))
                        using (var r = new StreamReader(s))
                            return(r.ReadToEnd());

                case ".uproject":
                case ".uplugin":
                case ".upluginmanifest":
                    using (var s = reader.GetPackageStream(entry))
                        using (var r = new StreamReader(s))
                            return(r.ReadToEnd());

                case ".locmeta":
                    using (var s = reader.GetPackageStream(entry))
                        return(JsonConvert.SerializeObject(new LocMetaFile(s), Formatting.Indented));

                case ".locres":
                    using (var s = reader.GetPackageStream(entry))
                        return(JsonConvert.SerializeObject(new LocResFile(s).Entries, Formatting.Indented));

                case ".udic":
                    using (var s = reader.GetPackageStream(entry))
                        using (var r = new BinaryReader(s))
                            return(JsonConvert.SerializeObject(new UDicFile(r).Header, Formatting.Indented));

                case ".bin":
                    if (string.Equals(entry.Name, "/FortniteGame/AssetRegistry.bin") || !entry.Name.Contains("AssetRegistry"))     //MEMORY ISSUE
                    {
                        break;
                    }

                    using (var s = reader.GetPackageStream(entry))
                        return(JsonConvert.SerializeObject(new AssetRegistryFile(s), Formatting.Indented));

                default:
                    if (entry.Name.EndsWith(".uasset"))
                    {
                        AssetStreamArray[0] = reader.GetPackageStream(entry);
                    }

                    if (entry.Name.EndsWith(".uexp"))
                    {
                        AssetStreamArray[1] = reader.GetPackageStream(entry);
                    }

                    if (entry.Name.EndsWith(".ubulk"))
                    {
                        AssetStreamArray[2] = reader.GetPackageStream(entry);
                    }
                    break;
                }
            }

            AssetReader ar = GetAssetReader(AssetStreamArray);
            if (ar != null)
            {
                if (loadImageInBox)
                {
                    foreach (ExportObject eo in ar.Exports)
                    {
                        switch (eo)
                        {
                        case Texture2D texture:
                            SKImage image = texture.GetImage();
                            if (image != null)
                            {
                                using (var data = image.Encode())
                                    using (var stream = data.AsStream())
                                    {
                                        ImageSource img = ImagesUtility.GetImageSource(stream);
                                        FWindow.FMain.Dispatcher.InvokeAsync(() =>
                                        {
                                            FWindow.FMain.ImageBox_Main.Source = BitmapFrame.Create((BitmapSource)img); //thread safe and fast af

                                            if (FWindow.FMain.MI_Auto_Save_Images.IsChecked)                            //auto save images
                                            {
                                                ImagesUtility.SaveImage(FProp.Default.FOutput_Path + "\\Icons\\" + FWindow.FCurrentAsset + ".png");
                                            }
                                        });
                                    }
                            }
                            return(JsonConvert.SerializeObject(texture.textures, Formatting.Indented));

                        case USoundWave sound:
                            using (sound)
                            {
                                byte[] s = readSound(sound);
                                if (s != null)
                                {
                                    string path = FProp.Default.FOutput_Path + "\\Sounds\\" + FWindow.FCurrentAsset + ".ogg";
                                    File.WriteAllBytes(path, s);

                                    //open sound
                                    if (FProp.Default.FOpenSounds)
                                    {
                                        FoldersUtility.OpenWithDefaultProgram(path);
                                    }
                                }

                                GC.Collect();
                                GC.WaitForPendingFinalizers();
                                return(JsonConvert.SerializeObject(sound.base_object, Formatting.Indented));
                            }
                        }
                    }
                }

                string stringData = JsonConvert.SerializeObject(ar.Exports, Formatting.Indented);

                #region AUTO SAVE JSON
                if (FProp.Default.FAutoSaveJson)
                {
                    string name = Path.GetFileNameWithoutExtension(entriesList.ElementAt(0).Name);
                    string path = FProp.Default.FOutput_Path + "\\JSONs\\" + name + ".json";
                    if (!string.IsNullOrEmpty(stringData))
                    {
                        File.WriteAllText(path, stringData);
                        if (File.Exists(path))
                        {
                            DebugHelper.WriteLine("Assets: Successfully saved serialized data of {0}", entriesList.ElementAt(0).Name);

                            new UpdateMyConsole(name, CColors.Blue).Append();
                            new UpdateMyConsole("'s Json data successfully saved", CColors.White, true).Append();
                        }
                        else //just in case
                        {
                            DebugHelper.WriteLine("Assets: Couldn't save serialized data of {0}", entriesList.ElementAt(0).Name);

                            new UpdateMyConsole("Bruh moment\nCouldn't export ", CColors.White).Append();
                            new UpdateMyConsole(name, CColors.Blue, true).Append();
                        }
                    }
                }
                #endregion

                return(stringData);
            }

            return(string.Empty);
        }