cleaned a lot of things + GetEpicDirectory() search through all drives now

This commit is contained in:
iAmAsval 2019-12-09 14:37:57 +01:00
parent 959c8836af
commit 7df8475d21
30 changed files with 585 additions and 646 deletions

View File

@ -51,7 +51,7 @@ namespace FModel.Forms
if (AESEntries.AESEntriesList == null) { KeysManager.Deserialize(); }
int yPos = 4;
foreach (PAKInfosEntry Pak in PAKEntries.PAKEntriesList.Where(x => x.bTheDynamicPAK == true))
foreach (PAKInfosEntry Pak in PAKEntries.PAKEntriesList.Where(x => x.bTheDynamicPAK))
{
Label PakLabel = new Label();
PakLabel.Content = Path.GetFileNameWithoutExtension(Pak.ThePAKPath);
@ -109,7 +109,7 @@ namespace FModel.Forms
AESEntries.AESEntriesList = new List<AESInfosEntry>();
if (PAKEntries.PAKEntriesList != null && PAKEntries.PAKEntriesList.Any())
{
foreach (PAKInfosEntry Pak in PAKEntries.PAKEntriesList.Where(x => x.bTheDynamicPAK == true))
foreach (PAKInfosEntry Pak in PAKEntries.PAKEntriesList.Where(x => x.bTheDynamicPAK))
{
TextBox PakTextBox = UIHelper.FindChild<TextBox>(this, $"TxtBox_{Regex.Match(Path.GetFileNameWithoutExtension(Pak.ThePAKPath), @"\d+").Value}");
if (!string.IsNullOrEmpty(PakTextBox.Text))

View File

@ -90,7 +90,7 @@ namespace FModel.Forms
this.SetValue(TextOptions.TextFormattingModeProperty, TextFormattingMode.Display);
Message = message;
Image_MessageBox.Visibility = System.Windows.Visibility.Collapsed;
Image_MessageBox.Visibility = Visibility.Collapsed;
DisplayButtons(MessageBoxButton.OK);
}
@ -100,7 +100,7 @@ namespace FModel.Forms
Message = message;
Caption = caption;
Image_MessageBox.Visibility = System.Windows.Visibility.Collapsed;
Image_MessageBox.Visibility = Visibility.Collapsed;
DisplayButtons(MessageBoxButton.OK);
}
@ -110,7 +110,7 @@ namespace FModel.Forms
Message = message;
Caption = caption;
Image_MessageBox.Visibility = System.Windows.Visibility.Collapsed;
Image_MessageBox.Visibility = Visibility.Collapsed;
DisplayButtons(button);
}
@ -131,7 +131,7 @@ namespace FModel.Forms
Message = message;
Caption = caption;
Image_MessageBox.Visibility = System.Windows.Visibility.Collapsed;
Image_MessageBox.Visibility = Visibility.Collapsed;
DisplayButtons(button);
DisplayImage(image);
@ -143,39 +143,39 @@ namespace FModel.Forms
{
case MessageBoxButton.OKCancel:
// Hide all but OK, Cancel
Button_OK.Visibility = System.Windows.Visibility.Visible;
Button_OK.Visibility = Visibility.Visible;
Button_OK.Focus();
Button_Cancel.Visibility = System.Windows.Visibility.Visible;
Button_Cancel.Visibility = Visibility.Visible;
Button_Yes.Visibility = System.Windows.Visibility.Collapsed;
Button_No.Visibility = System.Windows.Visibility.Collapsed;
Button_Yes.Visibility = Visibility.Collapsed;
Button_No.Visibility = Visibility.Collapsed;
break;
case MessageBoxButton.YesNo:
// Hide all but Yes, No
Button_Yes.Visibility = System.Windows.Visibility.Visible;
Button_Yes.Visibility = Visibility.Visible;
Button_Yes.Focus();
Button_No.Visibility = System.Windows.Visibility.Visible;
Button_No.Visibility = Visibility.Visible;
Button_OK.Visibility = System.Windows.Visibility.Collapsed;
Button_Cancel.Visibility = System.Windows.Visibility.Collapsed;
Button_OK.Visibility = Visibility.Collapsed;
Button_Cancel.Visibility = Visibility.Collapsed;
break;
case MessageBoxButton.YesNoCancel:
// Hide only OK
Button_Yes.Visibility = System.Windows.Visibility.Visible;
Button_Yes.Visibility = Visibility.Visible;
Button_Yes.Focus();
Button_No.Visibility = System.Windows.Visibility.Visible;
Button_Cancel.Visibility = System.Windows.Visibility.Visible;
Button_No.Visibility = Visibility.Visible;
Button_Cancel.Visibility = Visibility.Visible;
Button_OK.Visibility = System.Windows.Visibility.Collapsed;
Button_OK.Visibility = Visibility.Collapsed;
break;
default:
// Hide all but OK
Button_OK.Visibility = System.Windows.Visibility.Visible;
Button_OK.Visibility = Visibility.Visible;
Button_OK.Focus();
Button_Yes.Visibility = System.Windows.Visibility.Collapsed;
Button_No.Visibility = System.Windows.Visibility.Collapsed;
Button_Cancel.Visibility = System.Windows.Visibility.Collapsed;
Button_Yes.Visibility = Visibility.Collapsed;
Button_No.Visibility = Visibility.Collapsed;
Button_Cancel.Visibility = Visibility.Collapsed;
break;
}
}
@ -204,7 +204,7 @@ namespace FModel.Forms
}
Image_MessageBox.Source = icon.ToImageSource();
Image_MessageBox.Visibility = System.Windows.Visibility.Visible;
Image_MessageBox.Visibility = Visibility.Visible;
}
private void Button_OK_Click(object sender, RoutedEventArgs e)

View File

@ -2,7 +2,6 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
@ -69,14 +68,6 @@ namespace FModel.Forms
//INITIALIZATION
drawingContext.DrawRectangle(Brushes.Transparent, null, new Rect(new Point(0, 0), new Size(515, 515)));
var w = 520 * numperrow;
if (imageCount * 520 < 520 * numperrow)
{
w = imageCount * 520;
}
int h = int.Parse(Math.Ceiling(double.Parse(imageCount.ToString()) / numperrow).ToString(CultureInfo.InvariantCulture)) * 520;
int num = 1;
int curW = 0;
int curH = 0;
@ -84,8 +75,6 @@ namespace FModel.Forms
for (int i = 0; i < imageCount; i++)
{
int percentage = (i + 1) * 100 / imageCount;
BitmapImage source = new BitmapImage(new Uri(_imagePath[i]));
source.DecodePixelWidth = 515;
@ -110,17 +99,14 @@ namespace FModel.Forms
}
}
if (drawingVisual != null)
{
RenderTargetBitmap RTB = new RenderTargetBitmap((int)Math.Floor(drawingVisual.DescendantBounds.Width), (int)Math.Floor(drawingVisual.DescendantBounds.Height), 96, 96, PixelFormats.Pbgra32);
RTB.Render(drawingVisual);
RTB.Freeze(); //We freeze to apply the RTB to our imagesource from the UI Thread
RenderTargetBitmap RTB = new RenderTargetBitmap((int)Math.Floor(drawingVisual.DescendantBounds.Width), (int)Math.Floor(drawingVisual.DescendantBounds.Height), 96, 96, PixelFormats.Pbgra32);
RTB.Render(drawingVisual);
RTB.Freeze(); //We freeze to apply the RTB to our imagesource from the UI Thread
this.Dispatcher.InvokeAsync(() =>
{
MergerPreview_Image.Source = BitmapFrame.Create(RTB); //thread safe and fast af
});
}
this.Dispatcher.InvokeAsync(() =>
{
MergerPreview_Image.Source = BitmapFrame.Create(RTB); //thread safe and fast af
});
}).ContinueWith(TheTask =>
{
@ -156,7 +142,7 @@ namespace FModel.Forms
private void AddFiles(string[] files)
{
if (files.Count() > 0)
if (files.Length > 0)
{
foreach (string file in files)
{

View File

@ -25,6 +25,16 @@ namespace FModel.Forms
/// </summary>
public partial class FModel_Settings : Window
{
private const string CHALLENGE_TEMPLATE_ICON = "pack://application:,,,/Resources/Template_Challenge.png";
private const string RARITY_DEFAULT_FEATURED = "pack://application:,,,/Resources/Template_D_F.png";
private const string RARITY_DEFAULT_NORMAL = "pack://application:,,,/Resources/Template_D_N.png";
private const string RARITY_FLAT_FEATURED = "pack://application:,,,/Resources/Template_F_F.png";
private const string RARITY_FLAT_NORMAL = "pack://application:,,,/Resources/Template_F_N.png";
private const string RARITY_MINIMALIST_FEATURED = "pack://application:,,,/Resources/Template_M_F.png";
private const string RARITY_MINIMALIST_NORMAL = "pack://application:,,,/Resources/Template_M_N.png";
private const string RARITY_ACCURATECOLORS_FEATURED = "pack://application:,,,/Resources/Template_AC_F.png";
private const string RARITY_ACCURATECOLORS_NORMAL = "pack://application:,,,/Resources/Template_AC_N.png";
public FModel_Settings()
{
InitializeComponent();
@ -81,7 +91,7 @@ namespace FModel.Forms
public static T GetEnumValueFromDescription<T>(string description)
{
var type = typeof(T);
if (!type.IsEnum) { throw new ArgumentException(); }
if (!type.IsEnum) { throw new ArgumentException("Enum type is null, bruh"); }
FieldInfo[] fields = type.GetFields();
var field = fields
.SelectMany(f => f.GetCustomAttributes(
@ -232,16 +242,16 @@ namespace FModel.Forms
switch (rarityDesign)
{
case "Default":
source = new BitmapImage(new Uri(isFeatured ? "pack://application:,,,/Resources/Template_D_F.png" : "pack://application:,,,/Resources/Template_D_N.png"));
source = new BitmapImage(new Uri(isFeatured ? RARITY_DEFAULT_FEATURED : RARITY_DEFAULT_NORMAL));
break;
case "Flat":
source = new BitmapImage(new Uri(isFeatured ? "pack://application:,,,/Resources/Template_F_F.png" : "pack://application:,,,/Resources/Template_F_N.png"));
source = new BitmapImage(new Uri(isFeatured ? RARITY_FLAT_FEATURED : RARITY_FLAT_NORMAL));
break;
case "Minimalist":
source = new BitmapImage(new Uri(isFeatured ? "pack://application:,,,/Resources/Template_M_F.png" : "pack://application:,,,/Resources/Template_M_N.png"));
source = new BitmapImage(new Uri(isFeatured ? RARITY_MINIMALIST_FEATURED : RARITY_MINIMALIST_NORMAL));
break;
case "Accurate Colors":
source = new BitmapImage(new Uri(isFeatured ? "pack://application:,,,/Resources/Template_AC_F.png" : "pack://application:,,,/Resources/Template_AC_N.png"));
source = new BitmapImage(new Uri(isFeatured ? RARITY_ACCURATECOLORS_FEATURED : RARITY_ACCURATECOLORS_NORMAL));
break;
}
drawingContext.DrawImage(source, new Rect(new Point(0, 0), new Size(515, 515)));
@ -250,31 +260,25 @@ namespace FModel.Forms
{
using (StreamReader image = new StreamReader(FProp.Default.FWatermarkFilePath))
{
if (image != null)
{
BitmapImage bmp = new BitmapImage();
bmp.BeginInit();
bmp.CacheOption = BitmapCacheOption.OnLoad;
bmp.StreamSource = image.BaseStream;
bmp.EndInit();
BitmapImage bmp = new BitmapImage();
bmp.BeginInit();
bmp.CacheOption = BitmapCacheOption.OnLoad;
bmp.StreamSource = image.BaseStream;
bmp.EndInit();
drawingContext.DrawImage(ImagesUtility.CreateTransparency(bmp, opacity), new Rect(xPos, yPos, scale, scale));
}
drawingContext.DrawImage(ImagesUtility.CreateTransparency(bmp, opacity), new Rect(xPos, yPos, scale, scale));
}
}
}
if (drawingVisual != null)
{
RenderTargetBitmap RTB = new RenderTargetBitmap(515, 515, 96, 96, PixelFormats.Pbgra32);
RTB.Render(drawingVisual);
RTB.Freeze(); //We freeze to apply the RTB to our imagesource from the UI Thread
RenderTargetBitmap RTB = new RenderTargetBitmap(515, 515, 96, 96, PixelFormats.Pbgra32);
RTB.Render(drawingVisual);
RTB.Freeze(); //We freeze to apply the RTB to our imagesource from the UI Thread
FWindow.FMain.Dispatcher.InvokeAsync(() =>
{
ImageBox_RarityPreview.Source = BitmapFrame.Create(RTB); //thread safe and fast af
});
}
FWindow.FMain.Dispatcher.InvokeAsync(() =>
{
ImageBox_RarityPreview.Source = BitmapFrame.Create(RTB); //thread safe and fast af
});
}).ContinueWith(TheTask =>
{
@ -433,7 +437,7 @@ namespace FModel.Forms
}
else
{
BitmapImage source = new BitmapImage(new Uri("pack://application:,,,/Resources/Template_Challenge.png"));
BitmapImage source = new BitmapImage(new Uri(CHALLENGE_TEMPLATE_ICON));
ImageBox_ChallengePreview.Source = source;
}
}

View File

@ -25,6 +25,16 @@ namespace FModel.Forms
/// </summary>
public partial class FModel_UpdateMode : Window
{
private const string CHALLENGE_TEMPLATE_ICON = "pack://application:,,,/Resources/Template_Challenge.png";
private const string RARITY_DEFAULT_FEATURED = "pack://application:,,,/Resources/Template_D_F.png";
private const string RARITY_DEFAULT_NORMAL = "pack://application:,,,/Resources/Template_D_N.png";
private const string RARITY_FLAT_FEATURED = "pack://application:,,,/Resources/Template_F_F.png";
private const string RARITY_FLAT_NORMAL = "pack://application:,,,/Resources/Template_F_N.png";
private const string RARITY_MINIMALIST_FEATURED = "pack://application:,,,/Resources/Template_M_F.png";
private const string RARITY_MINIMALIST_NORMAL = "pack://application:,,,/Resources/Template_M_N.png";
private const string RARITY_ACCURATECOLORS_FEATURED = "pack://application:,,,/Resources/Template_AC_F.png";
private const string RARITY_ACCURATECOLORS_NORMAL = "pack://application:,,,/Resources/Template_AC_N.png";
#region CLASS
public class AssetProperties : INotifyPropertyChanged
{
@ -116,14 +126,14 @@ namespace FModel.Forms
public static T GetEnumValueFromDescription<T>(string description)
{
var type = typeof(T);
if (!type.IsEnum) { throw new ArgumentException(); }
if (!type.IsEnum) { throw new ArgumentException("Enum type is null, bruh"); }
FieldInfo[] fields = type.GetFields();
var field = fields
.SelectMany(f => f.GetCustomAttributes(
typeof(DescriptionAttribute), false), (
f, a) => new { Field = f, Att = a })
.Where(a => ((DescriptionAttribute)a.Att)
.Description == description).SingleOrDefault();
.SingleOrDefault(a => ((DescriptionAttribute)a.Att)
.Description == description);
return field == null ? default(T) : (T)field.Field.GetRawConstantValue();
}
#endregion
@ -193,16 +203,16 @@ namespace FModel.Forms
switch (rarityDesign)
{
case "Default":
source = new BitmapImage(new Uri(isFeatured ? "pack://application:,,,/Resources/Template_D_F.png" : "pack://application:,,,/Resources/Template_D_N.png"));
source = new BitmapImage(new Uri(isFeatured ? RARITY_DEFAULT_FEATURED : RARITY_DEFAULT_NORMAL));
break;
case "Flat":
source = new BitmapImage(new Uri(isFeatured ? "pack://application:,,,/Resources/Template_F_F.png" : "pack://application:,,,/Resources/Template_F_N.png"));
source = new BitmapImage(new Uri(isFeatured ? RARITY_FLAT_FEATURED : RARITY_FLAT_NORMAL));
break;
case "Minimalist":
source = new BitmapImage(new Uri(isFeatured ? "pack://application:,,,/Resources/Template_M_F.png" : "pack://application:,,,/Resources/Template_M_N.png"));
source = new BitmapImage(new Uri(isFeatured ? RARITY_MINIMALIST_FEATURED : RARITY_MINIMALIST_NORMAL));
break;
case "Accurate Colors":
source = new BitmapImage(new Uri(isFeatured ? "pack://application:,,,/Resources/Template_AC_F.png" : "pack://application:,,,/Resources/Template_AC_N.png"));
source = new BitmapImage(new Uri(isFeatured ? RARITY_ACCURATECOLORS_FEATURED : RARITY_ACCURATECOLORS_NORMAL));
break;
}
drawingContext.DrawImage(source, new Rect(new Point(0, 0), new Size(515, 515)));
@ -211,31 +221,25 @@ namespace FModel.Forms
{
using (StreamReader image = new StreamReader(FProp.Default.FWatermarkFilePath))
{
if (image != null)
{
BitmapImage bmp = new BitmapImage();
bmp.BeginInit();
bmp.CacheOption = BitmapCacheOption.OnLoad;
bmp.StreamSource = image.BaseStream;
bmp.EndInit();
BitmapImage bmp = new BitmapImage();
bmp.BeginInit();
bmp.CacheOption = BitmapCacheOption.OnLoad;
bmp.StreamSource = image.BaseStream;
bmp.EndInit();
drawingContext.DrawImage(ImagesUtility.CreateTransparency(bmp, opacity), new Rect(FProp.Default.FWatermarkXPos, FProp.Default.FWatermarkYPos, scale, scale));
}
drawingContext.DrawImage(ImagesUtility.CreateTransparency(bmp, opacity), new Rect(FProp.Default.FWatermarkXPos, FProp.Default.FWatermarkYPos, scale, scale));
}
}
}
if (drawingVisual != null)
{
RenderTargetBitmap RTB = new RenderTargetBitmap(515, 515, 96, 96, PixelFormats.Pbgra32);
RTB.Render(drawingVisual);
RTB.Freeze(); //We freeze to apply the RTB to our imagesource from the UI Thread
RenderTargetBitmap RTB = new RenderTargetBitmap(515, 515, 96, 96, PixelFormats.Pbgra32);
RTB.Render(drawingVisual);
RTB.Freeze(); //We freeze to apply the RTB to our imagesource from the UI Thread
FWindow.FMain.Dispatcher.InvokeAsync(() =>
{
ImageBox_RarityPreview.Source = BitmapFrame.Create(RTB); //thread safe and fast af
});
}
FWindow.FMain.Dispatcher.InvokeAsync(() =>
{
ImageBox_RarityPreview.Source = BitmapFrame.Create(RTB); //thread safe and fast af
});
}).ContinueWith(TheTask =>
{

View File

@ -37,8 +37,8 @@ namespace FModel.Methods.AESManager
if (KeysDict != null)
{
AESEntries.AESEntriesList = new List<AESInfosEntry>();
foreach (PAKInfosEntry Pak in PAKEntries.PAKEntriesList.Where(x => x.bTheDynamicPAK == true //DYNAMIC PAK ONLY
&& !AESEntries.AESEntriesList.Where(w => string.Equals(w.ThePAKName, Path.GetFileNameWithoutExtension(x.ThePAKPath))).Any() //IS NOT ALREADY ADDED
foreach (PAKInfosEntry Pak in PAKEntries.PAKEntriesList.Where(x => x.bTheDynamicPAK //DYNAMIC PAK ONLY
&& !AESEntries.AESEntriesList.Any(w => string.Equals(w.ThePAKName, Path.GetFileNameWithoutExtension(x.ThePAKPath))) //IS NOT ALREADY ADDED
))
{
if (KeysDict.ContainsKey(Path.GetFileName(Pak.ThePAKPath)))
@ -47,7 +47,7 @@ namespace FModel.Methods.AESManager
if (_oldAESEntriesList != null)
{
if (!_oldAESEntriesList.Where(x => string.Equals(x.ThePAKKey, KeysDict[Path.GetFileName(Pak.ThePAKPath)].ToUpperInvariant().Substring(2))).Any())
if (!_oldAESEntriesList.Any(x => string.Equals(x.ThePAKKey, KeysDict[Path.GetFileName(Pak.ThePAKPath)].ToUpperInvariant().Substring(2))))
{
new UpdateMyConsole(Path.GetFileName(Pak.ThePAKPath), CColors.Blue).Append();
new UpdateMyConsole(" can now be opened.", CColors.White, true).Append();

View File

@ -118,7 +118,7 @@ namespace FModel.Methods.Assets
}
}
}
return null;
return new Dictionary<string, Dictionary<string, string>>();
}
public static void SetHotfixedLocResDict()
@ -172,7 +172,7 @@ namespace FModel.Methods.Assets
private static string GetValueFromParam(string fullLine, string startWith, string endWith)
{
int startIndex = fullLine.IndexOf(startWith, StringComparison.InvariantCultureIgnoreCase) + startWith.Length;
int endIndex = fullLine.Substring(startIndex).IndexOf(endWith, StringComparison.InvariantCultureIgnoreCase);
int endIndex = fullLine.Substring(startIndex).ToString().IndexOf(endWith, StringComparison.InvariantCultureIgnoreCase);
return fullLine.Substring(startIndex, endIndex);
}

View File

@ -1,8 +1,6 @@
using FModel.Methods.Utilities;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PakReader;
using System.Collections.Generic;
using System.Linq;
using FProp = FModel.Properties.Settings;
@ -17,15 +15,12 @@ namespace FModel.Methods.Assets.IconCreator.AthenaID
if (ItemSetsArray == null)
{
string jsonData = AssetsUtility.GetAssetJsonDataByPath("/FortniteGame/Content/Athena/Items/Cosmetics/Metadata/CosmeticSets", true);
if (jsonData != null)
if (jsonData != null && AssetsUtility.IsValidJson(jsonData))
{
if (AssetsUtility.IsValidJson(jsonData))
{
dynamic AssetData = JsonConvert.DeserializeObject(jsonData);
JArray AssetArray = JArray.FromObject(AssetData);
ItemSetsArray = AssetArray[0]["rows"].Value<JArray>();
return SearchSetDisplayName(SetTagName);
}
dynamic AssetData = JsonConvert.DeserializeObject(jsonData);
JArray AssetArray = JArray.FromObject(AssetData);
ItemSetsArray = AssetArray[0]["rows"].Value<JArray>();
return SearchSetDisplayName(SetTagName);
}
}
else

View File

@ -1,9 +1,7 @@
using FModel.Methods.Utilities;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PakReader;
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows;
using System.Windows.Media.Imaging;
@ -14,26 +12,25 @@ namespace FModel.Methods.Assets.IconCreator.AthenaID
{
private static JArray ItemCategoriesArray { get; set; }
public static int xCoords = 4 - 25;
private const string PET_CUSTOM_ICON = "pack://application:,,,/Resources/T-Icon-Pets-64.png";
private const string QUEST_CUSTOM_ICON = "pack://application:,,,/Resources/T-Icon-Quests-64.png";
public static void DrawUserFacingFlag(JToken uFF)
{
if (ItemCategoriesArray == null)
{
string jsonData = AssetsUtility.GetAssetJsonDataByPath("/FortniteGame/Content/Items/ItemCategories", true);
if (jsonData != null)
if (jsonData != null && AssetsUtility.IsValidJson(jsonData))
{
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)
{
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>();
ItemCategoriesArray = tertiaryCategoriesToken["data"].Value<JArray>();
string uFFTargeted = uFF.Value<string>().Substring("Cosmetics.UserFacingFlags.".Length);
SearchUserFacingFlag(uFFTargeted);
}
string uFFTargeted = uFF.Value<string>().Substring("Cosmetics.UserFacingFlags.".Length);
SearchUserFacingFlag(uFFTargeted);
}
}
}
@ -71,7 +68,7 @@ namespace FModel.Methods.Assets.IconCreator.AthenaID
BitmapImage bmp = new BitmapImage();
bmp.BeginInit();
bmp.CacheOption = BitmapCacheOption.OnLoad;
bmp.UriSource = new Uri("pack://application:,,,/Resources/T-Icon-Pets-64.png");
bmp.UriSource = new Uri(PET_CUSTOM_ICON);
bmp.EndInit();
bmp.Freeze();
@ -83,7 +80,7 @@ namespace FModel.Methods.Assets.IconCreator.AthenaID
BitmapImage bmp = new BitmapImage();
bmp.BeginInit();
bmp.CacheOption = BitmapCacheOption.OnLoad;
bmp.UriSource = new Uri("pack://application:,,,/Resources/T-Icon-Quests-64.png");
bmp.UriSource = new Uri(QUEST_CUSTOM_ICON);
bmp.EndInit();
bmp.Freeze();

View File

@ -1,14 +1,12 @@
using FModel.Methods.Utilities;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PakReader;
using System;
using System.Collections.Generic;
using System.Linq;
namespace FModel.Methods.Assets.IconCreator.ChallengeID
{
class ChallengeBundleInfos
static class ChallengeBundleInfos
{
public static List<BundleInfosEntry> BundleData { get; set; }
@ -48,146 +46,197 @@ namespace FModel.Methods.Assets.IconCreator.ChallengeID
private static void GetQuestData(JArray BundleProperties, string assetPath)
{
string jsonData = AssetsUtility.GetAssetJsonDataByPath(assetPath);
if (jsonData != null)
if (jsonData != null && AssetsUtility.IsValidJson(jsonData))
{
if (AssetsUtility.IsValidJson(jsonData))
JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
if (AssetMainToken != null)
{
JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
if (AssetMainToken != null)
JArray AssetProperties = AssetMainToken["properties"].Value<JArray>();
if (AssetProperties != 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;
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)
//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 &&
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)
{
unlockType = questUnlockTypeToken.Value<string>();
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>());
}
}
//objectives array to catch the quest description and quest count
JArray objectivesDataArray = AssetsUtility.GetPropertyTagText<JArray>(AssetProperties, "Objectives", "data");
if (objectivesDataArray != null)
if (objectivesDataProperties != null)
{
if (objectivesDataArray[0]["struct_name"] != null && objectivesDataArray[0]["struct_type"] != null && string.Equals(objectivesDataArray[0]["struct_name"].Value<string>(), "FortMcpQuestObjectiveInfo"))
JToken countToken = AssetsUtility.GetPropertyTag<JToken>(objectivesDataProperties, "Count");
if (countToken != null)
{
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)
questCount = countToken.Value<long>();
JToken objectiveCompletionCountToken = AssetsUtility.GetPropertyTag<JToken>(AssetProperties, "ObjectiveCompletionCount");
if (objectiveCompletionCountToken != null)
{
questDescription = AssetTranslations.SearchTranslation(description_namespace.Value<string>(), description_key.Value<string>(), description_source_string.Value<string>());
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");
JToken rewardsTable = AssetsUtility.GetPropertyTagImport<JToken>(AssetProperties, "RewardsTable");
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.FirstOrDefault(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"))
["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.FirstOrDefault(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"))
["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
{
//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)
BundleInfosEntry currentData = new BundleInfosEntry(questDescription, questCount, unlockType, "", "");
if (!BundleData.Any(item => item.TheQuestDescription.Equals(currentData.TheQuestDescription, StringComparison.InvariantCultureIgnoreCase) && item.TheQuestCount == currentData.TheQuestCount))
{
questDescription = AssetTranslations.SearchTranslation(description_namespace.Value<string>(), description_key.Value<string>(), description_source_string.Value<string>());
BundleData.Add(currentData);
}
}
if (objectivesDataProperties != null)
}
catch (Exception)
{
if (hiddenRewardsDataArray != null)
{
JToken countToken = AssetsUtility.GetPropertyTag<JToken>(objectivesDataProperties, "Count");
if (countToken != null)
if (hiddenRewardsDataArray[0]["struct_name"] != null && hiddenRewardsDataArray[0]["struct_type"] != null && string.Equals(hiddenRewardsDataArray[0]["struct_name"].Value<string>(), "FortHiddenRewardQuantityPair"))
{
questCount = countToken.Value<long>();
JToken objectiveCompletionCountToken = AssetsUtility.GetPropertyTag<JToken>(AssetProperties, "ObjectiveCompletionCount");
if (objectiveCompletionCountToken != null)
JArray hiddenRewardPropertiesArray = hiddenRewardsDataArray[0]["struct_type"]["properties"].Value<JArray>();
if (hiddenRewardPropertiesArray != null)
{
questCount = objectiveCompletionCountToken.Value<long>();
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);
}
}
}
}
//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");
JToken rewardsTable = AssetsUtility.GetPropertyTagImport<JToken>(AssetProperties, "RewardsTable");
if (rewardsDataArray != null)
}
else if (rewardsTable != null)
{
string rewardsTablePath = AssetEntries.AssetEntriesDict.Where(x => x.Key.ToLowerInvariant().Contains("/" + rewardsTable.Value<string>().ToLowerInvariant() + ".uasset")).Select(d => d.Key).FirstOrDefault();
if (!string.IsNullOrEmpty(rewardsTablePath))
{
if (rewardsDataArray[0]["struct_name"] != null && rewardsDataArray[0]["struct_type"] != null && string.Equals(rewardsDataArray[0]["struct_name"].Value<string>(), "FortItemQuantityPair"))
jsonData = AssetsUtility.GetAssetJsonDataByPath(rewardsTablePath.Substring(0, rewardsTablePath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase)));
if (jsonData != null && AssetsUtility.IsValidJson(jsonData))
{
try
JToken AssetRewarsTableMainToken = AssetsUtility.ConvertJson2Token(jsonData);
if (AssetRewarsTableMainToken != null)
{
//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)
JArray propertiesArray = AssetRewarsTableMainToken["rows"].Value<JArray>();
if (propertiesArray != 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))
JArray propertiesRewardTable = AssetsUtility.GetPropertyTagItemData<JArray>(propertiesArray, "Default", "properties");
if (propertiesRewardTable != null)
{
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 = propertiesRewardTable.FirstOrDefault(item => string.Equals(item["name"].Value<string>(), "TemplateId"));
if (templateIdToken != null)
{
JToken templateIdToken = AssetsUtility.GetPropertyTag<JToken>(hiddenRewardPropertiesArray, "TemplateId");
if (templateIdToken != null)
string templateId = templateIdToken["tag_data"].Value<string>();
if (templateId.Contains(":"))
templateId = templateId.Split(':')[1];
string templateIdPath = AssetEntries.AssetEntriesDict.Where(x => x.Key.ToLowerInvariant().Contains("/" + templateId.ToLowerInvariant() + ".uasset")).Select(d => d.Key).FirstOrDefault();
if (!string.IsNullOrEmpty(templateIdPath))
{
rewardPath = templateIdToken.Value<string>();
rewardPath = templateIdPath.Substring(0, templateIdPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase));
}
//reward quantity (if 1, this won't be displayed)
JToken hiddenQuantityToken = AssetsUtility.GetPropertyTag<JToken>(hiddenRewardPropertiesArray, "Quantity");
if (hiddenQuantityToken != null)
JToken quantityToken = propertiesRewardTable.FirstOrDefault(item => string.Equals(item["name"].Value<string>(), "Quantity"));
if (quantityToken != null)
{
rewardQuantity = hiddenQuantityToken.Value<string>();
rewardQuantity = quantityToken["tag_data"].Value<string>();
}
BundleInfosEntry currentData = new BundleInfosEntry(questDescription, questCount, unlockType, rewardPath, rewardQuantity);
@ -198,95 +247,36 @@ namespace FModel.Methods.Assets.IconCreator.ChallengeID
}
}
}
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 if (rewardsTable != null)
}
else
{
BundleInfosEntry currentData = new BundleInfosEntry(questDescription, questCount, unlockType, "", "");
if (!BundleData.Any(item => item.TheQuestDescription.Equals(currentData.TheQuestDescription, StringComparison.InvariantCultureIgnoreCase) && item.TheQuestCount == currentData.TheQuestCount))
{
string rewardsTablePath = AssetEntries.AssetEntriesDict.Where(x => x.Key.ToLowerInvariant().Contains("/" + rewardsTable.Value<string>().ToLowerInvariant() + ".uasset")).Select(d => d.Key).FirstOrDefault();
if (!string.IsNullOrEmpty(rewardsTablePath))
{
jsonData = AssetsUtility.GetAssetJsonDataByPath(rewardsTablePath.Substring(0, rewardsTablePath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase)));
if (jsonData != null)
{
if (AssetsUtility.IsValidJson(jsonData))
{
JToken AssetRewarsTableMainToken = AssetsUtility.ConvertJson2Token(jsonData);
if (AssetRewarsTableMainToken != null)
{
JArray propertiesArray = AssetRewarsTableMainToken["rows"].Value<JArray>();
if (propertiesArray != null)
{
JArray propertiesRewardTable = AssetsUtility.GetPropertyTagItemData<JArray>(propertiesArray, "Default", "properties");
if (propertiesRewardTable != null)
{
JToken templateIdToken = propertiesRewardTable.Where(item => string.Equals(item["name"].Value<string>(), "TemplateId")).FirstOrDefault();
if (templateIdToken != null)
{
string templateId = templateIdToken["tag_data"].Value<string>();
if (templateId.Contains(":"))
templateId = templateId.Split(':')[1];
string templateIdPath = AssetEntries.AssetEntriesDict.Where(x => x.Key.ToLowerInvariant().Contains("/" + templateId.ToLowerInvariant() + ".uasset")).Select(d => d.Key).FirstOrDefault();
if (!string.IsNullOrEmpty(templateIdPath))
{
rewardPath = templateIdPath.Substring(0, templateIdPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase));
}
JToken quantityToken = propertiesRewardTable.Where(item => string.Equals(item["name"].Value<string>(), "Quantity")).FirstOrDefault();
if (quantityToken != null)
{
rewardQuantity = quantityToken["tag_data"].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);
}
BundleData.Add(currentData);
}
}
//catch stage AFTER adding the current quest to the list
if (rewardsDataArray != null)
//catch stage AFTER adding the current quest to the list
if (rewardsDataArray != null)
{
foreach (JToken token in rewardsDataArray)
{
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 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)
{
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))
{
//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)));
}
new UpdateMyProcessEvents(System.IO.Path.GetFileNameWithoutExtension(primaryAssetNameFullPath), "Waiting").Update();
GetQuestData(BundleProperties, primaryAssetNameFullPath.Substring(0, primaryAssetNameFullPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase)));
}
}
}

View File

@ -9,7 +9,7 @@ using FProp = FModel.Properties.Settings;
namespace FModel.Methods.Assets.IconCreator.ChallengeID
{
class ChallengeCompletionRewards
static class ChallengeCompletionRewards
{
public static void DrawChallengeCompletion(JArray AssetProperties, SolidColorBrush PrimaryColor, SolidColorBrush SecondaryColor, int y)
{

View File

@ -4,14 +4,13 @@ using System;
using System.Globalization;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using FProp = FModel.Properties.Settings;
namespace FModel.Methods.Assets.IconCreator.ChallengeID
{
class ChallengeIconDesign
static class ChallengeIconDesign
{
public static bool isBanner { get; set; }
public static int y { get; set; }
@ -211,7 +210,7 @@ namespace FModel.Methods.Assets.IconCreator.ChallengeID
if (!isBundleLevelup)
{
IconCreator.ICDrawingContext.DrawRectangle(ChallengesUtility.DarkBrush(PrimaryColor, 0.3f), null, new Rect(0, y, 1024, 40));
DrawUnlockType(PrimaryColor, SecondaryColor, "/FortniteGame/Content/UI/Foundation/Textures/Icons/Items/T-FNBR-MissionIcon-L", y);
DrawUnlockType(PrimaryColor, "/FortniteGame/Content/UI/Foundation/Textures/Icons/Items/T-FNBR-MissionIcon-L", y);
isBundleLevelup = true;
y += 40;
}
@ -220,7 +219,7 @@ namespace FModel.Methods.Assets.IconCreator.ChallengeID
if (!isRequiresBattlePass)
{
IconCreator.ICDrawingContext.DrawRectangle(ChallengesUtility.DarkBrush(PrimaryColor, 0.3f), null, new Rect(0, y, 1024, 40));
DrawUnlockType(PrimaryColor, SecondaryColor, "/FortniteGame/Content/UI/Foundation/Textures/Icons/Items/T-FNBR-BattlePass-L", y);
DrawUnlockType(PrimaryColor, "/FortniteGame/Content/UI/Foundation/Textures/Icons/Items/T-FNBR-BattlePass-L", y);
isRequiresBattlePass = true;
y += 40;
}
@ -326,7 +325,7 @@ namespace FModel.Methods.Assets.IconCreator.ChallengeID
new UpdateMyConsole("• ------------------------------ •", CColors.White, true).Append();
}
private static void DrawUnlockType(SolidColorBrush PrimaryColor, SolidColorBrush SecondaryColor, string path, int y)
private static void DrawUnlockType(SolidColorBrush PrimaryColor, string path, int y)
{
Stream image = AssetsUtility.GetStreamImageFromPath(path);
if (image != null)

View File

@ -1,9 +1,6 @@
using FModel.Methods.Utilities;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PakReader;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
@ -13,8 +10,10 @@ using System.Windows.Media.Imaging;
namespace FModel.Methods.Assets.IconCreator.ChallengeID
{
class ChallengeRewards
static class ChallengeRewards
{
private const string UNKNOWN_ICON = "pack://application:,,,/Resources/unknown512.png";
public static void DrawRewards(string path, string quantity, int y)
{
if (!string.IsNullOrEmpty(path))
@ -64,43 +63,40 @@ namespace FModel.Methods.Assets.IconCreator.ChallengeID
if (!string.IsNullOrEmpty(assetPath))
{
string jsonData = AssetsUtility.GetAssetJsonDataByPath(assetPath.Substring(0, assetPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase)));
if (jsonData != null)
if (jsonData != null && AssetsUtility.IsValidJson(jsonData))
{
if (AssetsUtility.IsValidJson(jsonData))
JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
if (AssetMainToken != null)
{
JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
if (AssetMainToken != null)
JArray propertiesArray = AssetMainToken["rows"].Value<JArray>();
if (propertiesArray != null)
{
JArray propertiesArray = AssetMainToken["rows"].Value<JArray>();
if (propertiesArray != null)
JArray target = AssetsUtility.GetPropertyTagItemData<JArray>(propertiesArray, bannerName, "properties");
if (target != null)
{
JArray target = AssetsUtility.GetPropertyTagItemData<JArray>(propertiesArray, bannerName, "properties");
if (target != null)
JToken largeImage = target.FirstOrDefault(x => string.Equals(x["name"].Value<string>(), "LargeImage"));
JToken smallImage = target.FirstOrDefault(x => string.Equals(x["name"].Value<string>(), "SmallImage"));
if (largeImage != null || smallImage != 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)
{
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))
{
string texturePath = FoldersUtility.FixFortnitePath(assetPathName.Value<string>());
using (Stream image = AssetsUtility.GetStreamImageFromPath(texturePath))
if (image != null)
{
if (image != null)
{
BitmapImage bmp = new BitmapImage();
bmp.BeginInit();
bmp.CacheOption = BitmapCacheOption.OnLoad;
bmp.StreamSource = image;
bmp.EndInit();
bmp.Freeze();
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));
}
IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(902, y + 3, 64, 64));
}
}
}
@ -115,7 +111,7 @@ namespace FModel.Methods.Assets.IconCreator.ChallengeID
BitmapImage bmp = new BitmapImage();
bmp.BeginInit();
bmp.CacheOption = BitmapCacheOption.OnLoad;
bmp.StreamSource = Application.GetResourceStream(new Uri("pack://application:,,,/Resources/unknown512.png")).Stream;
bmp.StreamSource = Application.GetResourceStream(new Uri(UNKNOWN_ICON)).Stream;
bmp.EndInit();
bmp.Freeze();
IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(902, y + 3, 64, 64));
@ -174,7 +170,7 @@ namespace FModel.Methods.Assets.IconCreator.ChallengeID
BitmapImage bmp = new BitmapImage();
bmp.BeginInit();
bmp.CacheOption = BitmapCacheOption.OnLoad;
bmp.StreamSource = Application.GetResourceStream(new Uri("pack://application:,,,/Resources/unknown512.png")).Stream;
bmp.StreamSource = Application.GetResourceStream(new Uri(UNKNOWN_ICON)).Stream;
bmp.EndInit();
bmp.Freeze();
IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(902, y + 3, 64, 64));
@ -184,24 +180,21 @@ namespace FModel.Methods.Assets.IconCreator.ChallengeID
private static void DrawImageFromTagData(string assetPath, string quantity, int y, int mode = 0)
{
string jsonData = AssetsUtility.GetAssetJsonDataByPath(assetPath);
if (jsonData != null)
if (jsonData != null && AssetsUtility.IsValidJson(jsonData))
{
if (AssetsUtility.IsValidJson(jsonData))
JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
if (AssetMainToken != null)
{
JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
if (AssetMainToken != null)
{
JArray AssetProperties = AssetMainToken["properties"].Value<JArray>();
DrawLargeSmallImage(AssetProperties, quantity, y, mode);
}
JArray AssetProperties = AssetMainToken["properties"].Value<JArray>();
DrawLargeSmallImage(AssetProperties, quantity, y, mode);
}
}
}
private static void DrawLargeSmallImage(JArray propertiesArray, string quantity, int y, int mode = 0)
{
JToken largePreviewImage = propertiesArray.Where(x => string.Equals(x["name"].Value<string>(), "LargePreviewImage")).FirstOrDefault();
JToken smallPreviewImage = propertiesArray.Where(x => string.Equals(x["name"].Value<string>(), "SmallPreviewImage")).FirstOrDefault();
JToken largePreviewImage = propertiesArray.FirstOrDefault(x => string.Equals(x["name"].Value<string>(), "LargePreviewImage"));
JToken smallPreviewImage = propertiesArray.FirstOrDefault(x => string.Equals(x["name"].Value<string>(), "SmallPreviewImage"));
if (largePreviewImage != null || smallPreviewImage != null)
{
JToken assetPathName =

View File

@ -1,8 +1,5 @@
using FModel.Methods.Utilities;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PakReader;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
@ -12,7 +9,7 @@ using System.Windows.Media.Imaging;
namespace FModel.Methods.Assets.IconCreator.HeroID
{
class HeroGameplayDefinition
static class HeroGameplayDefinition
{
private static int _borderY = 518;
private static int _textY = 550;
@ -27,26 +24,23 @@ namespace FModel.Methods.Assets.IconCreator.HeroID
if (!string.IsNullOrEmpty(assetPath))
{
string jsonData = AssetsUtility.GetAssetJsonDataByPath(assetPath, false, assetPath.Substring(0, assetPath.LastIndexOf(".")));
if (jsonData != null)
if (jsonData != null && AssetsUtility.IsValidJson(jsonData))
{
if (AssetsUtility.IsValidJson(jsonData))
JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
if (AssetMainToken != null)
{
JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
if (AssetMainToken != null)
JArray heroGameplayProperties = AssetMainToken["properties"].Value<JArray>();
if (heroGameplayProperties != null)
{
JArray heroGameplayProperties = AssetMainToken["properties"].Value<JArray>();
if (heroGameplayProperties != null)
{
_borderY = 518;
_textY = 550;
_imageY = 519;
_borderY = 518;
_textY = 550;
_imageY = 519;
DrawHeroPerk(heroGameplayProperties);
DrawTierAbilityKits(heroGameplayProperties);
DrawHeroPerk(heroGameplayProperties);
DrawTierAbilityKits(heroGameplayProperties);
//RESIZE
IconCreator.ICDrawingContext.DrawRectangle(Brushes.Transparent, null, new Rect(new Point(0, 0), new Size(515, 560 + 35 * 3)));
}
//RESIZE
IconCreator.ICDrawingContext.DrawRectangle(Brushes.Transparent, null, new Rect(new Point(0, 0), new Size(515, 560 + 35 * 3)));
}
}
}
@ -123,72 +117,69 @@ namespace FModel.Methods.Assets.IconCreator.HeroID
if (!string.IsNullOrEmpty(assetPath))
{
string jsonData = AssetsUtility.GetAssetJsonDataByPath(assetPath);
if (jsonData != null)
if (jsonData != null && AssetsUtility.IsValidJson(jsonData))
{
if (AssetsUtility.IsValidJson(jsonData))
JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
if (AssetMainToken != null)
{
JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
if (AssetMainToken != null)
JArray abilityKitProperties = AssetMainToken["properties"].Value<JArray>();
if (abilityKitProperties != 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 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)
{
JToken resourceObjectToken = AssetsUtility.GetPropertyTagOuterImport<JToken>(iconBrushArray, "ResourceObject");
if (resourceObjectToken != null)
string texturePath = FoldersUtility.FixFortnitePath(resourceObjectToken.Value<string>());
using (Stream image = AssetsUtility.GetStreamImageFromPath(texturePath))
{
string texturePath = FoldersUtility.FixFortnitePath(resourceObjectToken.Value<string>());
using (Stream image = AssetsUtility.GetStreamImageFromPath(texturePath))
if (image != null)
{
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)
{
BitmapImage bmp = new BitmapImage();
bmp.BeginInit();
bmp.CacheOption = BitmapCacheOption.OnLoad;
bmp.StreamSource = image;
bmp.EndInit();
bmp.Freeze();
string displayName = AssetTranslations.SearchTranslation(name_namespace.Value<string>(), name_key.Value<string>(), name_source_string.Value<string>());
//background
IconCreator.ICDrawingContext.DrawRectangle(new SolidColorBrush(ImagesUtility.ParseColorFromHex("#6D6D6D")), null, new Rect(0, _borderY, 515, 34));
Typeface typeface = new Typeface(TextsUtility.FBurbank, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
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>());
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;
Typeface typeface = new Typeface(TextsUtility.FBurbank, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
Point textLocation = new Point(50, _textY - formattedText.Height);
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;
IconCreator.ICDrawingContext.DrawText(formattedText, textLocation);
}
IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(9, _imageY, 32, 32));
_borderY += 37;
_textY += 37;
_imageY += 37;
}
}
}

View File

@ -68,24 +68,21 @@ namespace FModel.Methods.Assets.IconCreator
private static void DrawImageFromTagData(string assetPath)
{
string jsonData = AssetsUtility.GetAssetJsonDataByPath(assetPath);
if (jsonData != null)
if (jsonData != null && AssetsUtility.IsValidJson(jsonData))
{
if (AssetsUtility.IsValidJson(jsonData))
JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
if (AssetMainToken != null)
{
JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
if (AssetMainToken != null)
{
JArray AssetProperties = AssetMainToken["properties"].Value<JArray>();
DrawLargeSmallImage(AssetProperties);
}
JArray AssetProperties = AssetMainToken["properties"].Value<JArray>();
DrawLargeSmallImage(AssetProperties);
}
}
}
private static void DrawLargeSmallImage(JArray propertiesArray)
{
JToken largePreviewImage = propertiesArray.Where(x => string.Equals(x["name"].Value<string>(), "LargePreviewImage")).FirstOrDefault();
JToken smallPreviewImage = propertiesArray.Where(x => string.Equals(x["name"].Value<string>(), "SmallPreviewImage")).FirstOrDefault();
JToken largePreviewImage = propertiesArray.FirstOrDefault(x => string.Equals(x["name"].Value<string>(), "LargePreviewImage"));
JToken smallPreviewImage = propertiesArray.FirstOrDefault(x => string.Equals(x["name"].Value<string>(), "SmallPreviewImage"));
if (largePreviewImage != null || smallPreviewImage != null)
{
JToken assetPathName =
@ -138,34 +135,31 @@ namespace FModel.Methods.Assets.IconCreator
private static void DrawFeaturedImage(JArray AssetProperties, string displayAssetPath)
{
string jsonData = AssetsUtility.GetAssetJsonDataByPath(displayAssetPath);
if (jsonData != null)
if (jsonData != null && AssetsUtility.IsValidJson(jsonData))
{
if (AssetsUtility.IsValidJson(jsonData))
{
FWindow.FCurrentAsset = Path.GetFileName(displayAssetPath);
FWindow.FCurrentAsset = Path.GetFileName(displayAssetPath);
JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
if (AssetMainToken != null)
JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
if (AssetMainToken != null)
{
JArray displayAssetProperties = AssetMainToken["properties"].Value<JArray>();
switch (displayAssetPath.Substring(displayAssetPath.LastIndexOf("/", StringComparison.InvariantCultureIgnoreCase) + 1))
{
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;
}
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;
}
}
}
@ -209,52 +203,46 @@ namespace FModel.Methods.Assets.IconCreator
{
//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 (!string.IsNullOrEmpty(renderSwitchPath) && (renderSwitchPath.Contains("MI_UI_FeaturedRenderSwitch_") ||
renderSwitchPath.Contains("M-Wraps-StreetDemon") ||
renderSwitchPath.Contains("/FortniteGame/Content/UI/Foundation/Textures/Icons/Wraps/FeaturedMaterials/")))
{
if (renderSwitchPath.Contains("MI_UI_FeaturedRenderSwitch_") ||
renderSwitchPath.Contains("M-Wraps-StreetDemon") ||
renderSwitchPath.Contains("/FortniteGame/Content/UI/Foundation/Textures/Icons/Wraps/FeaturedMaterials/"))
string jsonData = AssetsUtility.GetAssetJsonDataByPath(renderSwitchPath.Substring(0, renderSwitchPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase)));
if (jsonData != null && AssetsUtility.IsValidJson(jsonData))
{
string jsonData = AssetsUtility.GetAssetJsonDataByPath(renderSwitchPath.Substring(0, renderSwitchPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase)));
if (jsonData != null)
JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
if (AssetMainToken != null)
{
if (AssetsUtility.IsValidJson(jsonData))
JArray renderSwitchProperties = AssetMainToken["properties"].Value<JArray>();
if (renderSwitchProperties != null)
{
JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
if (AssetMainToken != null)
JArray textureParameterArray = AssetsUtility.GetPropertyTagText<JArray>(renderSwitchProperties, "TextureParameterValues", "data");
textureParameterArray = textureParameterArray[textureParameterArray.Count() > 1 && !AssetsLoader.ExportType.Equals("AthenaItemWrapDefinition") ? 1 : 0]["struct_type"]["properties"].Value<JArray>();
if (textureParameterArray != null)
{
JArray renderSwitchProperties = AssetMainToken["properties"].Value<JArray>();
if (renderSwitchProperties != null)
JToken parameterValueToken = AssetsUtility.GetPropertyTagOuterImport<JToken>(textureParameterArray, "ParameterValue");
if (parameterValueToken != null)
{
JArray textureParameterArray = AssetsUtility.GetPropertyTagText<JArray>(renderSwitchProperties, "TextureParameterValues", "data");
textureParameterArray = textureParameterArray[textureParameterArray.Count() > 1 && !AssetsLoader.ExportType.Equals("AthenaItemWrapDefinition") ? 1 : 0]["struct_type"]["properties"].Value<JArray>();
if (textureParameterArray != null)
string texturePath = FoldersUtility.FixFortnitePath(parameterValueToken.Value<string>());
using (Stream image = AssetsUtility.GetStreamImageFromPath(texturePath))
{
JToken parameterValueToken = AssetsUtility.GetPropertyTagOuterImport<JToken>(textureParameterArray, "ParameterValue");
if (parameterValueToken != null)
if (image != 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();
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);
}
IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(3, 3, 509, 509));
}
}
if (AssetsLoader.ExportType == "AthenaItemWrapDefinition" && texturePath.Contains("WeaponRenders"))
{
DrawAdditionalWrapImage(AssetProperties);
}
}
}
}
@ -266,8 +254,8 @@ namespace FModel.Methods.Assets.IconCreator
private static void DrawAdditionalWrapImage(JArray AssetProperties)
{
JToken largePreviewImage = AssetProperties.Where(x => string.Equals(x["name"].Value<string>(), "LargePreviewImage")).FirstOrDefault();
JToken smallPreviewImage = AssetProperties.Where(x => string.Equals(x["name"].Value<string>(), "SmallPreviewImage")).FirstOrDefault();
JToken largePreviewImage = AssetProperties.FirstOrDefault(x => string.Equals(x["name"].Value<string>(), "LargePreviewImage"));
JToken smallPreviewImage = AssetProperties.FirstOrDefault(x => string.Equals(x["name"].Value<string>(), "SmallPreviewImage"));
if (largePreviewImage != null || smallPreviewImage != null)
{
JToken assetPathName =

View File

@ -152,9 +152,7 @@ namespace FModel.Methods.Assets.IconCreator
JArray colorsArray = AssetsUtility.GetPropertyTagStruct<JArray>(propertiesArray, "Colors", "properties");
if (colorsArray != null)
{
DrawWithInGameColors(colorsArray,
string.Equals(seriesFullPath, "/FortniteGame/Content/Athena/Items/Cosmetics/Series/MarvelSeries.uasset") ? true : false //REVERSE COLORS IF MARVEL
); //BECAUSE IT LOOKS WEIRD
DrawWithInGameColors(colorsArray, string.Equals(seriesFullPath, "/FortniteGame/Content/Athena/Items/Cosmetics/Series/MarvelSeries.uasset")); //REVERSE COLORS IF MARVEL BECAUSE IT LOOKS WEIRD
}
JToken backgroundTextureToken = AssetsUtility.GetPropertyTagText<JToken>(propertiesArray, "BackgroundTexture", "asset_path_name");

View File

@ -1,8 +1,6 @@
using FModel.Methods.Utilities;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PakReader;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
@ -12,76 +10,73 @@ using System.Windows.Media.Imaging;
namespace FModel.Methods.Assets.IconCreator.WeaponID
{
class IconAmmoData
static class IconAmmoData
{
public static void DrawIconAmmoData(string path)
{
string jsonData = AssetsUtility.GetAssetJsonDataByPath(path);
if (jsonData != null)
if (jsonData != null && AssetsUtility.IsValidJson(jsonData))
{
if (AssetsUtility.IsValidJson(jsonData))
dynamic AssetData = JsonConvert.DeserializeObject(jsonData);
JToken AssetAmmo = JArray.FromObject(AssetData)[0];
JToken largePreviewImage = AssetAmmo["properties"].Value<JArray>().FirstOrDefault(x => string.Equals(x["name"].Value<string>(), "LargePreviewImage"));
JToken smallPreviewImage = AssetAmmo["properties"].Value<JArray>().FirstOrDefault(x => string.Equals(x["name"].Value<string>(), "SmallPreviewImage"));
if (largePreviewImage != null || smallPreviewImage != null)
{
dynamic AssetData = JsonConvert.DeserializeObject(jsonData);
JToken AssetAmmo = JArray.FromObject(AssetData)[0];
JToken assetPathName =
largePreviewImage != null ? largePreviewImage["tag_data"]["asset_path_name"] :
smallPreviewImage != null ? smallPreviewImage["tag_data"]["asset_path_name"] : null;
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)
if (assetPathName != 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))
{
string texturePath = FoldersUtility.FixFortnitePath(assetPathName.Value<string>());
using (Stream image = AssetsUtility.GetStreamImageFromPath(texturePath))
if (image != null)
{
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)
{
BitmapImage bmp = new BitmapImage();
bmp.BeginInit();
bmp.CacheOption = BitmapCacheOption.OnLoad;
bmp.StreamSource = image;
bmp.EndInit();
bmp.Freeze();
string displayName = AssetTranslations.SearchTranslation(name_namespace.Value<string>(), name_key.Value<string>(), name_source_string.Value<string>());
//RESIZE
IconCreator.ICDrawingContext.DrawRectangle(Brushes.Transparent, null, new Rect(new Point(0, 0), new Size(515, 560)));
Typeface typeface = new Typeface(TextsUtility.FBurbank, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
//background
IconCreator.ICDrawingContext.DrawRectangle(new SolidColorBrush(ImagesUtility.ParseColorFromHex("#6D6D6D")), null, new Rect(0, 518, 515, 34));
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;
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>());
Point textLocation = new Point(0, 550 - formattedText.Height);
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));
IconCreator.ICDrawingContext.DrawText(formattedText, textLocation);
}
IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(9, 519, 32, 32));
}
}
}

View File

@ -1,9 +1,7 @@
using FModel.Methods.Utilities;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PakReader;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Windows;
@ -12,9 +10,12 @@ using System.Windows.Media.Imaging;
namespace FModel.Methods.Assets.IconCreator.WeaponID
{
class WeaponStats
static class WeaponStats
{
private static JArray WeaponsStatsArray { get; set; }
private const string RELOAD_CUSTOM_ICON = "pack://application:,,,/Resources/reload64.png";
private const string MAGSIZE_CUSTOM_ICON = "pack://application:,,,/Resources/clipSize64.png";
private const string DAMAGE_CUSTOM_ICON = "pack://application:,,,/Resources/dmg64.png";
public static void DrawWeaponStats(string file, string rowname)
{
@ -25,15 +26,12 @@ namespace FModel.Methods.Assets.IconCreator.WeaponID
if (!string.IsNullOrEmpty(filepath))
{
string jsonData = AssetsUtility.GetAssetJsonDataByPath(filepath.Substring(0, filepath.LastIndexOf(".")), true);
if (jsonData != null)
if (jsonData != null && AssetsUtility.IsValidJson(jsonData))
{
if (AssetsUtility.IsValidJson(jsonData))
{
dynamic AssetData = JsonConvert.DeserializeObject(jsonData);
JArray AssetArray = JArray.FromObject(AssetData);
WeaponsStatsArray = AssetArray[0]["rows"].Value<JArray>();
SearchWeaponStats(rowname);
}
dynamic AssetData = JsonConvert.DeserializeObject(jsonData);
JArray AssetArray = JArray.FromObject(AssetData);
WeaponsStatsArray = AssetArray[0]["rows"].Value<JArray>();
SearchWeaponStats(rowname);
}
}
}
@ -63,7 +61,7 @@ namespace FModel.Methods.Assets.IconCreator.WeaponID
BitmapImage bmp = new BitmapImage();
bmp.BeginInit();
bmp.CacheOption = BitmapCacheOption.OnLoad;
bmp.UriSource = new Uri("pack://application:,,,/Resources/reload64.png");
bmp.UriSource = new Uri(RELOAD_CUSTOM_ICON);
bmp.EndInit();
bmp.Freeze();
@ -97,7 +95,7 @@ namespace FModel.Methods.Assets.IconCreator.WeaponID
BitmapImage bmp = new BitmapImage();
bmp.BeginInit();
bmp.CacheOption = BitmapCacheOption.OnLoad;
bmp.UriSource = new Uri("pack://application:,,,/Resources/clipSize64.png");
bmp.UriSource = new Uri(MAGSIZE_CUSTOM_ICON);
bmp.EndInit();
bmp.Freeze();
@ -131,7 +129,7 @@ namespace FModel.Methods.Assets.IconCreator.WeaponID
BitmapImage bmp = new BitmapImage();
bmp.BeginInit();
bmp.CacheOption = BitmapCacheOption.OnLoad;
bmp.UriSource = new Uri("pack://application:,,,/Resources/dmg64.png");
bmp.UriSource = new Uri(DAMAGE_CUSTOM_ICON);
bmp.EndInit();
bmp.Freeze();

View File

@ -301,7 +301,7 @@ namespace FModel.Methods.PAKs
//FILTER WITH THE OVERRIDED EQUALS METHOD (CHECKING FILE NAME AND FILE UNCOMPRESSED SIZE)
DebugHelper.WriteLine($".PAKs: Comparing...\t File Size Check: {FProp.Default.FDiffFileSize}");
IEnumerable<FPakEntry> newAssets = LocalEntries.ToArray().Except(BackupEntries);
IEnumerable<FPakEntry> newAssets = LocalEntries.Except(BackupEntries);
DebugHelper.WriteLine(".PAKs: Compared");
//ADD TO TREE

View File

@ -12,12 +12,9 @@ namespace FModel.Methods.PAKs
{
static class RegisterFromPath
{
public static string PAK_PATH = FProp.Default.FPak_Path;
private static string datFilePath = string.Empty;
public static void FilterPAKs()
{
if (string.IsNullOrEmpty(FProp.Default.FPak_Path) && !string.IsNullOrEmpty(datFilePath))
if (string.IsNullOrEmpty(FProp.Default.FPak_Path))
{
string AutoPath = GetGameInstallLocation();
if (!string.IsNullOrEmpty(AutoPath))
@ -28,12 +25,10 @@ namespace FModel.Methods.PAKs
FProp.Default.FPak_Path = AutoPath;
FProp.Default.Save();
PAK_PATH = FProp.Default.FPak_Path;
}
}
if (Directory.Exists(PAK_PATH))
if (Directory.Exists(FProp.Default.FPak_Path))
{
PAKEntries.PAKEntriesList = new List<PAKInfosEntry>();
foreach (string Pak in GetPAKsFromPath())
@ -43,7 +38,7 @@ namespace FModel.Methods.PAKs
string PAKGuid = PAKsUtility.GetPAKGuid(Pak);
DebugHelper.WriteLine("Registering " + Pak + " with GUID " + PAKGuid + " (" + PAKsUtility.GetEpicGuid(PAKGuid) + ")");
PAKEntries.PAKEntriesList.Add(new PAKInfosEntry(Pak, PAKGuid, string.Equals(PAKGuid, "0-0-0-0") ? false : true));
PAKEntries.PAKEntriesList.Add(new PAKInfosEntry(Pak, PAKGuid, !string.Equals(PAKGuid, "0-0-0-0")));
FWindow.FMain.Dispatcher.InvokeAsync(() =>
{
MenuItem MI_Pak = new MenuItem();
@ -74,24 +69,34 @@ namespace FModel.Methods.PAKs
private static IEnumerable<string> GetPAKsFromPath()
{
return Directory.GetFiles(PAK_PATH, "*.pak", SearchOption.AllDirectories);
return Directory.GetFiles(FProp.Default.FPak_Path, "*.pak", SearchOption.AllDirectories);
}
private static string GetEpicDirectory()
{
foreach (DriveInfo drive in DriveInfo.GetDrives())
{
string path = $"{drive.Name}ProgramData\\Epic";
if (Directory.Exists(path))
{
return path;
}
}
return string.Empty;
}
private static string GetEpicDirectory() => Directory.Exists(@"C:\ProgramData\Epic") ? @"C:\ProgramData\Epic" : Directory.Exists(@"D:\ProgramData\Epic") ? @"D:\ProgramData\Epic" : @"E:\ProgramData\Epic";
private static string GetDatFile()
{
if (!string.IsNullOrEmpty(datFilePath))
return datFilePath;
if (File.Exists($@"{GetEpicDirectory()}\UnrealEngineLauncher\LauncherInstalled.dat"))
string ePath = $"{GetEpicDirectory()}\\UnrealEngineLauncher\\LauncherInstalled.dat";
if (File.Exists(ePath))
{
datFilePath = $@"{GetEpicDirectory()}\UnrealEngineLauncher\LauncherInstalled.dat";
DebugHelper.WriteLine("EPIC .dat file at " + datFilePath);
DebugHelper.WriteLine("EPIC .dat file at " + ePath);
return ePath;
}
else
DebugHelper.WriteLine("EPIC .dat file not found");
return datFilePath;
return string.Empty;
}
private static string GetGameInstallLocation()
@ -105,8 +110,8 @@ namespace FModel.Methods.PAKs
private static JToken GetGameData()
{
GetDatFile();
if (!string.IsNullOrEmpty(datFilePath))
string datFilePath = GetDatFile();
if (!string.IsNullOrEmpty(datFilePath) && File.Exists(datFilePath))
{
string jsonData = File.ReadAllText(datFilePath);
if (AssetsUtility.IsValidJson(jsonData))
@ -116,7 +121,7 @@ namespace FModel.Methods.PAKs
{
JArray installationListArray = games["InstallationList"].Value<JArray>();
if (installationListArray != null)
return installationListArray.Where(game => string.Equals(game["AppName"].Value<string>(), "Fortnite")).FirstOrDefault();
return installationListArray.FirstOrDefault(game => string.Equals(game["AppName"].Value<string>(), "Fortnite"));
DebugHelper.WriteLine("Fortnite not found in .dat file");
}

View File

@ -30,7 +30,7 @@ namespace FModel.Methods.TreeViewModel
if (item == null)
return;
if (e.NewValue is bool == false)
if (!(e.NewValue is bool))
return;
if ((bool)e.NewValue)

View File

@ -104,7 +104,7 @@ namespace FModel.Methods.Utilities
}
return toReturn;
}
return null;
return new List<FPakEntry>();
}
public static AssetReader GetAssetReader(Stream[] AssetStreamList)
@ -328,7 +328,7 @@ namespace FModel.Methods.Utilities
}
return bytes.ToArray();
}
return null;
return new byte[0];
}
public static Stream GetStreamImageFromPath(string AssetFullPath)
@ -369,7 +369,7 @@ namespace FModel.Methods.Utilities
AssetReader ar = GetAssetReader(AssetStreamArray);
if (ar != null)
{
ExportObject eo = ar.Exports.Where(x => x is Texture2D).FirstOrDefault();
ExportObject eo = ar.Exports.FirstOrDefault(x => x is Texture2D);
if (eo != null)
{
SKImage image = ((Texture2D)eo).GetImage();
@ -466,7 +466,7 @@ namespace FModel.Methods.Utilities
{
try
{
JToken obj = JToken.Parse(strInput);
JToken.Parse(strInput);
return true;
}
catch (Exception)

View File

@ -1,18 +1,16 @@
using FModel.Methods.Assets.IconCreator.ChallengeID;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PakReader;
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows;
using System.Windows.Media;
namespace FModel.Methods.Utilities
{
class ChallengesUtility
static class ChallengesUtility
{
private static readonly Random _Random = new Random(Environment.TickCount);
private const string UNKNOWN_ICON = "pack://application:,,,/Resources/unknown512.png";
private static int RandomNext(int minValue, int maxValue)
{
@ -126,25 +124,22 @@ namespace FModel.Methods.Utilities
if (string.Equals(path, "/FortniteGame/Content/Athena/UI/Challenges/Art/TileImages/M_UI_ChallengeTile_PCB"))
{
string jsonData = AssetsUtility.GetAssetJsonDataByPath(path);
if (jsonData != null)
if (jsonData != null && AssetsUtility.IsValidJson(jsonData))
{
if (AssetsUtility.IsValidJson(jsonData))
JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
if (AssetMainToken != null)
{
JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
if (AssetMainToken != null)
JArray renderSwitchProperties = AssetMainToken["properties"].Value<JArray>();
if (renderSwitchProperties != 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)
{
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)
{
JToken parameterValueToken = AssetsUtility.GetPropertyTagOuterImport<JToken>(textureParameterArray, "ParameterValue");
if (parameterValueToken != null)
{
string texturePath = FoldersUtility.FixFortnitePath(parameterValueToken.Value<string>());
return AssetsUtility.GetStreamImageFromPath(texturePath);
}
string texturePath = FoldersUtility.FixFortnitePath(parameterValueToken.Value<string>());
return AssetsUtility.GetStreamImageFromPath(texturePath);
}
}
}
@ -156,7 +151,7 @@ namespace FModel.Methods.Utilities
return AssetsUtility.GetStreamImageFromPath(path);
}
}
return Application.GetResourceStream(new Uri("pack://application:,,,/Resources/unknown512.png")).Stream;
return Application.GetResourceStream(new Uri(UNKNOWN_ICON)).Stream;
}
}
}

View File

@ -4,7 +4,7 @@ using FProp = FModel.Properties.Settings;
namespace FModel.Methods.Utilities
{
class DebugHelper
static class DebugHelper
{
public static Logger Logger { get; private set; }

View File

@ -9,6 +9,9 @@ namespace FModel.Methods.Utilities
{
static class EndpointsUtility
{
private const string DROPBOX_JSON = "https://dl.dropbox.com/s/0ykcue03qweb98r/FModel.json?dl=0";
private const string BENBOT_AES = "http://benbotfn.tk:8080/api/aes";
public static string GetEndpoint(string url)
{
DebugHelper.WriteLine("Sending GET request to " + url);
@ -25,7 +28,7 @@ namespace FModel.Methods.Utilities
{
if (DLLImport.IsInternetAvailable())
{
string EndpointContent = GetEndpoint("https://dl.dropbox.com/s/0ykcue03qweb98r/FModel.json?dl=0");
string EndpointContent = GetEndpoint(DROPBOX_JSON);
if (!string.IsNullOrEmpty(EndpointContent))
{
List<BackupInfosEntry> ListToReturn = new List<BackupInfosEntry>();
@ -62,14 +65,14 @@ namespace FModel.Methods.Utilities
{
DebugHelper.WriteLine("Dropbox: Error while checking for backup files");
new UpdateMyConsole("Error while checking for backup files", CColors.Red, true).Append();
return null;
return new List<BackupInfosEntry>();
}
}
else
{
DebugHelper.WriteLine("Dropbox: Your internet connection is currently unavailable, can't check for backup files at the moment.");
new UpdateMyConsole("Your internet connection is currently unavailable, can't check for backup files at the moment.", CColors.Blue, true).Append();
return null;
return new List<BackupInfosEntry>();
}
}
@ -77,7 +80,7 @@ namespace FModel.Methods.Utilities
{
if (DLLImport.IsInternetAvailable())
{
string EndpointContent = GetEndpoint("http://benbotfn.tk:8080/api/aes");
string EndpointContent = GetEndpoint(BENBOT_AES);
if (!string.IsNullOrEmpty(EndpointContent))
{
if (string.IsNullOrEmpty(FProp.Default.FPak_MainAES))

View File

@ -14,7 +14,7 @@ namespace FModel.Methods.Utilities
public static Window GetOpenedWindow<T>(string name) where T : Window
{
return Application.Current.Windows.OfType<T>().Where(w => w.Title.Equals(name)).FirstOrDefault();
return Application.Current.Windows.OfType<T>().FirstOrDefault(w => w.Title.Equals(name));
}
}
}

View File

@ -24,8 +24,8 @@ namespace FModel.Methods.Utilities
public string LogFilePath { get; private set; }
private readonly object loggerLock = new object();
private ConcurrentQueue<string> messageQueue = new ConcurrentQueue<string>();
private StringBuilder sbMessages = new StringBuilder();
private readonly ConcurrentQueue<string> messageQueue = new ConcurrentQueue<string>();
private readonly StringBuilder sbMessages = new StringBuilder();
public Logger()
{
@ -142,7 +142,7 @@ namespace FModel.Methods.Utilities
return sbMessages.ToString();
}
return null;
return string.Empty;
}
}
@ -181,6 +181,7 @@ namespace FModel.Methods.Utilities
}
catch
{
//hello world :)
}
if (string.IsNullOrEmpty(productName))

View File

@ -72,13 +72,10 @@ namespace FModel.Methods.Utilities
{
if (AESEntries.AESEntriesList != null && AESEntries.AESEntriesList.Any())
{
AESInfosEntry AESFromManager = AESEntries.AESEntriesList.Where(x => string.Equals(x.ThePAKName, Path.GetFileNameWithoutExtension(Pak.ThePAKPath))).FirstOrDefault();
if (!string.IsNullOrEmpty(AESFromManager.ThePAKKey))
AESInfosEntry AESFromManager = AESEntries.AESEntriesList.FirstOrDefault(x => string.Equals(x.ThePAKName, Path.GetFileNameWithoutExtension(Pak.ThePAKPath)));
if (!string.IsNullOrEmpty(AESFromManager.ThePAKKey) && string.Equals(AESFromManager.ThePAKName, Path.GetFileNameWithoutExtension(MI_Pak.Header.ToString())))
{
if (string.Equals(AESFromManager.ThePAKName, Path.GetFileNameWithoutExtension(MI_Pak.Header.ToString())))
{
MI_Pak.IsEnabled = true;
}
MI_Pak.IsEnabled = true;
}
}
}

View File

@ -5,7 +5,8 @@ namespace FModel.Methods.Utilities
{
static class TextsUtility
{
public static readonly FontFamily FBurbank = new FontFamily(new Uri("pack://application:,,,/"), "./Resources/#Burbank Big Cd Bd");
public static readonly FontFamily Burbank = new FontFamily(new Uri("pack://application:,,,/"), "./Resources/#Burbank Big Cd Bk");
private const string BASE = "pack://application:,,,/";
public static readonly FontFamily FBurbank = new FontFamily(new Uri(BASE), "./Resources/#Burbank Big Cd Bd");
public static readonly FontFamily Burbank = new FontFamily(new Uri(BASE), "./Resources/#Burbank Big Cd Bk");
}
}

View File

@ -1,5 +1,4 @@
using FModel.Methods.TreeViewModel;
using System.ComponentModel;
using System.ComponentModel;
using System.Text;
using System.Windows;
using System.Windows.Controls;
@ -99,7 +98,7 @@ namespace FModel.Methods.Utilities
}
}
done = (found == false && done == false);
done = !found && !done;
}
}
}