diff --git a/FModel/Creator/Bases/BaseIcon.cs b/FModel/Creator/Bases/BaseIcon.cs
index b5d620cd..0141de45 100644
--- a/FModel/Creator/Bases/BaseIcon.cs
+++ b/FModel/Creator/Bases/BaseIcon.cs
@@ -134,7 +134,7 @@ namespace FModel.Creator.Bases
string IBase.DisplayName => DisplayName;
string IBase.Description => Description;
int IBase.Width => Size;
- int IBase.Height => Size + AdditionalSize;
+ int IBase.Height => Size;
int IBase.Margin => Margin;
}
}
diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj
index 35ffdad2..e617a429 100644
--- a/FModel/FModel.csproj
+++ b/FModel/FModel.csproj
@@ -135,6 +135,7 @@
+
diff --git a/FModel/Grabber/Manifests/ManifestGrabber.cs b/FModel/Grabber/Manifests/ManifestGrabber.cs
new file mode 100644
index 00000000..c2cf3a01
--- /dev/null
+++ b/FModel/Grabber/Manifests/ManifestGrabber.cs
@@ -0,0 +1,38 @@
+using EpicManifestParser.Objects;
+using FModel.Utils;
+using System;
+using System.Threading.Tasks;
+
+namespace FModel.Grabber.Manifests
+{
+ static class ManifestGrabber
+ {
+ public static async Task TryGetLatestManifestInfo()
+ {
+ if (IsExpired())
+ {
+ OAuth auth = await Endpoints.GetOAuthInfo();
+ if (auth != null)
+ {
+ Properties.Settings.Default.AccessToken = auth.AccessToken;
+ Properties.Settings.Default.LauncherExpiration = DateTimeOffset.Now.AddSeconds(Convert.ToDouble(auth.ExpiresIn)).ToUnixTimeMilliseconds();
+ Properties.Settings.Default.Save();
+ }
+ }
+
+ string ret = await Endpoints.GetStringEndpoint("https://launcher-public-service-prod06.ol.epicgames.com/launcher/api/public/assets/v2/platform/Windows/namespace/fn/catalogItem/4fe75bbc5a674f4f9b356b5c90567da5/app/Fortnite/label/Live", Properties.Settings.Default.AccessToken);
+ if (!string.IsNullOrEmpty(ret)) return new ManifestInfo(ret);
+ else return null;
+ }
+
+ private static bool IsExpired()
+ {
+ long currentTime = DateTimeOffset.Now.ToUnixTimeMilliseconds();
+ if ((currentTime - 60000) >= Properties.Settings.Default.LauncherExpiration)
+ {
+ return true;
+ }
+ return false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/FModel/Grabber/Paks/PaksGrabber.cs b/FModel/Grabber/Paks/PaksGrabber.cs
index 6d8b5c66..8d1dff8d 100644
--- a/FModel/Grabber/Paks/PaksGrabber.cs
+++ b/FModel/Grabber/Paks/PaksGrabber.cs
@@ -10,23 +10,29 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
+using EpicManifestParser.Objects;
+using System.Text.RegularExpressions;
+using FModel.Grabber.Manifests;
namespace FModel.Grabber.Paks
{
static class PaksGrabber
{
+ private static readonly Regex _pakFileRegex = new Regex(@"^FortniteGame/Content/Paks/.+\.pak$", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase);
+
public static async Task PopulateMenu()
{
PopulateBase();
- await Task.Run(() =>
+ await Task.Run(async () =>
{
if (string.IsNullOrEmpty(Properties.Settings.Default.PakPath))
{
- Application.Current.Dispatcher.Invoke(delegate
+ await Application.Current.Dispatcher.InvokeAsync(delegate
{
var launcher = new FLauncher();
- if ((bool)launcher.ShowDialog())
+ bool? result = launcher.ShowDialog();
+ if (result.HasValue && result.Value)
{
Properties.Settings.Default.PakPath = launcher.Path;
Properties.Settings.Default.Save();
@@ -34,12 +40,51 @@ namespace FModel.Grabber.Paks
});
}
- // define the current game thank to the pak path
- Folders.SetGameName(Properties.Settings.Default.PakPath);
-
// Add Pak Files
- if (Directory.Exists(Properties.Settings.Default.PakPath))
+ if (Properties.Settings.Default.PakPath.EndsWith(".manifest") && await ManifestGrabber.TryGetLatestManifestInfo().ConfigureAwait(false) is ManifestInfo manifestInfo)
{
+ var manifestData = await manifestInfo.DownloadManifestDataAsync();
+ Manifest manifest = new Manifest(manifestData, new ManifestOptions
+ {
+ ChunkBaseUri = new Uri("http://download.epicgames.com/Builds/Fortnite/CloudDir/ChunksV3/", UriKind.Absolute),
+ ChunkCacheDirectory = Directory.CreateDirectory(Path.Combine(Properties.Settings.Default.OutputPath, "PakChunks"))
+ });
+ int pakFiles = 0;
+
+ foreach (FileManifest fileManifest in manifest.FileManifests)
+ {
+ if (!_pakFileRegex.IsMatch(fileManifest.Name))
+ {
+ continue;
+ }
+
+ var pakFileName = fileManifest.Name.Replace('/', '\\');
+ PakFileReader pakFile = new PakFileReader(pakFileName, fileManifest.GetStream());
+
+ if (pakFiles++ == 0)
+ {
+ // define the current game thank to the pak path
+ Folders.SetGameName(pakFileName);
+
+ Globals.Game.Version = pakFile.Info.Version;
+ Globals.Game.SubVersion = pakFile.Info.SubVersion;
+ }
+
+ await Application.Current.Dispatcher.InvokeAsync(delegate
+ {
+ MenuItems.pakFiles.Add(new PakMenuItemViewModel
+ {
+ PakFile = pakFile,
+ IsEnabled = false
+ });
+ });
+ }
+ }
+ else if (Directory.Exists(Properties.Settings.Default.PakPath))
+ {
+ // define the current game thank to the pak path
+ Folders.SetGameName(Properties.Settings.Default.PakPath);
+
string[] paks = Directory.GetFiles(Properties.Settings.Default.PakPath, "*.pak");
for (int i = 0; i < paks.Length; i++)
{
@@ -53,7 +98,7 @@ namespace FModel.Grabber.Paks
Globals.Game.SubVersion = pakFile.Info.SubVersion;
}
- Application.Current.Dispatcher.Invoke(delegate
+ await Application.Current.Dispatcher.InvokeAsync(delegate
{
MenuItems.pakFiles.Add(new PakMenuItemViewModel
{
@@ -126,4 +171,4 @@ namespace FModel.Grabber.Paks
MenuItems.pakFiles.Add(new Separator { });
}
}
-}
+}
\ No newline at end of file
diff --git a/FModel/MainWindow.xaml b/FModel/MainWindow.xaml
index cf767f61..0b5f7e10 100644
--- a/FModel/MainWindow.xaml
+++ b/FModel/MainWindow.xaml
@@ -71,11 +71,6 @@
-