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")) { string jsonData = AssetsUtility.GetAssetJsonDataByPath(path); if (jsonData != null && AssetsUtility.IsValidJson(jsonData)) { JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData); 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(UNKNOWN_ICON)).Stream); }
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); }