diff --git a/CUE4Parse b/CUE4Parse index 94b08d60..3ff8c179 160000 --- a/CUE4Parse +++ b/CUE4Parse @@ -1 +1 @@ -Subproject commit 94b08d6022a8577732e805e5140931d318204c82 +Subproject commit 3ff8c179dfbe817f22e9672dab9c2901a58b9db7 diff --git a/FModel/Enums.cs b/FModel/Enums.cs index 77c81c0e..ae52dfeb 100644 --- a/FModel/Enums.cs +++ b/FModel/Enums.cs @@ -71,7 +71,9 @@ public enum EUpdateMode [Description("Stable")] Stable, [Description("Beta")] - Beta + Beta, + [Description("QA Testing")] + Qa } public enum ECompressedAudio diff --git a/FModel/MainWindow.xaml.cs b/FModel/MainWindow.xaml.cs index 449f04a0..9cc995ef 100644 --- a/FModel/MainWindow.xaml.cs +++ b/FModel/MainWindow.xaml.cs @@ -47,7 +47,7 @@ private async void OnLoaded(object sender, RoutedEventArgs e) { var newOrUpdated = UserSettings.Default.ShowChangelog; #if !DEBUG - ApplicationService.ApiEndpointView.FModelApi.CheckForUpdates(UserSettings.Default.UpdateMode); + ApplicationService.ApiEndpointView.FModelApi.CheckForUpdates(UserSettings.Default.UpdateMode, true); #endif switch (UserSettings.Default.AesReload) diff --git a/FModel/Settings/UserSettings.cs b/FModel/Settings/UserSettings.cs index 5dc4eb85..03c3b7cf 100644 --- a/FModel/Settings/UserSettings.cs +++ b/FModel/Settings/UserSettings.cs @@ -159,6 +159,13 @@ public EUpdateMode UpdateMode set => SetProperty(ref _updateMode, value); } + private string _commitId = Constants.APP_VERSION; + public string CommitId + { + get => _commitId; + set => SetProperty(ref _commitId, value); + } + private bool _keepDirectoryStructure = true; public bool KeepDirectoryStructure { @@ -231,6 +238,8 @@ public IDictionary PerDirectory [JsonIgnore] public DirectorySettings CurrentDir { get; set; } + [JsonIgnore] + public string ShortCommitId => CommitId[..7]; /// /// TO DELETEEEEEEEEEEEEE diff --git a/FModel/ViewModels/ApiEndpoints/FModelApiEndpoint.cs b/FModel/ViewModels/ApiEndpoints/FModelApiEndpoint.cs index 0e1b1f85..fb803341 100644 --- a/FModel/ViewModels/ApiEndpoints/FModelApiEndpoint.cs +++ b/FModel/ViewModels/ApiEndpoints/FModelApiEndpoint.cs @@ -116,10 +116,13 @@ public CommunityDesign GetDesign(string designName) return communityDesign; } - public void CheckForUpdates(EUpdateMode updateMode) + public void CheckForUpdates(EUpdateMode updateMode, bool launch = false) { - AutoUpdater.ParseUpdateInfoEvent += ParseUpdateInfoEvent; - AutoUpdater.CheckForUpdateEvent += CheckForUpdateEvent; + if (launch) + { + AutoUpdater.ParseUpdateInfoEvent += ParseUpdateInfoEvent; + AutoUpdater.CheckForUpdateEvent += CheckForUpdateEvent; + } AutoUpdater.Start($"https://api.fmodel.app/v1/infos/{updateMode}"); } @@ -130,9 +133,14 @@ private void ParseUpdateInfoEvent(ParseUpdateInfoEventArgs args) { args.UpdateInfo = new UpdateInfoEventArgs { - CurrentVersion = _infos.Version, + CurrentVersion = _infos.Version.SubstringBefore('-'), ChangelogURL = _infos.ChangelogUrl, - DownloadURL = _infos.DownloadUrl + DownloadURL = _infos.DownloadUrl, + Mandatory = new CustomMandatory + { + Value = UserSettings.Default.UpdateMode == EUpdateMode.Qa, + CommitId = _infos.Version.SubstringAfter('+') + } }; } } @@ -141,8 +149,10 @@ private void CheckForUpdateEvent(UpdateInfoEventArgs args) { if (args is { CurrentVersion: { } }) { + var qa = (CustomMandatory) args.Mandatory; var currentVersion = new System.Version(args.CurrentVersion); - if (currentVersion == args.InstalledVersion) + if ((qa.Value && qa.CommitId == UserSettings.Default.CommitId) || // qa branch : same commit id + (!qa.Value && currentVersion == args.InstalledVersion && args.CurrentVersion == UserSettings.Default.CommitId)) // stable - beta branch : same version + commit id = version { if (UserSettings.Default.ShowChangelog) ShowChangelog(args); @@ -152,7 +162,7 @@ private void CheckForUpdateEvent(UpdateInfoEventArgs args) var downgrade = currentVersion < args.InstalledVersion; var messageBox = new MessageBoxModel { - Text = $"The latest version of FModel {UserSettings.Default.UpdateMode} is {args.CurrentVersion}. You are using version {args.InstalledVersion}. Do you want to {(downgrade ? "downgrade" : "update")} the application now?", + Text = $"The latest version of FModel {UserSettings.Default.UpdateMode.GetDescription()} is {(qa.Value ? qa.ShortCommitId : args.CurrentVersion)}. You are using version {(qa.Value ? UserSettings.Default.ShortCommitId : args.InstalledVersion)}. Do you want to {(downgrade ? "downgrade" : "update")} the application now?", Caption = $"{(downgrade ? "Downgrade" : "Update")} Available", Icon = MessageBoxImage.Question, Buttons = MessageBoxButtons.YesNo(), @@ -167,6 +177,7 @@ private void CheckForUpdateEvent(UpdateInfoEventArgs args) if (AutoUpdater.DownloadUpdate(args)) { UserSettings.Default.ShowChangelog = true; + UserSettings.Default.CommitId = qa.CommitId; Application.Current.Shutdown(); } } @@ -196,3 +207,9 @@ private void ShowChangelog(UpdateInfoEventArgs args) UserSettings.Default.ShowChangelog = false; } } + +public class CustomMandatory : Mandatory +{ + public string CommitId { get; set; } + public string ShortCommitId => CommitId[..7]; +} diff --git a/FModel/ViewModels/ApplicationViewModel.cs b/FModel/ViewModels/ApplicationViewModel.cs index dd044e67..9ef32ce0 100644 --- a/FModel/ViewModels/ApplicationViewModel.cs +++ b/FModel/ViewModels/ApplicationViewModel.cs @@ -46,7 +46,7 @@ public FStatus Status public CopyCommand CopyCommand => _copyCommand ??= new CopyCommand(this); private CopyCommand _copyCommand; - public string InitialWindowTitle => $"FModel {UserSettings.Default.UpdateMode}"; + public string InitialWindowTitle => $"FModel {UserSettings.Default.UpdateMode.GetDescription()}"; public string GameDisplayName => CUE4Parse.Provider.GameDisplayName ?? "Unknown"; public string TitleExtra => $"({UserSettings.Default.CurrentDir.UeVersion}){(Build != EBuildKind.Release ? $" ({Build})" : "")}"; diff --git a/FModel/ViewModels/GameSelectorViewModel.cs b/FModel/ViewModels/GameSelectorViewModel.cs index f1d40228..45f6c35a 100644 --- a/FModel/ViewModels/GameSelectorViewModel.cs +++ b/FModel/ViewModels/GameSelectorViewModel.cs @@ -87,8 +87,8 @@ private IEnumerable EnumerateUeGames() .OrderBy(value => (int)value == ((int)value & ~0xF)); private IEnumerable EnumerateDetectedGames() { - yield return GetUnrealEngineGame("Fortnite", "\\FortniteGame\\Content\\Paks", EGame.GAME_UE5_3); - yield return DirectorySettings.Default("Fortnite [LIVE]", Constants._FN_LIVE_TRIGGER, ue: EGame.GAME_UE5_3); + yield return GetUnrealEngineGame("Fortnite", "\\FortniteGame\\Content\\Paks", EGame.GAME_UE5_4); + yield return DirectorySettings.Default("Fortnite [LIVE]", Constants._FN_LIVE_TRIGGER, ue: EGame.GAME_UE5_4); yield return GetUnrealEngineGame("Pewee", "\\RogueCompany\\Content\\Paks", EGame.GAME_RogueCompany); yield return GetUnrealEngineGame("Rosemallow", "\\Indiana\\Content\\Paks", EGame.GAME_UE4_21); yield return GetUnrealEngineGame("Catnip", "\\OakGame\\Content\\Paks", EGame.GAME_Borderlands3); diff --git a/FModel/Views/ImageMerger.xaml.cs b/FModel/Views/ImageMerger.xaml.cs index a8cc6a99..6190973d 100644 --- a/FModel/Views/ImageMerger.xaml.cs +++ b/FModel/Views/ImageMerger.xaml.cs @@ -142,7 +142,7 @@ private async void OnImageAdd(object sender, RoutedEventArgs e) var fileBrowser = new OpenFileDialog { Title = "Add image(s)", - InitialDirectory = $"{UserSettings.Default.OutputDirectory}\\Exports", + InitialDirectory = Path.Combine(UserSettings.Default.OutputDirectory, "Exports"), Multiselect = true, Filter = "Image Files (*.png,*.bmp,*.jpg,*.jpeg,*.jfif,*.jpe,*.tiff,*.tif)|*.png;*.bmp;*.jpg;*.jpeg;*.jfif;*.jpe;*.tiff;*.tif|All Files (*.*)|*.*" };