Merge branch '4sval:dev' into dev

This commit is contained in:
wenlong li 2026-04-22 10:05:46 +08:00 committed by GitHub
commit 3bdfcd6b26
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
50 changed files with 1525 additions and 451 deletions

View File

@ -20,7 +20,7 @@ jobs:
dotnet-version: '8.0.x'
- name: .NET Restore
run: dotnet restore "./FModel/FModel.slnx"
run: dotnet restore "./FModel/FModel.slnx" -r win-x64
- name: .NET Publish
run: dotnet publish "./FModel/FModel.csproj" -c Release --no-restore --no-self-contained -r win-x64 -f net8.0-windows -o "./FModel/bin/Publish/" -p:PublishReadyToRun=false -p:PublishSingleFile=true -p:DebugType=None -p:GenerateDocumentationFile=false -p:DebugSymbols=false

@ -1 +1 @@
Subproject commit 4fb7435973fc57bfb78577c971d776f7577440cf
Subproject commit 3a243aa9452658bbc6a74d538d1cf4d73da758f4

View File

@ -92,6 +92,12 @@ public partial class App
UserSettings.Default.AudioDirectory = Path.Combine(UserSettings.Default.OutputDirectory, "Exports");
}
if (!Directory.Exists(UserSettings.Default.CodeDirectory))
{
createMe = true;
UserSettings.Default.CodeDirectory = Path.Combine(UserSettings.Default.OutputDirectory, "Exports");
}
if (!Directory.Exists(UserSettings.Default.ModelDirectory))
{
createMe = true;

View File

@ -40,6 +40,12 @@ public static class Constants
public const string _NO_PRESET_TRIGGER = "Hand Made";
// Common issues
public const string MAPPING_ISSUE_LINK = "https://github.com/4sval/FModel/discussions/418";
public const string AUDIO_ISSUE_LINK = "https://github.com/4sval/FModel/discussions/658";
public const string RADA_ISSUE_LINK = "https://github.com/4sval/FModel/discussions/422";
public const string VERSION_ISSUE_LINK = "https://github.com/4sval/FModel/discussions/425";
public static int PALETTE_LENGTH => COLOR_PALETTE.Length;
public static readonly Vector3[] COLOR_PALETTE =
{

View File

@ -0,0 +1,47 @@
using CUE4Parse.UE4.Assets.Exports;
using CUE4Parse.UE4.Assets.Objects;
using CUE4Parse.UE4.Objects.UObject;
using SkiaSharp;
namespace FModel.Creator.Bases.FN;
public class BaseAssembledMesh : UCreator
{
public BaseAssembledMesh(UObject uObject, EIconStyle style) : base(uObject, style)
{
}
public override void ParseForInfo()
{
if (Object.TryGetValue(out FInstancedStruct[] additionalData, "AdditionalData"))
{
foreach (var data in additionalData)
{
if (data.NonConstStruct?.TryGetValue(out FSoftObjectPath largePreview, "LargePreviewImage", "SmallPreviewImage") == true)
{
Preview = Utils.GetBitmap(largePreview);
}
}
}
}
public override SKBitmap[] Draw()
{
var ret = new SKBitmap(Width, Height, SKColorType.Rgba8888, SKAlphaType.Premul);
using var c = new SKCanvas(ret);
switch (Style)
{
case EIconStyle.NoBackground:
DrawPreview(c);
break;
default:
DrawBackground(c);
DrawPreview(c);
break;
}
return new[] { ret };
}
}

View File

@ -36,6 +36,7 @@ public class BaseIcon : UCreator
if (Object.TryGetValue(out FInstancedStruct[] dataList, "DataList"))
{
GetRarity(dataList);
GetSeries(dataList);
Preview = Utils.GetBitmap(dataList);
}
@ -139,6 +140,12 @@ public class BaseIcon : UCreator
GetSeries(export);
}
private void GetRarity(FInstancedStruct[] s)
{
if (s.FirstOrDefault(d => d.NonConstStruct?.TryGetValue(out EFortRarity _, "Rarity") == true) is { } dl)
GetRarity(dl.NonConstStruct.Get<EFortRarity>("Rarity"));
}
private void GetSeries(FInstancedStruct[] s)
{
if (s.FirstOrDefault(d => d.NonConstStruct?.TryGetValue(out FPackageIndex _, "Series") == true) is { } dl)

View File

@ -87,6 +87,7 @@ public class BaseIconStats : BaseIcon
weaponRowValue.TryGetValue(out float dmgPb, "DmgPB"); //Damage at point blank
weaponRowValue.TryGetValue(out float mdpc, "MaxDamagePerCartridge"); //Max damage a weapon can do in a single hit, usually used for shotguns
weaponRowValue.TryGetValue(out float dmgCritical, "DamageZone_Critical"); //Headshot multiplier
weaponRowValue.TryGetValue(out float envDmgPb, "EnvDmgPB"); //Structure damage at point blank
weaponRowValue.TryGetValue(out int clipSize, "ClipSize"); //Item magazine size
weaponRowValue.TryGetValue(out float firingRate, "FiringRate"); //Item firing rate, value is shots per second
weaponRowValue.TryGetValue(out float swingTime, "SwingTime"); //Item swing rate, value is swing per second
@ -115,6 +116,15 @@ public class BaseIconStats : BaseIcon
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "0DEF2455463B008C4499FEA03D149EDF", "Headshot Damage"), dmgPb * dmgCritical * multiplier, 160));
}
}
{
var envdmgmultiplier = bpc != 0f ? bpc : 1;
if (envDmgPb != 0f)
{
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "11AF67134E0F4E27E5E588806AB475BE", "Structure Damage"), envDmgPb * envdmgmultiplier, 160));
}
}
if (clipSize > 999f || clipSize == 0f)
{
_statistics.Add(new IconStat(Utils.GetLocalizedResource("", "068239DD4327B36124498C9C5F61C038", "Magazine Size"), Utils.GetLocalizedResource("", "0FAE8E5445029F2AA209ADB0FE49B23C", "Infinite"), -1));

View File

@ -100,12 +100,14 @@ public class CreatorPackage : IDisposable
case "FortCodeTokenItemDefinition":
case "FortSchematicItemDefinition":
case "FortAlterableItemDefinition":
case "SproutHousingItemDefinition":
case "SparksKeyboardItemDefinition":
case "FortWorldMultiItemDefinition":
case "FortAlterationItemDefinition":
case "FortExpeditionItemDefinition":
case "FortIngredientItemDefinition":
case "FortConsumableItemDefinition":
case "SproutBuildingItemDefinition":
case "StWFortAccoladeItemDefinition":
case "FortAccountBuffItemDefinition":
case "FortFOBCoreDecoItemDefinition":
@ -163,6 +165,9 @@ public class CreatorPackage : IDisposable
case "JunoAthenaDanceItemOverrideDefinition":
creator = new BaseJuno(_object.Value, _style);
return true;
case "AssembledMeshSchema":
creator = new BaseAssembledMesh(_object.Value, _style);
return true;
case "FortTandemCharacterData":
creator = new BaseTandem(_object.Value, _style);
return true;

View File

@ -27,6 +27,7 @@ public enum SettingsOut
public enum EStatusKind
{
Ready, // ready
Configuring, // waiting for user input
Loading, // doing stuff
Stopping, // trying to stop
Stopped, // stopped
@ -107,6 +108,7 @@ public enum EBulkType
Animations = 1 << 4,
Audio = 1 << 5,
Code = 1 << 6,
Raw = 1 << 7,
}
public enum EAssetCategory : uint
@ -158,4 +160,7 @@ public enum EAssetCategory : uint
Particle = AssetCategoryExtensions.CategoryBase + (9 << 16),
GameSpecific = AssetCategoryExtensions.CategoryBase + (10 << 16),
Borderlands = GameSpecific + 1,
Aion2 = GameSpecific + 2,
RocoKingdomWorld = GameSpecific + 3,
DeltaForce = GameSpecific + 4,
}

View File

@ -14,6 +14,7 @@ public static class AvalonExtensions
private static readonly IHighlightingDefinition _cppHighlighter = LoadHighlighter("Cpp.xshd");
private static readonly IHighlightingDefinition _changelogHighlighter = LoadHighlighter("Changelog.xshd");
private static readonly IHighlightingDefinition _verseHighlighter = LoadHighlighter("Verse.xshd");
private static readonly IHighlightingDefinition _luaHighlighter = LoadHighlighter("Lua.xshd");
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static IHighlightingDefinition LoadHighlighter(string resourceName)
@ -29,6 +30,9 @@ public static class AvalonExtensions
{
switch (ext)
{
case "lua":
case "luac":
return _luaHighlighter;
case "ini":
case "csv":
return _iniHighlighter;

View File

@ -81,6 +81,7 @@
<None Remove="Resources\Xml.xshd" />
<None Remove="Resources\Cpp.xshd" />
<None Remove="Resources\Changelog.xshd" />
<None Remove="Resources\Lua.xshd" />
<None Remove="Resources\unix.png" />
<None Remove="Resources\linux.png" />
<None Remove="Resources\stateofdecay2.png" />
@ -129,6 +130,7 @@
<EmbeddedResource Include="Resources\Verse.xshd" />
<EmbeddedResource Include="Resources\Xml.xshd" />
<EmbeddedResource Include="Resources\Cpp.xshd" />
<EmbeddedResource Include="Resources\Lua.xshd" />
<EmbeddedResource Include="Resources\Changelog.xshd" />
<EmbeddedResource Include="Resources\default.frag" />
<EmbeddedResource Include="Resources\default.vert" />

View File

@ -1,4 +1,5 @@
using System;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Windows;
@ -62,7 +63,7 @@ public static class Helper
GetOpenedWindow<T>(windowName).Close();
}
private static bool IsWindowOpen<T>(string name = "") where T : Window
public static bool IsWindowOpen<T>(string name = "") where T : Window
{
return string.IsNullOrEmpty(name)
? Application.Current.Windows.OfType<T>().Any()
@ -111,4 +112,24 @@ public static class Helper
const float ratio = 180f / MathF.PI;
return radians * ratio;
}
public static string GetGameName(string path)
{
// install_folder/
// ├─ Engine/
// ├─ GameName/
// │ ├─ Binaries/
// │ ├─ Content/
// │ │ ├─ Paks/
// our goal is to get the GameName folder
var dir = new DirectoryInfo(path);
if (dir.Name.Equals("Paks", StringComparison.InvariantCulture) && dir.Parent is { Parent: not null } &&
dir.Parent.Name.Equals("Content", StringComparison.InvariantCulture) &&
dir.Parent.Parent.GetDirectories().Any(x => x.Name == "Binaries"))
{
return dir.Parent.Parent.Name;
}
return dir.Name;
}
}

View File

@ -12,7 +12,8 @@
xmlns:adonisExtensions="clr-namespace:AdonisUI.Extensions;assembly=AdonisUI"
WindowStartupLocation="CenterScreen" Closing="OnClosing" Loaded="OnLoaded" PreviewKeyDown="OnWindowKeyDown"
Height="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenHeight}, Converter={converters:RatioConverter}, ConverterParameter='0.95'}"
Width="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenWidth}, Converter={converters:RatioConverter}, ConverterParameter='0.90'}">
Width="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenWidth}, Converter={converters:RatioConverter}, ConverterParameter='0.90'}"
AllowDrop="True">
<Window.TaskbarItemInfo>
<TaskbarItemInfo ProgressValue="1.0">
<TaskbarItemInfo.ProgressState>
@ -628,6 +629,10 @@
<Setter Property="Background" Value="{DynamicResource {x:Static adonisUi:Brushes.AlertBrush}}" />
<Setter Property="Foreground" Value="White" />
</DataTrigger>
<DataTrigger Binding="{Binding Status.Kind}" Value="{x:Static local:EStatusKind.Configuring}">
<Setter Property="Background" Value="{DynamicResource {x:Static adonisUi:Brushes.AlertBrush}}" />
<Setter Property="Foreground" Value="White" />
</DataTrigger>
<DataTrigger Binding="{Binding Status.Kind}" Value="{x:Static local:EStatusKind.Stopped}">
<Setter Property="Background" Value="{DynamicResource {x:Static adonisUi:Brushes.ErrorBrush}}" />
<Setter Property="Foreground" Value="White" />
@ -709,5 +714,7 @@
</StackPanel>
</StatusBarItem>
</StatusBar>
<controls:DropOverlay Grid.RowSpan="99"
Panel.ZIndex="1000" />
</Grid>
</adonisControls:AdonisWindow>

View File

@ -1,5 +1,6 @@
using System;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

View File

@ -18,6 +18,7 @@
<Color name="BooleanConstants" foreground="#569cd6" fontWeight="bold" />
<RuleSet ignoreCase="false">
<Rule color="Comment">(\/\/.*|\/\*[\s\S]*?\*\/)</Rule>
<Span color="String" begin="&quot;" end="&quot;" />
<!-- UE Macros -->
<Keywords color="UEMacro">
@ -44,10 +45,19 @@
<Word>Int16</Word>
<Word>Int32</Word>
<Word>Int64</Word>
<Word>int8</Word>
<Word>int16</Word>
<Word>int32</Word>
<Word>int64</Word>
<Word>uint</Word>
<Word>UInt8</Word>
<Word>UInt16</Word>
<Word>UInt32</Word>
<Word>UInt64</Word>
<Word>uint8</Word>
<Word>uint16</Word>
<Word>uint32</Word>
<Word>uint64</Word>
<Word>float</Word>
<Word>double</Word>
<Word>bool</Word>
@ -83,6 +93,7 @@
<Word>inline</Word>
<Word>constexpr</Word>
<Word>default</Word>
<Word>&amp;&amp;</Word>
</Keywords>
<Keywords color="Pointer">
@ -120,8 +131,6 @@
<Rule color="Brace">[\[\]\{\}]</Rule>
<Rule color="Comment">(\/\/.*|\/\*[\s\S]*?\*\/)</Rule>
<!-- Template Functions -->
<Rule color="Function">\b[A-Za-z_][A-Za-z0-9_]*\b(?=&lt;)</Rule>

230
FModel/Resources/Lua.xshd Normal file
View File

@ -0,0 +1,230 @@
<SyntaxDefinition name="Lua" extensions=".lua;.luac" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008">
<Color name="Keyword1" foreground="#C586C0" fontWeight="bold" />
<Color name="Keyword2" foreground="#569CD6" fontWeight="bold" />
<Color name="Comment" foreground="#6A9955" />
<Color name="String" foreground="#D69D85" />
<Color name="Number" foreground="#B5CEA8" />
<Color name="Function" foreground="#DCDCAA" />
<Color name="Punctuation" foreground="#89DDFF" />
<Color name="ObjectName" foreground="#3DC9B0" />
<Color name="Constant" foreground="#9CDCFE" />
<RuleSet>
<Rule color="Comment">--.*$</Rule>
<Rule color="String">&quot;([^&quot;\\]|\\.)*&quot;</Rule>
<Rule color="String">&apos;([^&apos;\\]|\\.)*&apos;</Rule>
<Rule color="Number">\b\d+\.\d+([eE][+-]?\d+)?\b</Rule>
<Rule color="Number">\b\d+[eE][+-]?\d+\b</Rule>
<Rule color="Number">\b\d+\b</Rule>
<Keywords color="Keyword1">
<Word>return</Word>
<Word>function</Word>
<Word>goto</Word>
<Word>end</Word>
<Word>if</Word>
<Word>else</Word>
<Word>elseif</Word>
<Word>then</Word>
<Word>for</Word>
<Word>in</Word>
<Word>until</Word>
<Word>while</Word>
<Word>break</Word>
<Word>or</Word>
<Word>and</Word>
<Word>repeat</Word>
<Word>do</Word>
</Keywords>
<Keywords color="Keyword2">
<Word>local</Word>
<Word>nil</Word>
<Word>not</Word>
<Word>true</Word>
<Word>false</Word>
</Keywords>
<Keywords color="Function">
<!-- Core functions -->
<Word>assert</Word>
<Word>collectgarbage</Word>
<Word>error</Word>
<Word>ipairs</Word>
<Word>next</Word>
<Word>pairs</Word>
<Word>pcall</Word>
<Word>print</Word>
<Word>rawequal</Word>
<Word>rawget</Word>
<Word>rawlen</Word>
<Word>rawset</Word>
<Word>select</Word>
<Word>setmetatable</Word>
<Word>tonumber</Word>
<Word>tostring</Word>
<Word>type</Word>
<Word>xpcall</Word>
<Word>getmetatable</Word>
<Word>require</Word>
<Word>module</Word>
<!-- Modules / tables -->
<Word>math</Word>
<Word>string</Word>
<Word>table</Word>
<Word>coroutine</Word>
<Word>os</Word>
<Word>io</Word>
<Word>utf8</Word>
<Word>bit32</Word>
<Word>package</Word>
<Word>debug</Word>
<!-- Bit32 / bitwise functions -->
<Word>arshift</Word>
<Word>band</Word>
<Word>bnot</Word>
<Word>bor</Word>
<Word>bxor</Word>
<Word>btest</Word>
<Word>extract</Word>
<Word>lrotate</Word>
<Word>lshift</Word>
<Word>replace</Word>
<Word>rrotate</Word>
<Word>rshift</Word>
<!-- Coroutine functions -->
<Word>create</Word>
<Word>resume</Word>
<Word>running</Word>
<Word>status</Word>
<Word>wrap</Word>
<Word>yield</Word>
<Word>isyieldable</Word>
<!-- Debug functions -->
<Word>getuservalue</Word>
<Word>gethook</Word>
<Word>getinfo</Word>
<Word>getlocal</Word>
<Word>getregistry</Word>
<Word>getupvalue</Word>
<Word>upvaluejoin</Word>
<Word>upvalueid</Word>
<Word>setuservalue</Word>
<Word>sethook</Word>
<Word>setlocal</Word>
<Word>setupvalue</Word>
<Word>traceback</Word>
<!-- IO functions -->
<Word>close</Word>
<Word>flush</Word>
<Word>input</Word>
<Word>lines</Word>
<Word>open</Word>
<Word>output</Word>
<Word>popen</Word>
<Word>read</Word>
<Word>tmpfile</Word>
<Word>seek</Word>
<Word>setvbuf</Word>
<Word>write</Word>
<!-- String functions -->
<Word>byte</Word>
<Word>char</Word>
<Word>dump</Word>
<Word>find</Word>
<Word>format</Word>
<Word>gmatch</Word>
<Word>gsub</Word>
<Word>len</Word>
<Word>lower</Word>
<Word>match</Word>
<Word>rep</Word>
<Word>reverse</Word>
<Word>sub</Word>
<Word>upper</Word>
<Word>pack</Word>
<Word>packsize</Word>
<Word>unpack</Word>
<Word>concat</Word>
<Word>maxn</Word>
<Word>insert</Word>
<Word>move</Word>
<Word>offset</Word>
<Word>codepoint</Word>
<Word>codes</Word>
<Word>charpattern</Word>
<!-- OS / Time functions -->
<Word>clock</Word>
<Word>date</Word>
<Word>difftime</Word>
<Word>execute</Word>
<Word>exit</Word>
<Word>getenv</Word>
<Word>remove</Word>
<Word>rename</Word>
<Word>setlocale</Word>
<Word>time</Word>
<Word>loadlib</Word>
<Word>searchpath</Word>
<Word>seeall</Word>
<Word>preload</Word>
<Word>cpath</Word>
<Word>path</Word>
<Word>searchers</Word>
<Word>loaded</Word>
<!-- Math functions / constants -->
<Word>abs</Word>
<Word>acos</Word>
<Word>asin</Word>
<Word>atan</Word>
<Word>atan2</Word>
<Word>ceil</Word>
<Word>cos</Word>
<Word>cosh</Word>
<Word>deg</Word>
<Word>exp</Word>
<Word>floor</Word>
<Word>fmod</Word>
<Word>ult</Word>
<Word>log</Word>
<Word>log10</Word>
<Word>max</Word>
<Word>min</Word>
<Word>modf</Word>
<Word>pi</Word>
<Word>rad</Word>
<Word>random</Word>
<Word>randomseed</Word>
<Word>sin</Word>
<Word>sqrt</Word>
<Word>tan</Word>
<Word>sinh</Word>
<Word>tanh</Word>
<Word>pow</Word>
<Word>frexp</Word>
<Word>ldexp</Word>
<Word>huge</Word>
<Word>maxinteger</Word>
<Word>mininteger</Word>
</Keywords>
<Rule color="Punctuation">(\|)|(&lt;&lt;)|(&gt;&gt;)|(\/\/)|(==)|(~=)|(&lt;=)|(&gt;=)|(&lt;)|(&gt;)|(=)|(\()|(\))|(\{)|(\})|(\[)|(\])|(::)|(:)|(;)|(,)|(\.\.\.)|(\.\.)|(\.)|[+\-*%\^#&amp;~]</Rule>
<Rule color="ObjectName">(?&lt;=function\s)[A-Za-z0-9_]+(?=\.)</Rule>
<Rule color="Function">(?&lt;=\.)[A-Za-z0-9_]+(?=\()</Rule>
<Rule color="Function">(?&lt;=function\s)[A-Za-z0-9_]+(?=\s*\()</Rule> <!-- Standalone function name -->
<Rule color="Constant">\b[A-Z_][A-Z0-9_]*\b</Rule>
</RuleSet>
</SyntaxDefinition>

View File

@ -119,6 +119,13 @@ namespace FModel.Settings
set => SetProperty(ref _audioDirectory, value);
}
private string _codeDirectory;
public string CodeDirectory
{
get => _codeDirectory;
set => SetProperty(ref _codeDirectory, value);
}
private string _modelDirectory;
public string ModelDirectory
{
@ -252,13 +259,6 @@ namespace FModel.Settings
set => SetProperty(ref _imageMergerMargin, value);
}
private bool _canExportRawData;
public bool CanExportRawData
{
get => _canExportRawData;
set => SetProperty(ref _canExportRawData, value);
}
private bool _readScriptData;
public bool ReadScriptData
{
@ -461,13 +461,6 @@ namespace FModel.Settings
set => SetProperty(ref _cameraMode, value);
}
private int _wwiseMaxBnkPrefetch;
public int WwiseMaxBnkPrefetch
{
get => _wwiseMaxBnkPrefetch;
set => SetProperty(ref _wwiseMaxBnkPrefetch, value);
}
private int _previewMaxTextureSize = 1024;
public int PreviewMaxTextureSize
{

View File

@ -11,6 +11,7 @@ namespace FModel.ViewModels.ApiEndpoints;
public class DillyApiEndpoint : AbstractApiProvider
{
private Backup[] _backups;
private ManifestInfoDilly[] _manifests;
public DillyApiEndpoint(RestClient client) : base(client) { }
@ -27,6 +28,19 @@ public class DillyApiEndpoint : AbstractApiProvider
return _backups ??= GetBackupsAsync(token).GetAwaiter().GetResult();
}
public async Task<ManifestInfoDilly[]> GetManifestsAsync(CancellationToken token)
{
var request = new FRestRequest($"https://export-service-new.dillyapis.com/v1/manifests");
var response = await _client.ExecuteAsync<ManifestInfoDilly[]>(request, token).ConfigureAwait(false);
Log.Information("[{Method}] [{Status}({StatusCode})] '{Resource}'", request.Method, response.StatusDescription, (int) response.StatusCode, response.ResponseUri?.OriginalString);
return response.Data;
}
public ManifestInfoDilly[] GetManifests(CancellationToken token)
{
return _manifests ??= GetManifestsAsync(token).GetAwaiter().GetResult();
}
public async Task<IDictionary<string, IDictionary<string, string>>> GetHotfixesAsync(CancellationToken token, string language = "en")
{
var request = new FRestRequest("https://api.fortniteapi.com/v1/cloudstorage/hotfixes")

View File

@ -23,6 +23,13 @@ public class Backup
[J] public string Url { get; private set; }
}
[DebuggerDisplay("{" + nameof(AppName) + "}")]
public class ManifestInfoDilly
{
[J] public string AppName { get; private set; }
[J] public string DownloadUrl { get; private set; }
}
public class Donator
{
[J] public string Username { get; private set; }

View File

@ -104,7 +104,7 @@ public class ApplicationViewModel : ViewModel
if (UserSettings.Default.CurrentDir is null)
{
//If no game is selected, many things will break before a shutdown request is processed in the normal way.
//A hard exit is preferable to an unhandled expection in this case
//A hard exit is preferable to an unhandled exception in this case
Environment.Exit(0);
}
@ -126,7 +126,6 @@ public class ApplicationViewModel : ViewModel
if (sender is not IAesVfsReader reader) return;
CUE4Parse.GameDirectory.Disable(reader);
};
CustomDirectories = new CustomDirectoriesViewModel();
SettingsView = new SettingsViewModel();
AesManager = new AesManagerViewModel(CUE4Parse);
@ -141,8 +140,10 @@ public class ApplicationViewModel : ViewModel
if (!bAlreadyLaunched && UserSettings.Default.PerDirectory.TryGetValue(gameDirectory, out var currentDir))
return currentDir;
Status.SetStatus(EStatusKind.Configuring);
var gameLauncherViewModel = new GameSelectorViewModel(gameDirectory);
var result = new DirectorySelector(gameLauncherViewModel).ShowDialog();
Status.SetStatus(EStatusKind.Ready);
if (!result.HasValue || !result.Value) return null;
UserSettings.Default.GameDirectory = gameLauncherViewModel.SelectedDirectory.GameDirectory;
@ -155,6 +156,35 @@ public class ApplicationViewModel : ViewModel
return null;
}
public DirectorySettings AddGameDirectory(string directory)
{
if (Status.Kind is EStatusKind.Configuring)
{
var directorySelector = Helper.GetWindow<DirectorySelector>("Directory Selector", null);
directorySelector.AddManualGame(directory);
return null;
}
else
{
Status.SetStatus(EStatusKind.Configuring);
var gameLauncherViewModel = new GameSelectorViewModel(UserSettings.Default.GameDirectory);
var directorySelector = new DirectorySelector(gameLauncherViewModel);
directorySelector.AddManualGame(directory);
var result = directorySelector.ShowDialog();
Status.SetStatus(EStatusKind.Ready);
if (!result.HasValue || !result.Value)
return null;
UserSettings.Default.GameDirectory = gameLauncherViewModel.SelectedDirectory.GameDirectory;
if (UserSettings.Default.CurrentDir.Equals(gameLauncherViewModel.SelectedDirectory))
return gameLauncherViewModel.SelectedDirectory;
UserSettings.Default.CurrentDir = gameLauncherViewModel.SelectedDirectory;
RestartWithWarning();
return null;
}
}
public void RestartWithWarning()
{
MessageBox.Show("It looks like you just changed something.\nFModel will restart to apply your changes.", "Uh oh, a restart is needed", MessageBoxButton.OK, MessageBoxImage.Warning);
@ -246,7 +276,7 @@ public class ApplicationViewModel : ViewModel
}
else
{
FLogger.Append(ELog.Error, () => FLogger.Text("Could not download VgmStream", Constants.WHITE, true));
FLogger.Append(ELog.Error, () => FLogger.Text("Could not download vgmstream", Constants.WHITE, true));
}
}
}

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
@ -298,13 +299,23 @@ public class AudioPlayerViewModel : ViewModel, ISource, IDisposable
Save(a, true);
}
FLogger.Append(ELog.Information, () =>
{
FLogger.Text("Successfully saved audio from ", Constants.WHITE);
FLogger.Link(_audioFiles.First().FileName, _audioFiles.First().FilePath, true);
});
if (_audioFiles.Count > 1)
FLogger.Append(ELog.Information, () => FLogger.Text($"Successfully saved {_audioFiles.Count} audio files", Constants.WHITE, true));
{
var dir = new DirectoryInfo(Path.GetDirectoryName(_audioFiles.First().FilePath));
FLogger.Append(ELog.Information, () =>
{
FLogger.Text($"Successfully saved {_audioFiles.Count} audio files to ", Constants.WHITE);
FLogger.Link(dir.Name, dir.FullName, true);
});
}
else
{
FLogger.Append(ELog.Information, () =>
{
FLogger.Text("Successfully saved ", Constants.WHITE);
FLogger.Link(_audioFiles.First().FileName, _audioFiles.First().FilePath, true);
});
}
});
}
@ -330,12 +341,8 @@ public class AudioPlayerViewModel : ViewModel, ISource, IDisposable
Directory.CreateDirectory(path.SubstringBeforeLast('/'));
}
using (var stream = new FileStream(path, FileMode.Create, FileAccess.Write))
using (var writer = new BinaryWriter(stream))
{
writer.Write(fileToSave.Data);
writer.Flush();
}
using var stream = new FileStream(path, FileMode.Create, FileAccess.Write);
stream.Write(fileToSave.Data);
if (File.Exists(path))
{
@ -654,32 +661,30 @@ public class AudioPlayerViewModel : ViewModel, ISource, IDisposable
}
}
private bool TryConvert(out string wavFilePath) => TryConvert(SelectedAudioFile.FilePath, SelectedAudioFile.Data, out wavFilePath);
public static bool TryConvert(string inputFilePath, byte[] inputFileData, out string wavFilePath)
private bool TryConvert(out string wavFilePath) => TryConvert(SelectedAudioFile.FilePath, SelectedAudioFile.Data, out wavFilePath, true);
public static bool TryConvert(string inputFilePath, byte[] inputFileData, out string wavFilePath, bool updateUi = false)
{
wavFilePath = string.Empty;
var vgmFilePath = Path.Combine(UserSettings.Default.OutputDirectory, ".data", "test.exe");
if (!File.Exists(vgmFilePath))
var vgmStreamPath = TryGetVgmstreamPath();
if (string.IsNullOrEmpty(vgmStreamPath))
return false;
var success = TryConvertToWav(inputFilePath, inputFileData, vgmStreamPath, true, out wavFilePath);
if (!success)
{
vgmFilePath = Path.Combine(UserSettings.Default.OutputDirectory, ".data", "vgmstream-cli.exe");
if (!File.Exists(vgmFilePath)) return false;
Log.Error("Failed to convert {InputFilePath} to .wav format", Path.GetFileName(inputFilePath));
if (updateUi)
{
FLogger.Append(ELog.Error, () =>
{
FLogger.Text("Failed to convert audio to .wav format. See: ", Constants.WHITE);
FLogger.Link("→ link ←", Constants.AUDIO_ISSUE_LINK, true);
});
}
}
Directory.CreateDirectory(inputFilePath.SubstringBeforeLast("/"));
File.WriteAllBytes(inputFilePath, inputFileData);
wavFilePath = Path.ChangeExtension(inputFilePath, ".wav");
var vgmProcess = Process.Start(new ProcessStartInfo
{
FileName = vgmFilePath,
Arguments = $"-o \"{wavFilePath}\" \"{inputFilePath}\"",
UseShellExecute = false,
CreateNoWindow = true
});
vgmProcess?.WaitForExit(5000);
File.Delete(inputFilePath);
return vgmProcess?.ExitCode == 0 && File.Exists(wavFilePath);
return success;
}
private bool TryDecode(string extension, out string rawFilePath)
@ -688,23 +693,116 @@ public class AudioPlayerViewModel : ViewModel, ISource, IDisposable
var decoderPath = Path.Combine(UserSettings.Default.OutputDirectory, ".data", $"{extension}dec.exe");
if (!File.Exists(decoderPath))
{
Log.Error("Failed to convert {FilePath}, rada decoder is missing", SelectedAudioFile.FilePath);
FLogger.Append(ELog.Error, () =>
{
FLogger.Text("Failed to convert audio because rada decoder is missing. See: ", Constants.WHITE);
FLogger.Link("→ link ←", Constants.RADA_ISSUE_LINK, true);
});
return false;
}
Directory.CreateDirectory(SelectedAudioFile.FilePath.SubstringBeforeLast("/"));
File.WriteAllBytes(SelectedAudioFile.FilePath, SelectedAudioFile.Data);
return TryConvertToWav(SelectedAudioFile.FilePath, SelectedAudioFile.Data, decoderPath, false, out rawFilePath);
}
rawFilePath = Path.ChangeExtension(SelectedAudioFile.FilePath, ".wav");
var decoderProcess = Process.Start(new ProcessStartInfo
private static bool TryConvertToWav(string inputFilePath, byte[] inputFileData, string converterPath, bool usevgmstream, out string wavFilePath)
{
wavFilePath = Path.ChangeExtension(inputFilePath, ".wav");
var directory = Path.GetDirectoryName(inputFilePath);
Directory.CreateDirectory(directory);
var tempfile = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName() + Path.GetExtension(inputFilePath));
File.WriteAllBytes(tempfile, inputFileData);
var tempWavFilePath = Path.ChangeExtension(tempfile, ".wav");
var process = Process.Start(new ProcessStartInfo
{
FileName = decoderPath,
Arguments = $"-i \"{SelectedAudioFile.FilePath}\" -o \"{rawFilePath}\"",
FileName = converterPath,
Arguments = usevgmstream ? $"-o \"{tempWavFilePath}\" \"{tempfile}\"" : $"-i \"{tempfile}\" -o \"{tempWavFilePath}\"",
UseShellExecute = false,
CreateNoWindow = true
});
decoderProcess?.WaitForExit(5000);
process?.WaitForExit(5000);
File.Delete(SelectedAudioFile.FilePath);
return decoderProcess?.ExitCode == 0 && File.Exists(rawFilePath);
File.Delete(tempfile);
var success = process?.ExitCode == 0 && File.Exists(tempWavFilePath);
if (success)
{
File.Move(tempWavFilePath, wavFilePath, true);
}
return success;
}
private static string TryGetVgmstreamPath()
{
var vgmFilePath = Path.Combine(UserSettings.Default.OutputDirectory, ".data", "test.exe");
if (!File.Exists(vgmFilePath))
{
vgmFilePath = Path.Combine(UserSettings.Default.OutputDirectory, ".data", "vgmstream-cli.exe");
if (!File.Exists(vgmFilePath))
{
Log.Error("Failed to convert audio, vgmstream is missing");
FLogger.Append(ELog.Error, () =>
{
FLogger.Text("Failed to convert audio because vgmstream is missing. See: ", Constants.WHITE);
FLogger.Link("→ link ←", Constants.AUDIO_ISSUE_LINK, true);
});
return string.Empty;
}
}
return vgmFilePath;
}
// Since Square Enix soundbanks are pretty niche, let's just use vgmstream to extract them
public static List<string> ExtractSquareEnixAudio(string sabPath, byte[] sqexData)
{
var vgmStreamPath = TryGetVgmstreamPath();
if (string.IsNullOrEmpty(vgmStreamPath))
return [];
if (sqexData.Length == 0)
return [];
var extractionDir = Path.GetDirectoryName(sabPath);
Directory.CreateDirectory(extractionDir);
// There's no clean way to know what was extracted with vgmstream (it's a soundbank, might contain multiple sounds) so we're monitoring extraction directory
var capturedFiles = new ConcurrentBag<string>();
using var watcher = new FileSystemWatcher(extractionDir)
{
Filter = "*.wav",
NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite | NotifyFilters.CreationTime
};
void handler(object s, FileSystemEventArgs e) => capturedFiles.Add(e.FullPath);
watcher.Created += handler;
watcher.Changed += handler;
watcher.EnableRaisingEvents = true;
var tempSab = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName() + ".sab");
File.WriteAllBytes(tempSab, sqexData);
var startInfo = new ProcessStartInfo
{
FileName = vgmStreamPath,
Arguments = $"-S 0 -o \"{extractionDir}\\?n_?s.wav\" \"{tempSab}\"",
UseShellExecute = false,
CreateNoWindow = true
};
using (var process = Process.Start(startInfo))
{
process?.WaitForExit(15000);
}
File.Delete(tempSab);
watcher.EnableRaisingEvents = false;
return [.. capturedFiles.Distinct()];
}
}

View File

@ -5,14 +5,12 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using AdonisUI.Controls;
using CUE4Parse;
using CUE4Parse.Compression;
using CUE4Parse.Encryption.Aes;
@ -22,11 +20,15 @@ using CUE4Parse.FileProvider.Vfs;
using CUE4Parse.GameTypes.Aion2.Objects;
using CUE4Parse.GameTypes.AoC.Objects;
using CUE4Parse.GameTypes.AshEchoes.FileProvider;
using CUE4Parse.GameTypes.SMG.UE4.Assets.Exports.Wwise;
using CUE4Parse.GameTypes.KRD.Assets.Exports;
using CUE4Parse.GameTypes.Borderlands3.Assets.Exports;
using CUE4Parse.GameTypes.Borderlands4.Assets.Exports;
using CUE4Parse.GameTypes.Borderlands4.Wwise;
using CUE4Parse.GameTypes.Borderlands3.Assets.Exports;
using CUE4Parse.GameTypes.DFHO.Assets.Objects;
using CUE4Parse.GameTypes.HonorOfKings.FileProvider;
using CUE4Parse.GameTypes.KRD.Assets.Exports;
using CUE4Parse.GameTypes.RocoKingdomWorld.Assets.Objects;
using CUE4Parse.GameTypes.SMG.UE4.Assets.Exports.Wwise;
using CUE4Parse.GameTypes.SquareEnix.UE4.Assets.Exports;
using CUE4Parse.MappingsProvider;
using CUE4Parse.UE4.AssetRegistry;
using CUE4Parse.UE4.Assets;
@ -58,14 +60,11 @@ using CUE4Parse.UE4.Shaders;
using CUE4Parse.UE4.Versions;
using CUE4Parse.UE4.Wwise;
using CUE4Parse.Utils;
using CUE4Parse_Conversion;
using CUE4Parse_Conversion.Sounds;
using EpicManifestParser;
using EpicManifestParser.UE;
using EpicManifestParser.ZlibngDotNetDecompressor;
using FModel.Creator;
using FModel.Extensions;
using FModel.Framework;
@ -74,21 +73,14 @@ using FModel.Settings;
using FModel.Views;
using FModel.Views.Resources.Controls;
using FModel.Views.Snooper;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using OpenTK.Windowing.Common;
using OpenTK.Windowing.Desktop;
using Serilog;
using SkiaSharp;
using Svg.Skia;
using UE4Config.Parsing;
using Application = System.Windows.Application;
using FGuid = CUE4Parse.UE4.Objects.Core.Misc.FGuid;
@ -163,6 +155,9 @@ public class CUE4ParseViewModel : ViewModel
public CriWareProvider CriWareProvider => _criWareProviderLazy?.Value;
public ConcurrentBag<string> UnknownExtensions = [];
public int ExportedCount;
public int FailedExportCount;
public CUE4ParseViewModel()
{
var currentDir = UserSettings.Default.CurrentDir;
@ -202,6 +197,7 @@ public class CUE4ParseViewModel : ViewModel
], SearchOption.AllDirectories, versionContainer, pathComparer),
_ when versionContainer.Game is EGame.GAME_AshEchoes => new AEDefaultFileProvider(gameDirectory, SearchOption.AllDirectories, versionContainer, pathComparer),
_ when versionContainer.Game is EGame.GAME_BlackStigma => new DefaultFileProvider(gameDirectory, SearchOption.AllDirectories, versionContainer, StringComparer.Ordinal),
_ when versionContainer.Game is EGame.GAME_HonorofKingsWorld => new HoKWDefaultFileProvider(gameDirectory, SearchOption.AllDirectories, versionContainer, pathComparer),
_ => new DefaultFileProvider(gameDirectory, SearchOption.AllDirectories, versionContainer, pathComparer)
};
@ -223,14 +219,12 @@ public class CUE4ParseViewModel : ViewModel
public async Task Initialize()
{
await _apiEndpointView.EpicApi.VerifyAuth(CancellationToken.None);
await _threadWorkerView.Begin(cancellationToken =>
{
Provider.OnDemandOptions = new IoStoreOnDemandOptions
{
ChunkHostUri = new Uri("https://download.epicgames.com/", UriKind.Absolute),
ChunkCacheDirectory = Directory.CreateDirectory(Path.Combine(UserSettings.Default.OutputDirectory, ".data")),
Authorization = new AuthenticationHeaderValue("Bearer", UserSettings.Default.LastAuthResponse.AccessToken),
Timeout = TimeSpan.FromSeconds(30)
};
@ -285,6 +279,20 @@ public class CUE4ParseViewModel : ViewModel
it => new FRandomAccessStreamArchive(it, manifest.FindFile(it)!.GetStream(), p.Versions));
});
var manifests = _apiEndpointView.DillyApi.GetManifests(cancellationToken);
var downloadUrl = manifests.First(x => x.AppName == "Fortnite_Studio").DownloadUrl;
using var client = new HttpClient();
var manifestBytes = client.GetByteArrayAsync(downloadUrl).GetAwaiter().GetResult();
var uefnManifest = FBuildPatchAppManifest.Deserialize(manifestBytes, manifestOptions);
Parallel.ForEach(uefnManifest.Files.Where(x => _fnLiveRegex.IsMatch(x.FileName)), fileManifest =>
{
p.RegisterVfs(fileManifest.FileName, [fileManifest.GetStream()],
it => new FRandomAccessStreamArchive(it, uefnManifest.FindFile(it)!.GetStream(), p.Versions));
});
var elapsedTime = Stopwatch.GetElapsedTime(startTs);
FLogger.Append(ELog.Information, () =>
FLogger.Text($"Fortnite [LIVE] has been loaded successfully in {elapsedTime.TotalMilliseconds:F1}ms", Constants.WHITE, true));
@ -323,7 +331,7 @@ public class CUE4ParseViewModel : ViewModel
}
Provider.Initialize();
_wwiseProviderLazy = new Lazy<WwiseProvider>(() => new WwiseProvider(Provider, UserSettings.Default.GameDirectory, UserSettings.Default.WwiseMaxBnkPrefetch));
_wwiseProviderLazy = new Lazy<WwiseProvider>(() => new WwiseProvider(Provider, UserSettings.Default.GameDirectory));
_fmodProviderLazy = new Lazy<FModProvider>(() => new FModProvider(Provider, UserSettings.Default.GameDirectory));
_criWareProviderLazy = new Lazy<CriWareProvider>(() => new CriWareProvider(Provider, UserSettings.Default.GameDirectory));
Log.Information($"{Provider.Versions.Game} ({Provider.Versions.Platform}) | Archives: x{Provider.UnloadedVfs.Count} | AES: x{Provider.RequiredKeys.Count} | Loose Files: x{Provider.Files.Count}");
@ -492,7 +500,7 @@ public class CUE4ParseViewModel : ViewModel
var ioStoreOnDemandPath = Path.Combine(UserSettings.Default.GameDirectory, "..\\..\\..\\Cloud", inst[0].Value.SubstringAfterLast("/").SubstringBefore("\""));
if (!File.Exists(ioStoreOnDemandPath)) return;
await Provider.RegisterVfsAsync(new IoChunkToc(ioStoreOnDemandPath));
await Provider.RegisterVfsAsync(new IoChunkToc(ioStoreOnDemandPath, Provider.Versions));
var onDemandCount = await Provider.MountAsync();
FLogger.Append(ELog.Information, () =>
FLogger.Text($"{onDemandCount} on-demand archive{(onDemandCount > 1 ? "s" : "")} streamed via epicgames.com", Constants.WHITE, true));
@ -599,6 +607,9 @@ public class CUE4ParseViewModel : ViewModel
foreach (var f in folder.Folders) ExportFolder(cancellationToken, f);
}
public void ExtractFolder(CancellationToken cancellationToken, TreeItem folder, EBulkType bulk)
=> BulkFolder(cancellationToken, folder, asset => Extract(cancellationToken, asset, TabControl.HasNoTabs, bulk));
public void ExtractFolder(CancellationToken cancellationToken, TreeItem folder)
=> BulkFolder(cancellationToken, folder, asset => Extract(cancellationToken, asset, TabControl.HasNoTabs));
@ -617,6 +628,9 @@ public class CUE4ParseViewModel : ViewModel
public void AudioFolder(CancellationToken cancellationToken, TreeItem folder)
=> BulkFolder(cancellationToken, folder, asset => Extract(cancellationToken, asset, TabControl.HasNoTabs, EBulkType.Audio | EBulkType.Auto));
public void CodeFolder(CancellationToken cancellationToken, TreeItem folder)
=> BulkFolder(cancellationToken, folder, asset => Extract(cancellationToken, asset, TabControl.HasNoTabs, EBulkType.Code | EBulkType.Auto));
public void Extract(CancellationToken cancellationToken, GameFile entry, bool addNewTab = false, EBulkType bulk = EBulkType.None)
{
ApplicationService.ApplicationView.IsAssetsExplorerVisible = false;
@ -630,6 +644,7 @@ public class CUE4ParseViewModel : ViewModel
var saveProperties = HasFlag(bulk, EBulkType.Properties);
var saveTextures = HasFlag(bulk, EBulkType.Textures);
var saveAudio = HasFlag(bulk, EBulkType.Audio);
var saveDecompiled = HasFlag(bulk, EBulkType.Code);
switch (entry.Extension)
{
case "uasset":
@ -644,6 +659,13 @@ public class CUE4ParseViewModel : ViewModel
if (saveProperties) break; // do not search for viewable exports if we are dealing with jsons
}
if (saveDecompiled)
{
if (Decompile(entry, false))
TabControl.SelectedTab.SaveDecompiled(updateUi);
break;
}
for (var i = result.InclusiveStart; i < result.ExclusiveEnd; i++)
{
if (CheckExport(cancellationToken, result.Package, i, bulk))
@ -667,6 +689,11 @@ public class CUE4ParseViewModel : ViewModel
ProcessAion2DatFile(entry, updateUi, saveProperties);
break;
}
case "bytes" when Provider.Versions.Game is EGame.GAME_RocoKingdomWorld:
{
ProcessRocoBinFile(entry, updateUi, saveProperties);
break;
}
case "dbc" when Provider.Versions.Game is EGame.GAME_AshesOfCreation:
{
ProcessCacheDBFile(entry, updateUi, saveProperties);
@ -694,7 +721,6 @@ public class CUE4ParseViewModel : ViewModel
case "verse":
case "html":
case "json5":
case "json":
case "uref":
case "cube":
case "usda":
@ -730,6 +756,8 @@ public class CUE4ParseViewModel : ViewModel
case "po":
case "md":
case "h":
case "non" when Provider.Versions.Game is EGame.GAME_RocoKingdomWorld:
case "cam" when Provider.Versions.Game is EGame.GAME_RocoKingdomWorld:
// Uncharted Waters Origin
case "crn":
case "uwt":
@ -747,6 +775,17 @@ public class CUE4ParseViewModel : ViewModel
break;
}
case "json":
{
var data = Provider.SaveAsset(entry);
using var stream = new MemoryStream(data) { Position = 0 };
using var reader = new StreamReader(stream);
var parsedJson = JsonConvert.DeserializeObject(reader.ReadToEnd());
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(parsedJson, Formatting.Indented), saveProperties, updateUi);
break;
}
case "locmeta":
{
var archive = entry.CreateReader();
@ -803,13 +842,13 @@ public class CUE4ParseViewModel : ViewModel
case "pck":
{
var archive = entry.CreateReader();
var wwise = new WwiseReader(archive);
var wwise = new WwiseReader(archive, new WwiseGameFileSource(entry));
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(wwise, Formatting.Indented), saveProperties, updateUi);
var medias = WwiseProvider.ExtractBankSounds(wwise);
foreach (var media in medias)
{
SaveAndPlaySound(cancellationToken, media.OutputPath, media.Extension, media.Data, saveAudio, updateUi);
SaveAndPlaySound(cancellationToken, media.OutputPath, media.Extension, media.Data?.GetData() ?? [], saveAudio, updateUi);
}
break;
@ -868,6 +907,13 @@ public class CUE4ParseViewModel : ViewModel
break;
}
case "ustbin" when Provider.Versions.Game is EGame.GAME_DeltaForce:
{
var archive = entry.CreateReader();
var ustbin = new FDeltaStringTable(archive);
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(ustbin, Formatting.Indented), saveProperties, updateUi);
break;
}
case "png":
case "jpg":
case "bmp":
@ -951,6 +997,40 @@ public class CUE4ParseViewModel : ViewModel
}
}
// Roco Kingdom: World
void ProcessRocoBinFile(GameFile entry, bool updateUi, bool saveProperties)
{
TabControl.SelectedTab.Highlighter = AvalonExtensions.HighlighterSelector("json");
var nonFileName = "/" + entry.NameWithoutExtension + ".non";
var nonPath = Provider.Files.Keys.FirstOrDefault(k => k.EndsWith(nonFileName, StringComparison.OrdinalIgnoreCase));
// I will only get one localization file because they did not translate any languages, lol
var locPathKey = entry.Path.Replace("/BinData/", "/BinLocalize/en_US/").Replace("/BinDataCompressed/", "/BinLocalize/en_US/");
var locFileFound = Provider.Files.TryGetValue(locPathKey, out var locEntry);
if (!string.IsNullOrEmpty(nonPath) && Provider.Files.TryGetValue(nonPath, out var nonEntry))
{
string json = Encoding.UTF8.GetString(nonEntry.Read());
var schema = JsonConvert.DeserializeObject<FRocoSchema>(json);
var archive = entry.CreateReader();
var locArchive = locFileFound ? new FRocoBinData(locEntry.CreateReader(), null, ERocoBinDataType.BinLocalize) : null;
var data = entry.PathWithoutExtension switch
{
var p when p.Contains("BinDataCompressed") => new FRocoBinData(archive, schema, ERocoBinDataType.BinDataCompressed, locArchive),
var p when p.Contains("BinData") => new FRocoBinData(archive, schema, ERocoBinDataType.BinData, locArchive),
var p when p.Contains("BinLocalize") => new FRocoBinData(archive, null, ERocoBinDataType.BinLocalize),
_ => null
};
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(data, Formatting.Indented), saveProperties, updateUi);
}
else if (entry.PathWithoutExtension.Contains("/Bin/"))
{
throw new Exception($"Could not find associated .non file for {entry.Name}");
}
}
void ProcessAion2DatFile(GameFile entry, bool updateUi, bool saveProperties)
{
TabControl.SelectedTab.Highlighter = AvalonExtensions.HighlighterSelector("json");
@ -965,7 +1045,7 @@ public class CUE4ParseViewModel : ViewModel
}
else if (entry.NameWithoutExtension.Equals("L10NString"))
{
var l10nData = new FAion2L10NFile(entry);
var l10nData = new FAion2L10NFile(entry, Provider);
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(l10nData, Formatting.Indented), saveProperties, updateUi);
}
else
@ -1116,7 +1196,8 @@ public class CUE4ParseViewModel : ViewModel
case UExternalSource when (isNone || saveAudio) && pointer.Object.Value is UExternalSource externalSource:
{
var audioName = Path.GetFileNameWithoutExtension(externalSource.ExternalSourcePath);
SaveAndPlaySound(cancellationToken, audioName, "wem", externalSource.Data?.WemFile ?? [], saveAudio, updateUi);
var outputPath = Path.Combine(TabControl.SelectedTab.Entry.PathWithoutExtension.Replace('\\', '/').SubstringBeforeLast('/'), audioName);
SaveAndPlaySound(cancellationToken, outputPath, "wem", externalSource.Data?.WemFile?.GetData() ?? [], saveAudio, updateUi);
return false;
}
case UAkAudioBank when (isNone || saveAudio) && pointer.Object.Value is UAkAudioBank soundBank:
@ -1124,7 +1205,7 @@ public class CUE4ParseViewModel : ViewModel
var extractedSounds = WwiseProvider.ExtractBankSounds(soundBank);
foreach (var sound in extractedSounds)
{
SaveAndPlaySound(cancellationToken, sound.OutputPath, sound.Extension, sound.Data, saveAudio, updateUi);
SaveAndPlaySound(cancellationToken, sound.OutputPath, sound.Extension, sound.Data?.GetData() ?? [], saveAudio, updateUi);
}
return false;
}
@ -1133,27 +1214,27 @@ public class CUE4ParseViewModel : ViewModel
var extractedSounds = WwiseProvider.ExtractAudioEventSounds(audioEvent);
foreach (var sound in extractedSounds)
{
SaveAndPlaySound(cancellationToken, sound.OutputPath, sound.Extension, sound.Data, saveAudio, updateUi);
SaveAndPlaySound(cancellationToken, sound.OutputPath, sound.Extension, sound.Data?.GetData() ?? [], saveAudio, updateUi);
}
return false;
}
case UFMODEvent when (isNone || saveAudio) && pointer.Object.Value is UFMODEvent fmodEvent:
{
var extractedSounds = FmodProvider.ExtractEventSounds(fmodEvent);
var directory = Path.GetDirectoryName(fmodEvent.Owner?.Name) ?? "/FMOD/Desktop/";
var directory = Path.GetDirectoryName(Provider.FixPath(fmodEvent.Owner?.Name ?? "/FMOD/Desktop/"));
foreach (var sound in extractedSounds)
{
SaveAndPlaySound(cancellationToken, Path.Combine(directory, sound.Name), sound.Extension, sound.Data, saveAudio, updateUi);
SaveAndPlaySound(cancellationToken, Path.Combine(directory, sound.Name).Replace("\\", "/"), sound.Extension, sound.Data, saveAudio, updateUi);
}
return false;
}
case UFMODBank when (isNone || saveAudio) && pointer.Object.Value is UFMODBank fmodBank:
{
var extractedSounds = FmodProvider.ExtractBankSounds(fmodBank);
var directory = Path.GetDirectoryName(fmodBank.Owner?.Name) ?? "/FMOD/Desktop/";
var directory = Path.GetDirectoryName(Provider.FixPath(fmodBank.Owner?.Name ?? "/FMOD/Desktop/"));
foreach (var sound in extractedSounds)
{
SaveAndPlaySound(cancellationToken, Path.Combine(directory, sound.Name), sound.Extension, sound.Data, saveAudio, updateUi);
SaveAndPlaySound(cancellationToken, Path.Combine(directory, sound.Name).Replace("\\", "/"), sound.Extension, sound.Data, saveAudio, updateUi);
}
return false;
}
@ -1176,11 +1257,27 @@ public class CUE4ParseViewModel : ViewModel
}
return false;
}
case USQEXSEADSoundBank or USQEXSEADSound when (isNone || saveAudio) && pointer.Object.Value is UObject squareEnixObject:
{
var data = squareEnixObject switch
{
USQEXSEADSoundBank sqexSoundBank => sqexSoundBank.SQEXSoundBankData?.Data ?? [],
USQEXSEADSound sqexSound => sqexSound.SQEXSoundData?.Data ?? [],
_ => [],
};
var sabPath = Path.Combine(TabControl.SelectedTab.Entry.PathWithoutExtension.Replace('\\', '/').SubstringBeforeLast('/'), squareEnixObject.Name);
var extractedSounds = AudioPlayerViewModel.ExtractSquareEnixAudio(sabPath, data);
foreach (var soundPath in extractedSounds)
{
SaveAndPlaySound(cancellationToken, soundPath, "wav", File.ReadAllBytes(soundPath), saveAudio, updateUi);
}
return false;
}
case UAkMediaAssetData when isNone || saveAudio:
case USoundWave when isNone || saveAudio:
{
// If UAkMediaAsset exists in the same package it should be used to handle the audio instead (because it contains actual audio name)
if (pointer.Object.Value is UAkMediaAssetData dataObj && dataObj.Outer is UAkMediaAsset)
if (pointer.Object.Value is UAkMediaAssetData dataObj && dataObj.Outer.Object.Value is UAkMediaAsset)
return false;
var shouldDecompress = UserSettings.Default.CompressedAudioMode == ECompressedAudio.PlayDecompressed;
@ -1197,13 +1294,14 @@ public class CUE4ParseViewModel : ViewModel
}
case UAkMediaAsset when (isNone || saveAudio) && pointer.Object.Value is UAkMediaAsset akMediaAsset:
{
var audioName = akMediaAsset.MediaName;
if (akMediaAsset.CurrentMediaAssetData?.TryLoad<UAkMediaAssetData>(out var akMediaAssetData) is true)
var audioName = akMediaAsset.MediaName ?? akMediaAsset.Name;
var outputPath = Path.Combine(TabControl.SelectedTab.Entry.PathWithoutExtension.Replace('\\', '/').SubstringBeforeLast('/'), audioName);
if (akMediaAsset.CurrentMediaAssetData?.ResolvedObject?.Object?.Value is UAkMediaAssetData akMediaAssetData)
{
var shouldDecompress = UserSettings.Default.CompressedAudioMode is ECompressedAudio.PlayDecompressed;
akMediaAssetData.Decode(shouldDecompress, out var audioFormat, out var data);
SaveAndPlaySound(cancellationToken, audioName, audioFormat, data, saveAudio, updateUi);
SaveAndPlaySound(cancellationToken, outputPath, audioFormat, data, saveAudio, updateUi);
}
return false;
}
@ -1212,14 +1310,15 @@ public class CUE4ParseViewModel : ViewModel
var shouldDecompress = UserSettings.Default.CompressedAudioMode is ECompressedAudio.PlayDecompressed;
foreach (var mediaIndex in akAudioEventData.MediaList)
{
if (mediaIndex.TryLoad<UAkMediaAsset>(out var akMediaAsset))
if (mediaIndex?.Object?.Value is UAkMediaAsset akMediaAsset)
{
if (akMediaAsset.CurrentMediaAssetData?.TryLoad<UAkMediaAssetData>(out var akMediaAssetData) is true)
if (akMediaAsset.CurrentMediaAssetData?.ResolvedObject?.Object?.Value is UAkMediaAssetData akMediaAssetData)
{
var audioName = akMediaAsset.MediaName ?? $"{akAudioEventData.Outer.Name} ({akMediaAsset.ID})";
var outputPath = Path.Combine(TabControl.SelectedTab.Entry.PathWithoutExtension.Replace('\\', '/').SubstringBeforeLast('/'), audioName);
akMediaAssetData.Decode(shouldDecompress, out var audioFormat, out var data);
SaveAndPlaySound(cancellationToken, audioName, audioFormat, data, saveAudio, updateUi);
SaveAndPlaySound(cancellationToken, outputPath, audioFormat, data, saveAudio, updateUi);
}
}
}
@ -1231,7 +1330,7 @@ public class CUE4ParseViewModel : ViewModel
var extractedSounds = WwiseProvider.ExtractDialogBorderlands3(dialogPerformanceData);
foreach (var sound in extractedSounds)
{
SaveAndPlaySound(cancellationToken, sound.OutputPath, sound.Extension, sound.Data, saveAudio, updateUi);
SaveAndPlaySound(cancellationToken, sound.OutputPath, sound.Extension, sound.Data?.GetData() ?? [], saveAudio, updateUi);
}
return false;
}
@ -1241,12 +1340,13 @@ public class CUE4ParseViewModel : ViewModel
if (Provider.Versions.Game is not EGame.GAME_Borderlands4)
return false;
var ownerDirectory = WwiseProvider.GetOwnerDirectory(faceFXAnimSet);
foreach (var faceFXAnimData in faceFXAnimSet.FaceFXAnimDataList)
{
var extractedSounds = WwiseProvider.ExtractAudioEventBorderlands4(faceFXAnimData.ID.Name, false);
var extractedSounds = WwiseProvider.ExtractAudioEventBorderlands4(ownerDirectory, faceFXAnimData.ID.Name, false);
foreach (var sound in extractedSounds)
{
SaveAndPlaySound(cancellationToken, sound.OutputPath, sound.Extension, sound.Data, saveAudio, updateUi);
SaveAndPlaySound(cancellationToken, sound.OutputPath, sound.Extension, sound.Data?.GetData() ?? [], saveAudio, updateUi);
}
}
@ -1255,12 +1355,13 @@ public class CUE4ParseViewModel : ViewModel
// Borderlands 4
case UGbxGraphAsset when (isNone || saveAudio) && pointer.Object.Value is UGbxGraphAsset gbxGraphAsset:
{
var ownerDirectory = WwiseProvider.GetOwnerDirectory(gbxGraphAsset);
foreach (var (eventName, useSoundTag) in GbxAudioUtil.GetAndClearEvents())
{
var extractedSounds = WwiseProvider.ExtractAudioEventBorderlands4(eventName, useSoundTag);
var extractedSounds = WwiseProvider.ExtractAudioEventBorderlands4(ownerDirectory, eventName, useSoundTag);
foreach (var sound in extractedSounds)
{
SaveAndPlaySound(cancellationToken, sound.OutputPath, sound.Extension, sound.Data, saveAudio, updateUi);
SaveAndPlaySound(cancellationToken, sound.OutputPath, sound.Extension, sound.Data?.GetData() ?? [], saveAudio, updateUi);
}
}
@ -1368,11 +1469,13 @@ public class CUE4ParseViewModel : ViewModel
}
public void Decompile(GameFile entry)
public bool Decompile(GameFile entry, bool AddTab = true)
{
ApplicationService.ApplicationView.IsAssetsExplorerVisible = false;
if (TabControl.CanAddTabs) TabControl.AddTab(entry);
if (TabControl.CanAddTabs && AddTab)
{
ApplicationService.ApplicationView.IsAssetsExplorerVisible = false;
TabControl.AddTab(entry);
}
else TabControl.SelectedTab.SoftReset(entry);
TabControl.SelectedTab.TitleExtra = "Decompiled";
@ -1401,56 +1504,57 @@ public class CUE4ParseViewModel : ViewModel
if (dummy is not UClass || pointer.Object.Value is not UClass blueprint)
continue;
cppList.Add(blueprint.DecompileBlueprintToPseudo(cookedMetaData));
cppList.Add(blueprint.DecompileBlueprintToPseudo(pkg.Mappings, cookedMetaData));
}
if (cppList.Count == 0) return false;
var cpp = cppList.Count > 1 ? string.Join("\n\n", cppList) : cppList.FirstOrDefault() ?? string.Empty;
if (entry.Path.Contains("_Verse.uasset"))
{
cpp = Regex.Replace(cpp, "__verse_0x[a-fA-F0-9]{8}_", ""); // UnmangleCasedName
}
cpp = Regex.Replace(cpp, @"CallFunc_([A-Za-z0-9_]+)_ReturnValue", "$1");
cpp = Regex.Replace(cpp, @"K2Node_DynamicCast_([A-Za-z0-9_]+)", "$1");
cpp = Regex.Replace(cpp, @"K2Node_([A-Za-z0-9_]+)", "$1");
TabControl.SelectedTab.SetDocumentText(cpp, false, false);
return true;
}
private void SaveAndPlaySound(CancellationToken cancellationToken, string fullPath, string ext, byte[] data, bool isBulk, bool updateUi)
private void SaveAndPlaySound(CancellationToken cancellationToken, string fullPath, string ext, byte[] data, bool saveAudio, bool updateUi)
{
if (fullPath.StartsWith('/')) fullPath = fullPath[1..];
var savedAudioPath = Path.Combine(UserSettings.Default.AudioDirectory,
UserSettings.Default.KeepDirectoryStructure ? fullPath : fullPath.SubstringAfterLast('/')).Replace('\\', '/') + $".{ext.ToLowerInvariant()}";
var extLower = ext.ToLowerInvariant();
var baseFilePath = UserSettings.Default.KeepDirectoryStructure ? fullPath : fullPath.SubstringAfterLast('/');
var combinedPath = Path.Combine(UserSettings.Default.AudioDirectory, baseFilePath);
var savedAudioPath = Path.ChangeExtension(combinedPath, extLower).Replace('\\', '/');
if (isBulk)
if (saveAudio)
{
cancellationToken.ThrowIfCancellationRequested();
Directory.CreateDirectory(savedAudioPath.SubstringBeforeLast('/'));
using var stream = new FileStream(savedAudioPath, FileMode.Create, FileAccess.Write);
using (var writer = new BinaryWriter(stream))
{
writer.Write(data);
writer.Flush();
}
var directory = Path.GetDirectoryName(savedAudioPath);
Directory.CreateDirectory(directory);
if (UserSettings.Default.ConvertAudioOnBulkExport)
bool conversionSuccess = true;
if (UserSettings.Default.ConvertAudioOnBulkExport && extLower is not "wav")
{
AudioPlayerViewModel.TryConvert(savedAudioPath, data, out string wavFilePath);
if (!string.IsNullOrEmpty(wavFilePath))
{
if (AudioPlayerViewModel.TryConvert(savedAudioPath, data, out string wavFilePath))
savedAudioPath = wavFilePath;
}
else if (updateUi)
else
{
FLogger.Append(ELog.Error, () =>
{
FLogger.Text("Failed to convert audio to WAV format, aborting extraction.", Constants.WHITE, true);
});
Interlocked.Increment(ref FailedExportCount);
return;
}
}
else
{
using var stream = new FileStream(savedAudioPath, FileMode.Create, FileAccess.Write);
stream.Write(data);
}
Interlocked.Increment(ref ExportedCount);
Log.Information("Successfully saved {FilePath}", savedAudioPath);
if (updateUi)
if (updateUi && conversionSuccess)
{
FLogger.Append(ELog.Information, () =>
{
@ -1462,6 +1566,9 @@ public class CUE4ParseViewModel : ViewModel
return;
}
if (!updateUi)
return;
// TODO
// since we are currently in a thread, the audio player's lifetime (memory-wise) will keep the current thread up and running until fmodel itself closes
// the solution would be to kill the current thread at this line and then open the audio player without "Application.Current.Dispatcher.Invoke"
@ -1479,6 +1586,7 @@ public class CUE4ParseViewModel : ViewModel
var toSaveDirectory = new DirectoryInfo(UserSettings.Default.ModelDirectory);
if (toSave.TryWriteToDir(toSaveDirectory, out var label, out var savedFilePath))
{
Interlocked.Increment(ref ExportedCount);
Log.Information("Successfully saved {FilePath}", savedFilePath);
if (updateUi)
{
@ -1491,6 +1599,7 @@ public class CUE4ParseViewModel : ViewModel
}
else
{
Interlocked.Increment(ref FailedExportCount);
Log.Error("{FileName} could not be saved", export.Name);
FLogger.Append(ELog.Error, () => FLogger.Text($"Could not save '{export.Name}'", Constants.WHITE, true));
}
@ -1512,6 +1621,7 @@ public class CUE4ParseViewModel : ViewModel
}
});
Interlocked.Increment(ref ExportedCount);
Log.Information("{FileName} successfully exported", entry.Name);
if (updateUi)
{
@ -1524,6 +1634,7 @@ public class CUE4ParseViewModel : ViewModel
}
else
{
Interlocked.Increment(ref FailedExportCount);
Log.Error("{FileName} could not be exported", entry.Name);
if (updateUi)
FLogger.Append(ELog.Error, () => FLogger.Text($"Could not export '{entry.Name}'", Constants.WHITE, true));

View File

@ -1,7 +1,11 @@
using System;
using System.Collections;
using System.Data;
using System.IO;
using System.Linq;
using System.Threading;
using CUE4Parse.FileProvider.Objects;
using CUE4Parse.Utils;
using FModel.Framework;
using FModel.Services;
using FModel.Settings;
@ -13,8 +17,21 @@ public class RightClickMenuCommand : ViewModelCommand<ApplicationViewModel>
{
private ThreadWorkerViewModel _threadWorkerView => ApplicationService.ThreadWorkerView;
public RightClickMenuCommand(ApplicationViewModel contextViewModel) : base(contextViewModel)
public RightClickMenuCommand(ApplicationViewModel contextViewModel) : base(contextViewModel) { }
private enum EAction
{
Show,
Export,
}
private enum EShowAssetType
{
None,
JSON,
Metadata,
References,
Decompile,
}
public override async void Execute(ApplicationViewModel contextViewModel, object parameter)
@ -26,189 +43,151 @@ public class RightClickMenuCommand : ViewModelCommand<ApplicationViewModel>
if (param.Length == 0) return;
var folders = param.OfType<TreeItem>().ToArray();
var assets = param.SelectMany(item => item switch
{
GameFile gf => new[] { gf }, // search view passes GameFile directly
GameFileViewModel gvm => new[] { gvm.Asset },
_ => []
}).ToArray();
var assets = param
.Select(static item => item switch
{
GameFile gf => gf, // Search view passes GameFile directly
GameFileViewModel gvm => gvm.Asset,
_ => null
})
.Where(static gf => gf is not null).ToArray();
if (folders.Length == 0 && assets.Length == 0)
return;
var updateUi = assets.Length > 1 ? EBulkType.Auto : EBulkType.None;
var assetsGroups = assets.GroupBy(static gf => gf.Directory);
var (action, showtype, bulktype) = trigger switch
{
"Assets_Extract_New_Tab" => (EAction.Show, EShowAssetType.JSON, EBulkType.None),
"Assets_Show_Metadata" => (EAction.Show, EShowAssetType.Metadata, EBulkType.None),
"Assets_Show_References" => (EAction.Show, EShowAssetType.References, EBulkType.None),
"Assets_Decompile" => (EAction.Show, EShowAssetType.Decompile, EBulkType.Code),
"Save_Data" => (EAction.Export, EShowAssetType.None, EBulkType.Raw),
"Save_Properties" => (EAction.Export, EShowAssetType.None, EBulkType.Properties),
"Save_Textures" => (EAction.Export, EShowAssetType.None, EBulkType.Textures),
"Save_Models" => (EAction.Export, EShowAssetType.None, EBulkType.Meshes),
"Save_Animations" => (EAction.Export, EShowAssetType.None, EBulkType.Animations),
"Save_Audio" => (EAction.Export, EShowAssetType.None, EBulkType.Audio),
"Save_Code" => (EAction.Export, EShowAssetType.None, EBulkType.Code),
_ => throw new ArgumentOutOfRangeException("Unsupported asset action."),
};
Interlocked.Exchange(ref contextViewModel.CUE4Parse.ExportedCount, 0);
Interlocked.Exchange(ref contextViewModel.CUE4Parse.FailedExportCount, 0);
await _threadWorkerView.Begin(cancellationToken =>
{
switch (trigger)
if (action is EAction.Show)
{
#region Asset Commands
case "Assets_Extract_New_Tab":
foreach (var entry in assets)
{
Thread.Yield();
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.Extract(cancellationToken, entry, true);
}
break;
case "Assets_Show_Metadata":
foreach (var entry in assets)
{
Thread.Yield();
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.ShowMetadata(entry);
}
break;
case "Assets_Show_References":
{
Thread.Yield();
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.FindReferences(assets.FirstOrDefault());
}
break;
case "Assets_Decompile":
foreach (var entry in assets)
{
Thread.Yield();
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.Decompile(entry);
}
break;
case "Assets_Export_Data":
foreach (var entry in assets)
{
Thread.Yield();
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.ExportData(entry);
}
break;
case "Assets_Save_Properties":
foreach (var entry in assets)
{
Thread.Yield();
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.Extract(cancellationToken, entry, false, EBulkType.Properties | updateUi);
}
break;
case "Assets_Save_Textures":
foreach (var entry in assets)
{
Thread.Yield();
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.Extract(cancellationToken, entry, false, EBulkType.Textures | updateUi);
}
break;
case "Assets_Save_Models":
foreach (var entry in assets)
{
Thread.Yield();
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.Extract(cancellationToken, entry, false, EBulkType.Meshes | updateUi);
}
break;
case "Assets_Save_Animations":
foreach (var entry in assets)
{
Thread.Yield();
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.Extract(cancellationToken, entry, false, EBulkType.Animations | updateUi);
}
break;
case "Assets_Save_Audio":
foreach (var entry in assets)
{
Thread.Yield();
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.Extract(cancellationToken, entry, false, EBulkType.Audio | updateUi);
}
break;
#endregion
if (showtype is EShowAssetType.References)
assets = [assets.FirstOrDefault()];
#region Folder Commands
case "Folders_Export_Data":
foreach (var folder in folders)
{
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.ExportFolder(cancellationToken, folder);
Action<GameFile> entryAction = showtype switch
{
EShowAssetType.JSON => entry => contextViewModel.CUE4Parse.Extract(cancellationToken, entry, true),
EShowAssetType.Metadata => entry => contextViewModel.CUE4Parse.ShowMetadata(entry),
EShowAssetType.Decompile => entry => contextViewModel.CUE4Parse.Decompile(entry),
EShowAssetType.References => entry => contextViewModel.CUE4Parse.FindReferences(entry),
_ => throw new ArgumentOutOfRangeException("Unsupported asset action type."),
};
FLogger.Append(ELog.Information, () =>
{
FLogger.Text("Successfully exported ", Constants.WHITE);
FLogger.Link(folder.PathAtThisPoint, UserSettings.Default.RawDataDirectory, true);
});
}
break;
case "Folders_Save_Properties":
foreach (var folder in folders)
{
Thread.Yield();
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.SaveFolder(cancellationToken, folder);
foreach (var entry in assets)
{
Thread.Yield();
cancellationToken.ThrowIfCancellationRequested();
entryAction(entry);
}
FLogger.Append(ELog.Information, () =>
{
FLogger.Text("Successfully saved ", Constants.WHITE);
FLogger.Link(folder.PathAtThisPoint, UserSettings.Default.PropertiesDirectory, true);
});
}
break;
case "Folders_Save_Textures":
foreach (var folder in folders)
{
Thread.Yield();
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.TextureFolder(cancellationToken, folder);
return;
}
FLogger.Append(ELog.Information, () =>
{
FLogger.Text("Successfully saved textures from ", Constants.WHITE);
FLogger.Link(folder.PathAtThisPoint, UserSettings.Default.TextureDirectory, true);
});
}
break;
case "Folders_Save_Models":
foreach (var folder in folders)
{
Thread.Yield();
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.ModelFolder(cancellationToken, folder);
var (dirType, filetype) = bulktype switch
{
EBulkType.Raw => (UserSettings.Default.RawDataDirectory, "files"),
EBulkType.Properties => (UserSettings.Default.PropertiesDirectory, "json files"),
EBulkType.Textures => (UserSettings.Default.TextureDirectory, "textures"),
EBulkType.Meshes => (UserSettings.Default.ModelDirectory, "models"),
EBulkType.Animations => (UserSettings.Default.ModelDirectory, "animations"),
EBulkType.Audio => (UserSettings.Default.AudioDirectory, "audio files"),
EBulkType.Code => (UserSettings.Default.CodeDirectory, "code files"),
_ => (null, null),
};
FLogger.Append(ELog.Information, () =>
{
FLogger.Text("Successfully saved models from ", Constants.WHITE);
FLogger.Link(folder.PathAtThisPoint, UserSettings.Default.ModelDirectory, true);
});
}
break;
case "Folders_Save_Animations":
foreach (var folder in folders)
{
Thread.Yield();
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.AnimationFolder(cancellationToken, folder);
if (string.IsNullOrEmpty(dirType))
return;
FLogger.Append(ELog.Information, () =>
{
FLogger.Text("Successfully saved animations from ", Constants.WHITE);
FLogger.Link(folder.PathAtThisPoint, UserSettings.Default.ModelDirectory, true);
});
}
break;
case "Folders_Save_Audio":
foreach (var folder in folders)
{
Thread.Yield();
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.AudioFolder(cancellationToken, folder);
Action<TreeItem> folderAction = bulktype switch
{
EBulkType.Raw => folder => contextViewModel.CUE4Parse.ExportFolder(cancellationToken, folder),
_ => folder => contextViewModel.CUE4Parse.ExtractFolder(cancellationToken, folder, bulktype | EBulkType.Auto),
};
FLogger.Append(ELog.Information, () =>
{
FLogger.Text("Successfully saved audio from ", Constants.WHITE);
FLogger.Link(folder.PathAtThisPoint, UserSettings.Default.AudioDirectory, true);
});
}
break;
#endregion
foreach (var folder in folders)
{
cancellationToken.ThrowIfCancellationRequested();
folderAction(folder);
var path = Path.Combine(dirType, UserSettings.Default.KeepDirectoryStructure ? folder.PathAtThisPoint : folder.PathAtThisPoint.SubstringAfterLast('/')).Replace('\\', '/');
LogExport(contextViewModel, folder.PathAtThisPoint, path, dirType, filetype);
}
Action<GameFile, EBulkType, bool> fileAction = bulktype switch
{
EBulkType.Raw => (entry, _, update) => contextViewModel.CUE4Parse.ExportData(entry, !update),
_ => (entry, bulk, update) => contextViewModel.CUE4Parse.Extract(cancellationToken, entry, false, bulk),
};
foreach (var group in assetsGroups)
{
var directory = group.Key;
var list = group.ToArray();
var update = list.Length > 1;
var bulk = bulktype | (update ? EBulkType.Auto : EBulkType.None);
foreach (var entry in list)
{
Thread.Yield();
cancellationToken.ThrowIfCancellationRequested();
fileAction(entry, bulk, update);
}
if (update)
{
var path = Path.Combine(dirType, UserSettings.Default.KeepDirectoryStructure ? directory : directory.SubstringAfterLast('/')).Replace('\\', '/');
LogExport(contextViewModel, directory, path, dirType, filetype);
}
}
});
}
private void LogExport(ApplicationViewModel contextViewModel, string directory, string path, string basePath, string fileType)
{
if (contextViewModel.CUE4Parse.ExportedCount > 0)
{
FLogger.Append(ELog.Information, () =>
{
FLogger.Text($"Successfully exported {contextViewModel.CUE4Parse.ExportedCount} {fileType} from ", Constants.WHITE);
FLogger.Link(directory, Path.Exists(path) ? path : basePath, true);
});
}
else if (contextViewModel.CUE4Parse.FailedExportCount == 0)
{
// Not an error because folder simply might not contain type of asset user is trying to save
FLogger.Append(ELog.Warning, () =>
{
FLogger.Text($"Failed to find any {fileType} in {directory}", Constants.WHITE, true);
});
}
if (contextViewModel.CUE4Parse.FailedExportCount > 0)
{
FLogger.Append(ELog.Error, () =>
{
FLogger.Text($"Failed to export {contextViewModel.CUE4Parse.FailedExportCount} {fileType} from {directory}", Constants.WHITE, true);
});
}
Interlocked.Exchange(ref contextViewModel.CUE4Parse.ExportedCount, 0);
Interlocked.Exchange(ref contextViewModel.CUE4Parse.FailedExportCount, 0);
}
}

View File

@ -34,34 +34,34 @@ public class TabCommand : ViewModelCommand<TabItem>
case "Find_References":
_applicationView.CUE4Parse.FindReferences(tabViewModel.Entry);
break;
case "Asset_Export_Data":
case "Save_Data":
await _threadWorkerView.Begin(_ => _applicationView.CUE4Parse.ExportData(tabViewModel.Entry));
break;
case "Asset_Save_Properties":
case "Save_Properties":
await _threadWorkerView.Begin(cancellationToken =>
{
_applicationView.CUE4Parse.Extract(cancellationToken, tabViewModel.Entry, false, EBulkType.Properties);
});
break;
case "Asset_Save_Textures":
case "Save_Textures":
await _threadWorkerView.Begin(cancellationToken =>
{
_applicationView.CUE4Parse.Extract(cancellationToken, tabViewModel.Entry, false, EBulkType.Textures);
});
break;
case "Asset_Save_Models":
case "Save_Models":
await _threadWorkerView.Begin(cancellationToken =>
{
_applicationView.CUE4Parse.Extract(cancellationToken, tabViewModel.Entry, false, EBulkType.Meshes);
});
break;
case "Asset_Save_Animations":
case "Save_Animations":
await _threadWorkerView.Begin(cancellationToken =>
{
_applicationView.CUE4Parse.Extract(cancellationToken, tabViewModel.Entry, false, EBulkType.Animations);
});
break;
case "Asset_Save_Audio":
case "Save_Audio":
await _threadWorkerView.Begin(cancellationToken =>
{
_applicationView.CUE4Parse.Extract(cancellationToken, tabViewModel.Entry, false, EBulkType.Audio);

View File

@ -12,6 +12,7 @@ using CUE4Parse.GameTypes.Borderlands4.Assets.Exports;
using CUE4Parse.GameTypes.FN.Assets.Exports.DataAssets;
using CUE4Parse.GameTypes.SMG.UE4.Assets.Exports.Wwise;
using CUE4Parse.GameTypes.SMG.UE4.Assets.Objects;
using CUE4Parse.GameTypes.SquareEnix.UE4.Assets.Exports;
using CUE4Parse.UE4.Assets;
using CUE4Parse.UE4.Assets.Exports;
using CUE4Parse.UE4.Assets.Exports.Animation;
@ -67,6 +68,7 @@ public class GameFileViewModel(GameFile asset) : ViewModel
private const int MaxPreviewSize = 128;
private ApplicationViewModel _applicationView => ApplicationService.ApplicationView;
private EGame? GameVersion => _applicationView.CUE4Parse?.Provider.Versions.Game;
public EResolveCompute Resolved { get; private set; } = EResolveCompute.None;
public GameFile Asset { get; } = asset;
@ -244,9 +246,9 @@ public class GameFileViewModel(GameFile asset) : ViewModel
UFMODBankLookup => (EAssetCategory.Data, EBulkType.None),
UFMODBus or UFMODSnapshot or UFMODSnapshotReverb or UFMODVCA => (EAssetCategory.Audio, EBulkType.None),
UFMODBus or UFMODSnapshot or UFMODSnapshotReverb or UFMODVCA or USQEXSEADSoundAttenuation => (EAssetCategory.Audio, EBulkType.None),
UFMODBank or UAkAudioBank or UAtomWaveBank or UAkInitBank => (EAssetCategory.SoundBank, EBulkType.Audio),
UFMODBank or UAkAudioBank or UAtomWaveBank or UAkInitBank or USQEXSEADSoundBank => (EAssetCategory.SoundBank, EBulkType.Audio),
UWwiseAssetLibrary or USoundBase or UAkMediaAssetData or UAtomCueSheet
or USoundAtomCueSheet or UAkAudioType or UExternalSource or UExternalSourceBank
@ -258,9 +260,9 @@ public class GameFileViewModel(GameFile asset) : ViewModel
UNiagaraSystem or UNiagaraScriptBase or UParticleSystem => (EAssetCategory.Particle, EBulkType.None),
// Game specific assets below
UBorderlandsDialogObject => (EAssetCategory.Borderlands, EBulkType.None), // Borderlands 3;
UGbxGraphAsset or UDialogScriptData or UDialogPerformanceData => (EAssetCategory.Borderlands, EBulkType.Audio), // Borderlands 4; Borderlands 3;
UFaceFXAnimSet when _applicationView.CUE4Parse?.Provider.Versions.Game is EGame.GAME_Borderlands4 => (EAssetCategory.Borderlands, EBulkType.Audio), // Borderlands 4;
UBorderlandsDialogObject when GameVersion is EGame.GAME_Borderlands3 => (EAssetCategory.Borderlands, EBulkType.None), // Borderlands 3;
UGbxGraphAsset or UDialogScriptData or UDialogPerformanceData when GameVersion is EGame.GAME_Borderlands4 or EGame.GAME_Borderlands3 => (EAssetCategory.Borderlands, EBulkType.Audio), // Borderlands 4; Borderlands 3;
UFaceFXAnimSet when GameVersion is EGame.GAME_Borderlands4 => (EAssetCategory.Borderlands, EBulkType.Audio), // Borderlands 4;
_ => (EAssetCategory.All, EBulkType.None),
};
@ -355,7 +357,9 @@ public class GameFileViewModel(GameFile asset) : ViewModel
case "csv":
AssetCategory = EAssetCategory.Data;
break;
case "stinfo":
case "ushaderbytecode":
case "upipelinecache":
AssetCategory = EAssetCategory.ByteCode;
break;
case "wav":
@ -430,10 +434,21 @@ public class GameFileViewModel(GameFile asset) : ViewModel
});
}
// Game specific extensions below
case "ace": // Borderlands 3
case "ncs": // Borderlands 4
case "ace" when GameVersion is EGame.GAME_Borderlands3:
case "ncs" when GameVersion is EGame.GAME_Borderlands4:
AssetCategory = EAssetCategory.Borderlands;
break;
case "dat" when GameVersion is EGame.GAME_Aion2:
AssetCategory = EAssetCategory.Aion2;
break;
case "bytes" when GameVersion is EGame.GAME_RocoKingdomWorld:
case "non" when GameVersion is EGame.GAME_RocoKingdomWorld:
case "cam" when GameVersion is EGame.GAME_RocoKingdomWorld:
AssetCategory = EAssetCategory.RocoKingdomWorld;
break;
case "ustbin" when GameVersion is EGame.GAME_DeltaForce:
AssetCategory = EAssetCategory.DeltaForce;
break;
default:
AssetCategory = EAssetCategory.All; // just so it sets resolved
break;

View File

@ -4,6 +4,8 @@ using Serilog;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
@ -67,12 +69,103 @@ public class GameSelectorViewModel : ViewModel
public void AddUndetectedDir(string gameDirectory) => AddUndetectedDir(gameDirectory.SubstringAfterLast('\\'), gameDirectory);
public void AddUndetectedDir(string gameName, string gameDirectory)
{
var setting = DirectorySettings.Default(gameName, gameDirectory, true);
if (TryDetectUeVersion(gameDirectory, out var ueVersion, out var newGameDirectory))
{
// gameDirectory = newGameDirectory; // directory was changed to point to the correct paks folder
}
var setting = DirectorySettings.Default(gameName, gameDirectory, true, ueVersion);
UserSettings.Default.PerDirectory[gameDirectory] = setting;
_detectedDirectories.Add(setting);
SelectedDirectory = DetectedDirectories.Last();
}
private bool TryDetectUeVersion(string gameDirectory, out EGame ueVersion, [MaybeNullWhen(false)] out string newGameDirectory)
{
var targetGameDir = gameDirectory;
if (!targetGameDir.EndsWith("Paks", StringComparison.OrdinalIgnoreCase))
{
var dirs = Directory.GetDirectories(targetGameDir, "Paks", SearchOption.AllDirectories);
var paksDir = dirs.Length == 1 ? dirs[0] : dirs.FirstOrDefault(x => !x.EndsWith("Engine\\Programs\\CrashReportClient\\Content\\Paks"));
if (!string.IsNullOrEmpty(paksDir))
{
Log.Warning("Selected directory \"{GameDirectory}\" does not end with \"Paks\". Looking in \"{PaksDir}\" instead.", targetGameDir, paksDir);
targetGameDir = paksDir;
}
if (Directory.GetFiles(gameDirectory, "*.exe") is { Length: 1 } exe && TryGetUeVersionFromExe(exe[0], out ueVersion))
{
// we checked the exe in the original directory, the BootstrapPackagedGame one
// but we still want c4p to use the paks folder as the game directory (if any), not the original one
newGameDirectory = targetGameDir;
Log.Information("Detected UE version {UeVersion} from \"{Exe}\"", ueVersion, exe[0]);
return true;
}
}
// past this point, we assume targetGameDir is the correct Paks folder
newGameDirectory = targetGameDir;
var projectDir = Path.Combine(targetGameDir, "..", "..");
var projectBinariesDir = Path.Combine(projectDir, "Binaries", "Win64");
if (Directory.Exists(projectBinariesDir))
{
if (Directory.GetFiles(projectBinariesDir, "*-Win64-Shipping.exe") is { Length: > 0 } shipping)
{
foreach (var exe in shipping)
{
if (TryGetUeVersionFromExe(exe, out ueVersion))
{
Log.Information("Detected UE version {UeVersion} from \"{Exe}\"", ueVersion, exe);
return true;
}
}
}
else if (Directory.GetFiles(projectBinariesDir, "*.exe") is { Length: < 3 } exes)
{
foreach (var exe in exes)
{
if (TryGetUeVersionFromExe(exe, out ueVersion))
{
Log.Information("Detected UE version {UeVersion} from \"{Exe}\"", ueVersion, exe);
return true;
}
}
}
}
var crashReportClientExe = Path.Combine(projectDir, "..", "Engine", "Binaries", "Win64", "CrashReportClient.exe");
if (File.Exists(crashReportClientExe) && TryGetUeVersionFromExe(crashReportClientExe, out ueVersion))
{
Log.Information("Detected UE version {UeVersion} from \"{Exe}\"", ueVersion, crashReportClientExe);
return true;
}
ueVersion = EGame.GAME_UE4_LATEST;
Log.Warning("Failed to detect UE version for \"{GameDirectory}\".", gameDirectory);
return false;
}
private bool TryGetUeVersionFromExe(string exePath, out EGame ueVersion)
{
ueVersion = EGame.GAME_UE4_LATEST;
try
{
var info = FileVersionInfo.GetVersionInfo(exePath);
ueVersion = info.FileMajorPart switch
{
4 => (EGame) Math.Min((uint)(GameUtils.GameUe4Base + (info.FileMinorPart << 16)), (uint) EGame.GAME_UE4_LATEST),
5 => (EGame) Math.Min((uint)(GameUtils.GameUe5Base + (info.FileMinorPart << 16)), (uint) EGame.GAME_UE5_LATEST),
_ => throw new InvalidOperationException($"Unsupported UE major version {info.FileMajorPart} detected from {exePath}")
};
return true;
}
catch
{
return false;
}
}
public void DeleteSelectedGame()
{
UserSettings.Default.PerDirectory.Remove(SelectedDirectory.GameDirectory); // should not be a problem

View File

@ -195,6 +195,7 @@ public class SettingsViewModel : ViewModel
private string _propertiesSnapshot;
private string _textureSnapshot;
private string _audioSnapshot;
private string _codeSnapshot;
private string _modelSnapshot;
private string _gameSnapshot;
private ETexturePlatform _uePlatformSnapshot;
@ -227,6 +228,7 @@ public class SettingsViewModel : ViewModel
_propertiesSnapshot = UserSettings.Default.PropertiesDirectory;
_textureSnapshot = UserSettings.Default.TextureDirectory;
_audioSnapshot = UserSettings.Default.AudioDirectory;
_codeSnapshot = UserSettings.Default.CodeDirectory;
_modelSnapshot = UserSettings.Default.ModelDirectory;
_gameSnapshot = UserSettings.Default.GameDirectory;
_uePlatformSnapshot = UserSettings.Default.CurrentDir.TexturePlatform;
@ -303,12 +305,6 @@ public class SettingsViewModel : ViewModel
if (_ueGameSnapshot != SelectedUeGame || _customVersionsSnapshot != SelectedCustomVersions ||
_uePlatformSnapshot != SelectedUePlatform || _optionsSnapshot != SelectedOptions || // combobox
_mapStructTypesSnapshot != SelectedMapStructTypes ||
_outputSnapshot != UserSettings.Default.OutputDirectory || // textbox
_rawDataSnapshot != UserSettings.Default.RawDataDirectory || // textbox
_propertiesSnapshot != UserSettings.Default.PropertiesDirectory || // textbox
_textureSnapshot != UserSettings.Default.TextureDirectory || // textbox
_audioSnapshot != UserSettings.Default.AudioDirectory || // textbox
_modelSnapshot != UserSettings.Default.ModelDirectory || // textbox
_gameSnapshot != UserSettings.Default.GameDirectory) // textbox
restart = true;

View File

@ -1,6 +1,17 @@
using System;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Threading;
using System.Windows;
using System.Windows.Media.Imaging;
using CUE4Parse.FileProvider.Objects;
using CUE4Parse.UE4.Assets.Exports.Texture;
using CUE4Parse.Utils;
using CUE4Parse_Conversion.Textures;
using FModel.Extensions;
using FModel.Framework;
using FModel.Services;
using FModel.Settings;
using FModel.ViewModels.Commands;
using FModel.Views.Resources.Controls;
@ -8,15 +19,6 @@ using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Highlighting;
using Serilog;
using SkiaSharp;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Media.Imaging;
using CUE4Parse.UE4.Assets.Exports.Texture;
using CUE4Parse_Conversion.Textures;
using CUE4Parse.FileProvider.Objects;
using CUE4Parse.Utils;
namespace FModel.ViewModels;
@ -374,8 +376,7 @@ public class TabItem : ViewModel
public void SaveImage() => SaveImage(SelectedImage, true);
private void SaveImage(TabImage image, bool updateUi)
{
if (image == null)
return;
if (image is null) return;
var path = Path.Combine(UserSettings.Default.TextureDirectory, UserSettings.Default.KeepDirectoryStructure ? Entry.Directory : "", image.ExportName).Replace('\\', '/');
@ -392,6 +393,7 @@ public class TabItem : ViewModel
private void SaveImage(TabImage image, string path)
{
if (image.ImageBuffer is null) return;
using var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read);
fs.Write(image.ImageBuffer, 0, image.ImageBuffer.Length);
}
@ -407,11 +409,22 @@ public class TabItem : ViewModel
Application.Current.Dispatcher.Invoke(() => File.WriteAllText(directory, Document.Text));
SaveCheck(directory, fileName, updateUi);
}
public void SaveDecompiled(bool updateUi)
{
var fileName = Path.ChangeExtension(Entry.Name, ".cpp");
var directory = Path.Combine(UserSettings.Default.PropertiesDirectory,
UserSettings.Default.KeepDirectoryStructure ? Entry.Directory : "", fileName).Replace('\\', '/');
Directory.CreateDirectory(directory.SubstringBeforeLast('/'));
Application.Current.Dispatcher.Invoke(() => File.WriteAllText(directory, Document.Text));
SaveCheck(directory, fileName, updateUi);
}
private void SaveCheck(string path, string fileName, bool updateUi)
{
if (File.Exists(path))
{
Interlocked.Increment(ref ApplicationService.ApplicationView.CUE4Parse.ExportedCount);
Log.Information("{FileName} successfully saved", fileName);
if (updateUi)
{
@ -424,6 +437,7 @@ public class TabItem : ViewModel
}
else
{
Interlocked.Increment(ref ApplicationService.ApplicationView.CUE4Parse.FailedExportCount);
Log.Error("{FileName} could not be saved", fileName);
if (updateUi)
FLogger.Append(ELog.Error, () => FLogger.Text($"Could not save '{fileName}'", Constants.WHITE, true));

View File

@ -1,6 +1,7 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using CUE4Parse.UE4.Exceptions;
using FModel.Framework;
using FModel.Services;
using FModel.Views.Resources.Controls;
@ -100,7 +101,26 @@ public class ThreadWorkerViewModel : ViewModel
CurrentCancellationTokenSource = null; // kill token
Log.Error("{Exception}", e);
FLogger.Append(e);
switch (e)
{
case MappingException:
FLogger.Append(ELog.Error, () =>
{
FLogger.Text("Package has unversioned properties but mapping file (.usmap) is missing, can't serialize. See: ", Constants.WHITE);
FLogger.Link("→ link ←", Constants.MAPPING_ISSUE_LINK, true);
});
break;
case VersionException v: // Error might be unrelated to version, but it's usually the case
FLogger.Append(ELog.Error, () =>
{
FLogger.Text(v.Message[..^1] + ", can't serialize. Make sure the correct UE version is configured. See: ", Constants.WHITE);
FLogger.Link("→ link ←", Constants.VERSION_ISSUE_LINK, true);
});
break;
default:
FLogger.Append(e);
break;
}
return;
}
}

View File

@ -81,6 +81,9 @@ public partial class UpdateViewModel : ViewModel
if (username.Equals("Asval", StringComparison.OrdinalIgnoreCase))
{
username = "4sval"; // found out the hard way co-authored usernames can't be trusted
} else if (username.Equals("Krowe Moh", StringComparison.OrdinalIgnoreCase))
{
username = "Krowe-moh";
}
coAuthorMap[commit].Add(username);
@ -101,7 +104,7 @@ public partial class UpdateViewModel : ViewModel
}
catch
{
//
// Ignore
}
}

View File

@ -1,4 +1,4 @@
<adonisControls:AdonisWindow x:Class="FModel.Views.DirectorySelector"
<adonisControls:AdonisWindow x:Class="FModel.Views.DirectorySelector"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:FModel.Views.Resources.Controls"
@ -8,7 +8,8 @@
xmlns:adonisExtensions="clr-namespace:AdonisUI.Extensions;assembly=AdonisUI"
WindowStartupLocation="CenterScreen" ResizeMode="NoResize" IconVisibility="Collapsed" SizeToContent="Height"
MinHeight="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenHeight}, Converter={converters:RatioConverter}, ConverterParameter='0.20'}"
Width="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenWidth}, Converter={converters:RatioConverter}, ConverterParameter='0.25'}">
Width="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenWidth}, Converter={converters:RatioConverter}, ConverterParameter='0.25'}"
AllowDrop="True">
<adonisControls:AdonisWindow.Style>
<Style TargetType="adonisControls:AdonisWindow" BasedOn="{StaticResource {x:Type adonisControls:AdonisWindow}}" >
<Setter Property="Title" Value="Directory Selector" />
@ -83,9 +84,12 @@
</Button>
</Grid>
<Separator Style="{StaticResource CustomSeparator}" Tag="ADD UNDETECTED GAME" />
<Expander ExpandDirection="Down" IsExpanded="False">
<Separator Style="{StaticResource CustomSeparator}" Tag="ADD UNDETECTED GAME" Margin="0,0,0,0"/>
<TextBlock Text="Drag &amp; drop folder to quickly configure new game"
HorizontalAlignment="Center"
Foreground="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}"
Margin="0,0,0,5" />
<Expander x:Name="ManualGameExpander" ExpandDirection="Down" IsExpanded="False">
<Grid MaxWidth="{Binding ActualWidth, ElementName=Hello}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@ -137,5 +141,8 @@
HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="Cancel" />
</Grid>
</Border>
<controls:DropOverlay Grid.RowSpan="99"
Grid.ColumnSpan="99"
Panel.ZIndex="1000" />
</Grid>
</adonisControls:AdonisWindow>

View File

@ -1,10 +1,6 @@
using System;
using System.IO;
using System.Linq;
using FModel.ViewModels;
using Ookii.Dialogs.Wpf;
using System.Windows;
using CUE4Parse.Utils;
namespace FModel.Views;
@ -43,28 +39,7 @@ public partial class DirectorySelector
if (folderBrowser.ShowDialog() == true)
{
HelloGameMyNameIsDirectory.Text = folderBrowser.SelectedPath;
// install_folder/
// ├─ Engine/
// ├─ GameName/
// │ ├─ Binaries/
// │ ├─ Content/
// │ │ ├─ Paks/
// our goal is to get the GameName folder
var currentFolder = folderBrowser.SelectedPath.SubstringAfterLast('\\');
if (currentFolder.Equals("Paks", StringComparison.InvariantCulture))
{
var dir = new DirectoryInfo(folderBrowser.SelectedPath);
if (dir.Parent is { Parent: not null } &&
dir.Parent.Name.Equals("Content", StringComparison.InvariantCulture) &&
dir.Parent.Parent.GetDirectories().Any(x => x.Name == "Binaries"))
{
HelloMyNameIsGame.Text = dir.Parent.Parent.Name;
return;
}
}
HelloMyNameIsGame.Text = folderBrowser.SelectedPath.SubstringAfterLast('\\');
HelloMyNameIsGame.Text = Helper.GetGameName(folderBrowser.SelectedPath);
}
}
@ -87,4 +62,11 @@ public partial class DirectorySelector
gameLauncherViewModel.DeleteSelectedGame();
}
public void AddManualGame(string directory)
{
ManualGameExpander.IsExpanded = true;
HelloMyNameIsGame.Text = Helper.GetGameName(directory);
HelloGameMyNameIsDirectory.Text = directory;
}
}

View File

@ -39,7 +39,7 @@
<SolidColorBrush x:Key="FoliageBrush" Color="ForestGreen" />
<SolidColorBrush x:Key="ParticleBrush" Color="Gold" />
<SolidColorBrush x:Key="AnimationBrush" Color="Coral" />
<SolidColorBrush x:Key="LuaBrush" Color="DarkBlue" />
<SolidColorBrush x:Key="LuaBrush" Color="Blue" />
<SolidColorBrush x:Key="JsonXmlBrush" Color="LightGreen" />
<SolidColorBrush x:Key="CodeBrush" Color="SandyBrown" />
<SolidColorBrush x:Key="HtmlBrush" Color="Tomato" />
@ -51,4 +51,7 @@
<!-- For specific games -->
<SolidColorBrush x:Key="BorderlandsBrush" Color="Yellow"></SolidColorBrush>
<SolidColorBrush x:Key="AionBrush" Color="DeepSkyBlue"></SolidColorBrush>
<SolidColorBrush x:Key="RocoKingdomWorldBrush" Color="#fecf4d"></SolidColorBrush>
<SolidColorBrush x:Key="DeltaForceBrush" Color="LightGreen"></SolidColorBrush>
</ResourceDictionary>

View File

@ -110,8 +110,7 @@
</MenuItem.Style>
</MenuItem>
<Separator />
<MenuItem Command="{Binding RightClickMenuCommand}"
Visibility="{Binding CanExportRawData, Source={x:Static settings:UserSettings.Default}, Converter={StaticResource BoolToVisibilityConverter}}">
<MenuItem Command="{Binding RightClickMenuCommand}">
<MenuItem.Header>
<TextBlock
Text="{Binding PlacementTarget.SelectedItem.Asset.Extension,
@ -121,7 +120,7 @@
</MenuItem.Header>
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Assets_Export_Data" />
<Binding Source="Save_Data" />
<Binding Path="PlacementTarget.SelectedItems" RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
</MultiBinding>
</MenuItem.CommandParameter>
@ -136,7 +135,7 @@
<MenuItem Header="Save Properties (.json)" Command="{Binding RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Assets_Save_Properties" />
<Binding Source="Save_Properties" />
<Binding Path="PlacementTarget.SelectedItems" RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
</MultiBinding>
</MenuItem.CommandParameter>
@ -151,7 +150,7 @@
<MenuItem Header="Save Texture" Command="{Binding RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Assets_Save_Textures" />
<Binding Source="Save_Textures" />
<Binding Path="PlacementTarget.SelectedItems" RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
</MultiBinding>
</MenuItem.CommandParameter>
@ -177,7 +176,7 @@
<MenuItem Header="Save Model" Command="{Binding RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Assets_Save_Models" />
<Binding Source="Save_Models" />
<Binding Path="PlacementTarget.SelectedItems" RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
</MultiBinding>
</MenuItem.CommandParameter>
@ -203,7 +202,7 @@
<MenuItem Header="Save Animation" Command="{Binding RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Assets_Save_Animations" />
<Binding Source="Save_Animations" />
<Binding Path="PlacementTarget.SelectedItems" RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
</MultiBinding>
</MenuItem.CommandParameter>
@ -229,7 +228,7 @@
<MenuItem Header="Save Audio" Command="{Binding RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Assets_Save_Audio" />
<Binding Source="Save_Audio" />
<Binding Path="PlacementTarget.SelectedItems" RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
</MultiBinding>
</MenuItem.CommandParameter>

View File

@ -1,17 +1,15 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:adonisUi="clr-namespace:AdonisUI;assembly=AdonisUI"
xmlns:settings="clr-namespace:FModel.Settings"
xmlns:converters="clr-namespace:FModel.Views.Resources.Converters"
x:Class="FModel.Views.Resources.Controls.ContextMenus.FolderContextMenuDictionary">
<ContextMenu x:Key="FolderContextMenu" x:Shared="False"
Opened="FolderContextMenu_OnOpened">
<MenuItem Header="Export Folder's Packages Raw Data (.uasset)"
Command="{Binding RightClickMenuCommand}"
Visibility="{Binding CanExportRawData, Source={x:Static settings:UserSettings.Default}, Converter={StaticResource BoolToVisibilityConverter}}">
Command="{Binding RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Folders_Export_Data" />
<Binding Source="Save_Data" />
<Binding Path="Tag"
RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
</MultiBinding>
@ -31,7 +29,7 @@
Command="{Binding RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Folders_Save_Properties" />
<Binding Source="Save_Properties" />
<Binding Path="Tag"
RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
</MultiBinding>
@ -51,7 +49,7 @@
Command="{Binding RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Folders_Save_Textures" />
<Binding Source="Save_Textures" />
<Binding Path="Tag"
RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
</MultiBinding>
@ -67,11 +65,31 @@
</Viewbox>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Save Folder's Decompiled Blueprints"
Command="{Binding RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Save_Code" />
<Binding Path="Tag"
RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
</MultiBinding>
</MenuItem.CommandParameter>
<MenuItem.Icon>
<Viewbox Width="16"
Height="16">
<Canvas Width="24"
Height="24">
<Path Fill="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}"
Data="{StaticResource CodeIcon}" />
</Canvas>
</Viewbox>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Save Folder's Packages Models"
Command="{Binding RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Folders_Save_Models" />
<Binding Source="Save_Models" />
<Binding Path="Tag"
RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
</MultiBinding>
@ -91,7 +109,7 @@
Command="{Binding RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Folders_Save_Animations" />
<Binding Source="Save_Animations" />
<Binding Path="Tag"
RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
</MultiBinding>
@ -111,7 +129,7 @@
Command="{Binding RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Folders_Save_Audio" />
<Binding Source="Save_Audio" />
<Binding Path="Tag"
RelativeSource="{RelativeSource AncestorType=ContextMenu}" />
</MultiBinding>

View File

@ -0,0 +1,58 @@
<UserControl x:Class="FModel.Views.Resources.Controls.DropOverlay"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FModel.Views.Resources.Controls"
xmlns:adonisUi="clr-namespace:AdonisUI;assembly=AdonisUI"
Visibility="Collapsed"
Background="Transparent"
mc:Ignorable="d"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
d:DesignHeight="450"
d:DesignWidth="800">
<Grid Background="#DD000000"
IsHitTestVisible="False"
Grid.Row="0"
Grid.RowSpan="99">
<Border BorderThickness="2"
CornerRadius="10"
Margin="60"
Background="#1FFFFFFF">
<Border.BorderBrush>
<VisualBrush>
<VisualBrush.Visual>
<Rectangle Stroke="{DynamicResource {x:Static adonisUi:Brushes.AccentBrush}}"
StrokeThickness="2"
StrokeDashArray="4 2"
StrokeDashCap="Round"
Width="{Binding RelativeSource={RelativeSource AncestorType=Border}, Path=ActualWidth}"
Height="{Binding RelativeSource={RelativeSource AncestorType=Border}, Path=ActualHeight}"
RadiusX="10"
RadiusY="10" />
</VisualBrush.Visual>
</VisualBrush>
</Border.BorderBrush>
<StackPanel VerticalAlignment="Center">
<Viewbox Width="80"
Height="80"
Margin="0,0,0,24"
HorizontalAlignment="Center">
<Path Fill="{DynamicResource {x:Static adonisUi:Brushes.AccentForegroundBrush}}"
Data="{StaticResource ImportIcon}" />
</Viewbox>
<TextBlock x:Name="TitleText" Text="Drop .usmap to import"
Foreground="White"
FontSize="24"
FontWeight="Bold"
HorizontalAlignment="Center" />
<TextBlock x:Name="DescriptionText" Text="Mapping file will be applied immediately"
Foreground="LightGray"
FontSize="14"
HorizontalAlignment="Center"
Margin="0,10,0,0" />
</StackPanel>
</Border>
</Grid>
</UserControl>

View File

@ -0,0 +1,169 @@
using System;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Threading;
using FModel.Services;
using FModel.Settings;
using FModel.ViewModels;
namespace FModel.Views.Resources.Controls;
public partial class DropOverlay : UserControl
{
enum DragStatus
{
None,
File,
Folder,
}
private ApplicationViewModel _applicationView => ApplicationService.ApplicationView;
private DragStatus _dragStatus = DragStatus.None;
private string _path = null;
public DropOverlay()
{
InitializeComponent();
Loaded += OnLoaded;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void ResetState()
{
_dragStatus = DragStatus.None;
_path = null;
}
private void OnLoaded(object sender, RoutedEventArgs e)
{
var window = Window.GetWindow(this);
if (window is null)
return;
window.PreviewDragEnter += OnPreviewDragEnter;
window.PreviewDragOver += OnPreviewDragOver;
window.PreviewDragLeave += OnPreviewDragLeave;
window.Drop += OnDrop;
}
private void OnPreviewDragEnter(object sender, DragEventArgs e)
{
GetValidTarget(sender, e);
if (_dragStatus is DragStatus.None)
{
e.Effects = DragDropEffects.None;
}
else
{
Visibility = Visibility.Visible;
e.Effects = DragDropEffects.Copy;
if (_dragStatus is DragStatus.Folder)
{
TitleText.Text = "Drop folder to add new game";
DescriptionText.Text = "Folder will be added to the directory selector";
}
else if (_dragStatus is DragStatus.File)
{
TitleText.Text = "Drop .usmap to import";
DescriptionText.Text = "Mapping file will be applied immediately";
}
}
e.Handled = true;
}
private void OnPreviewDragOver(object sender, DragEventArgs e)
{
e.Effects = _dragStatus is DragStatus.None ? DragDropEffects.None : DragDropEffects.Copy;
e.Handled = true;
}
private void OnPreviewDragLeave(object sender, DragEventArgs e)
{
Visibility = Visibility.Collapsed;
ResetState();
}
private async void OnDrop(object sender, DragEventArgs e)
{
Visibility = Visibility.Collapsed;
e.Handled = true;
switch (_dragStatus)
{
case DragStatus.Folder:
await Dispatcher.InvokeAsync(() => _applicationView.AddGameDirectory(_path));
break;
case DragStatus.File:
UserSettings.IsEndpointValid(EEndpointType.Mapping, out var oldMappingsEndpoint);
try
{
var newMappingsEndpoint = new EndpointSettings() { Overwrite = true, FilePath = _path };
UserSettings.Default.CurrentDir.Endpoints[(int) EEndpointType.Mapping] = newMappingsEndpoint;
await _applicationView.CUE4Parse.InitMappings();
_applicationView.SettingsView.MappingEndpoint = newMappingsEndpoint;
}
catch (Exception ex)
{
UserSettings.Default.CurrentDir.Endpoints[(int) EEndpointType.Mapping] = oldMappingsEndpoint;
FLogger.Append(ELog.Error, () =>
{
FLogger.Text($"Failed to load mapping file: {ex.Message}", Constants.WHITE, true);
});
}
break;
default:
break;
}
ResetState();
}
private void GetValidTarget(object sender, DragEventArgs e)
{
if (!_applicationView.Status.IsReady || !e.Data.GetDataPresent(DataFormats.FileDrop) || e.Data.GetData(DataFormats.FileDrop) is not string[] files)
return;
bool directorySelectorIsVisible = _applicationView.Status.Kind is EStatusKind.Configuring;
if (!directorySelectorIsVisible && (Helper.IsWindowOpen<DictionaryEditor>() || Helper.IsWindowOpen<EndpointEditor>()))
{
_applicationView.Status.SetStatus(EStatusKind.Configuring);
ResetState();
return;
}
switch (sender)
{
case MainWindow or SettingsView when !directorySelectorIsVisible:
foreach (var path in files)
{
if (Directory.Exists(path))
{
_path = path;
_dragStatus = DragStatus.Folder;
return;
}
else if (File.Exists(path) && Path.GetExtension(path).Equals(".usmap", StringComparison.OrdinalIgnoreCase))
{
_path = path;
_dragStatus = DragStatus.File;
return;
}
}
break;
case DirectorySelector:
if (files.FirstOrDefault(f => Directory.Exists(f)) is { } folder)
{
_path = folder;
_dragStatus = DragStatus.Folder;
return;
}
break;
default:
break;
}
ResetState();
}
}

View File

@ -1,6 +1,7 @@
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using FModel.Extensions;
using FModel.Services;
using FModel.Settings;
@ -23,8 +24,9 @@ public partial class EndpointEditor
InitializeComponent();
Title = title;
TargetResponse.SyntaxHighlighting =
EndpointResponse.SyntaxHighlighting = AvalonExtensions.HighlighterSelector("json");
TargetResponse.SyntaxHighlighting = EndpointResponse.SyntaxHighlighting = AvalonExtensions.HighlighterSelector("json");
TargetResponse.TextArea.TextView.LinkTextForegroundBrush = Brushes.DodgerBlue;
EndpointResponse.TextArea.TextView.LinkTextForegroundBrush = Brushes.DodgerBlue;
InstructionBox.Text = type switch
{
@ -91,7 +93,7 @@ public partial class EndpointEditor
private void OnEvaluator(object sender, RoutedEventArgs e)
{
Process.Start(new ProcessStartInfo { FileName = "https://jsonpath.herokuapp.com/", UseShellExecute = true });
Process.Start(new ProcessStartInfo { FileName = "https://jsonpath.com/", UseShellExecute = true });
}
}

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
@ -126,13 +126,40 @@ public class FLogger : ITextFormatter
{
NavigateUri = new Uri(url),
OverridesDefaultStyle = true,
Style = new Style(typeof(Hyperlink)) { Setters =
Style = new Style(typeof(Hyperlink))
{
new Setter(FrameworkContentElement.CursorProperty, Cursors.Hand),
new Setter(TextBlock.TextDecorationsProperty, TextDecorations.Underline),
new Setter(TextElement.ForegroundProperty, Brushes.Cornsilk)
}}
}.Click += (sender, _) => Process.Start("explorer.exe", $"/select, \"{((Hyperlink)sender).NavigateUri.AbsoluteUri}\"");
Setters =
{
new Setter(FrameworkContentElement.CursorProperty, Cursors.Hand),
new Setter(TextElement.ForegroundProperty, Brushes.Goldenrod),
new Setter(TextElement.FontWeightProperty, FontWeights.Bold)
},
Triggers =
{
new Trigger
{
Property = UIElement.IsMouseOverProperty,
Value = true,
Setters =
{
new Setter(TextElement.ForegroundProperty, Brushes.Gold),
new Setter(TextBlock.TextDecorationsProperty, TextDecorations.Underline)
}
}
}
}
}.Click += (sender, _) =>
{
var uri = ((Hyperlink) sender).NavigateUri;
if (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)
{
Process.Start(new ProcessStartInfo(uri.AbsoluteUri) { UseShellExecute = true });
}
else
{
Process.Start("explorer.exe", $"/select, \"{uri.AbsoluteUri}\"");
}
};
}
finally
{

View File

@ -0,0 +1,18 @@
using System;
using System.Globalization;
using System.IO;
using System.Windows.Data;
namespace FModel.Views.Resources.Converters
{
public class FileNameWithoutExtensionConverter : IValueConverter
{
public static readonly FileNameWithoutExtensionConverter Instance = new();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
=> value is string s ? Path.GetFileNameWithoutExtension(s) : value;
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
=> throw new NotImplementedException();
}
}

View File

@ -90,6 +90,9 @@ public class FileToGeometryConverter : IMultiValueConverter
EAssetCategory.ByteCode => ("CodeIcon", "CodeBrush"),
EAssetCategory.Borderlands => ("BorderlandsIcon", "BorderlandsBrush"),
EAssetCategory.Aion2 => ("AionIcon", "AionBrush"),
EAssetCategory.RocoKingdomWorld => ("RocoKingdomWorldIcon", "RocoKingdomWorldBrush"),
EAssetCategory.DeltaForce => ("DeltaForceIcon", "DeltaForceBrush"),
_ => ("AssetIcon", "NeutralBrush")
};

View File

@ -1,7 +1,6 @@
using System;
using System.Globalization;
using System.Windows.Data;
using FModel.Extensions;
namespace FModel.Views.Resources.Converters;

View File

@ -0,0 +1,23 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace FModel.Views.Resources.Converters;
public class TextToRefreshConverter : IValueConverter
{
public static readonly TextToRefreshConverter Instance = new();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is DateTime dt && dt != DateTime.MaxValue)
return $"Next Refresh: {dt:MMM d, yyyy}";
return "Next Refresh: Never";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

File diff suppressed because one or more lines are too long

View File

@ -771,9 +771,15 @@
</Image.ContextMenu>
</Image>
</Border>
<TextBlock Grid.Column="2" VerticalAlignment="Bottom" HorizontalAlignment="Center"
Visibility="{Binding SelectedItem.HasMultipleImages, ElementName=TabControlName, Converter={StaticResource BoolToVisibilityConverter}}"
Text="{Binding SelectedItem.Page, ElementName=TabControlName}" />
<StackPanel Grid.Column="2" VerticalAlignment="Bottom" HorizontalAlignment="Center">
<TextBlock HorizontalAlignment="Center"
Text="{Binding SelectedItem.SelectedImage.ExportName, Converter={x:Static converters:FileNameWithoutExtensionConverter.Instance}, ElementName=TabControlName}"
FontSize="10" FontWeight="SemiBold"
Visibility="{Binding SelectedItem.HasImage, ElementName=TabControlName, Converter={StaticResource BoolToVisibilityConverter}}" />
<TextBlock HorizontalAlignment="Center"
Visibility="{Binding SelectedItem.HasMultipleImages, ElementName=TabControlName, Converter={StaticResource BoolToVisibilityConverter}}"
Text="{Binding SelectedItem.Page, ElementName=TabControlName}" />
</StackPanel>
</Grid>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding SelectedItem.HasImage, ElementName=TabControlName}" Value="False">
@ -926,8 +932,7 @@
</MenuItem.IsEnabled>
</MenuItem>
<Separator />
<MenuItem Command="{Binding TabCommand}" CommandParameter="Asset_Export_Data"
Visibility="{Binding CanExportRawData, Source={x:Static settings:UserSettings.Default}, Converter={StaticResource BoolToVisibilityConverter}}">
<MenuItem Command="{Binding TabCommand}" CommandParameter="Save_Data">
<MenuItem.Header>
<TextBlock Text="{Binding Entry.Extension, FallbackValue='Export Raw Data', StringFormat='Export Raw Data (.{0})'}" />
</MenuItem.Header>
@ -939,7 +944,7 @@
</Viewbox>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Save Properties (.json)" Command="{Binding TabCommand}" CommandParameter="Asset_Save_Properties">
<MenuItem Header="Save Properties (.json)" Command="{Binding TabCommand}" CommandParameter="Save_Properties">
<MenuItem.Icon>
<Viewbox Width="16" Height="16">
<Canvas Width="24" Height="24">
@ -948,7 +953,7 @@
</Viewbox>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Save Texture" Command="{Binding TabCommand}" CommandParameter="Asset_Save_Textures">
<MenuItem Header="Save Texture" Command="{Binding TabCommand}" CommandParameter="Save_Textures">
<MenuItem.Icon>
<Viewbox Width="16" Height="16">
<Canvas Width="24" Height="24">
@ -957,7 +962,7 @@
</Viewbox>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Save Model" Command="{Binding TabCommand}" CommandParameter="Asset_Save_Models">
<MenuItem Header="Save Model" Command="{Binding TabCommand}" CommandParameter="Save_Models">
<MenuItem.Icon>
<Viewbox Width="16" Height="16">
<Canvas Width="24" Height="24">
@ -966,7 +971,7 @@
</Viewbox>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Save Animation" Command="{Binding TabCommand}" CommandParameter="Asset_Save_Animations">
<MenuItem Header="Save Animation" Command="{Binding TabCommand}" CommandParameter="Save_Animations">
<MenuItem.Icon>
<Viewbox Width="16" Height="16">
<Canvas Width="24" Height="24">
@ -975,7 +980,7 @@
</Viewbox>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Save Audio" Command="{Binding TabCommand}" CommandParameter="Asset_Save_Audio">
<MenuItem Header="Save Audio" Command="{Binding TabCommand}" CommandParameter="Save_Audio">
<MenuItem.Icon>
<Viewbox Width="16" Height="16">
<Canvas Width="24" Height="24">

View File

@ -1,7 +1,6 @@
<adonisControls:AdonisWindow x:Class="FModel.Views.SearchView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:settings="clr-namespace:FModel.Settings"
xmlns:converters="clr-namespace:FModel.Views.Resources.Converters"
xmlns:adonisUi="clr-namespace:AdonisUI;assembly=AdonisUI"
xmlns:adonisControls="clr-namespace:AdonisUI.Controls;assembly=AdonisUI"
@ -210,15 +209,14 @@
</MenuItem.IsEnabled>
</MenuItem>
<Separator />
<MenuItem Command="{Binding DataContext.mainApplication.RightClickMenuCommand}"
Visibility="{Binding CanExportRawData, Source={x:Static settings:UserSettings.Default}, Converter={StaticResource BoolToVisibilityConverter}}">
<MenuItem Command="{Binding DataContext.mainApplication.RightClickMenuCommand}">
<MenuItem.Header>
<TextBlock Text="{Binding DataContext.SelectedItem.Extension, FallbackValue='Export Raw Data',
StringFormat='Export Raw Data (.{0})', RelativeSource={RelativeSource AncestorType=ContextMenu}}" />
</MenuItem.Header>
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Assets_Export_Data" />
<Binding Source="Save_Data" />
<Binding Path="SelectedItems" />
</MultiBinding>
</MenuItem.CommandParameter>
@ -233,7 +231,7 @@
<MenuItem Header="Save Properties (.json)" Command="{Binding DataContext.mainApplication.RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Assets_Save_Properties" />
<Binding Source="Save_Properties" />
<Binding Path="SelectedItems" />
</MultiBinding>
</MenuItem.CommandParameter>
@ -248,7 +246,7 @@
<MenuItem Header="Save Texture" Command="{Binding DataContext.mainApplication.RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Assets_Save_Textures" />
<Binding Source="Save_Textures" />
<Binding Path="SelectedItems" />
</MultiBinding>
</MenuItem.CommandParameter>
@ -263,7 +261,7 @@
<MenuItem Header="Save Model" Command="{Binding DataContext.mainApplication.RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Assets_Save_Models" />
<Binding Source="Save_Models" />
<Binding Path="SelectedItems" />
</MultiBinding>
</MenuItem.CommandParameter>
@ -278,7 +276,7 @@
<MenuItem Header="Save Animation" Command="{Binding DataContext.mainApplication.RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Assets_Save_Animations" />
<Binding Source="Save_Animations" />
<Binding Path="SelectedItems" />
</MultiBinding>
</MenuItem.CommandParameter>
@ -293,7 +291,7 @@
<MenuItem Header="Save Audio" Command="{Binding DataContext.mainApplication.RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Assets_Save_Audio" />
<Binding Source="Save_Audio" />
<Binding Path="SelectedItems" />
</MultiBinding>
</MenuItem.CommandParameter>
@ -556,15 +554,14 @@
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Command="{Binding DataContext.mainApplication.RightClickMenuCommand}"
Visibility="{Binding CanExportRawData, Source={x:Static settings:UserSettings.Default}, Converter={StaticResource BoolToVisibilityConverter}}">
<MenuItem Command="{Binding DataContext.mainApplication.RightClickMenuCommand}">
<MenuItem.Header>
<TextBlock Text="{Binding DataContext.SelectedItem.Extension, FallbackValue='Export Raw Data',
StringFormat='Export Raw Data (.{0})', RelativeSource={RelativeSource AncestorType=ContextMenu}}" />
</MenuItem.Header>
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Assets_Export_Data" />
<Binding Source="Save_Data" />
<Binding Path="SelectedItems" />
</MultiBinding>
</MenuItem.CommandParameter>
@ -579,7 +576,7 @@
<MenuItem Header="Save Properties (.json)" Command="{Binding DataContext.mainApplication.RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Assets_Save_Properties" />
<Binding Source="Save_Properties" />
<Binding Path="SelectedItems" />
</MultiBinding>
</MenuItem.CommandParameter>
@ -594,7 +591,7 @@
<MenuItem Header="Save Texture" Command="{Binding DataContext.mainApplication.RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Assets_Save_Textures" />
<Binding Source="Save_Textures" />
<Binding Path="SelectedItems" />
</MultiBinding>
</MenuItem.CommandParameter>
@ -609,7 +606,7 @@
<MenuItem Header="Save Model" Command="{Binding DataContext.mainApplication.RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Assets_Save_Models" />
<Binding Source="Save_Models" />
<Binding Path="SelectedItems" />
</MultiBinding>
</MenuItem.CommandParameter>
@ -624,7 +621,7 @@
<MenuItem Header="Save Animation" Command="{Binding DataContext.mainApplication.RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Assets_Save_Animations" />
<Binding Source="Save_Animations" />
<Binding Path="SelectedItems" />
</MultiBinding>
</MenuItem.CommandParameter>
@ -639,7 +636,7 @@
<MenuItem Header="Save Audio" Command="{Binding DataContext.mainApplication.RightClickMenuCommand}">
<MenuItem.CommandParameter>
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
<Binding Source="Assets_Save_Audio" />
<Binding Source="Save_Audio" />
<Binding Path="SelectedItems" />
</MultiBinding>
</MenuItem.CommandParameter>

View File

@ -10,7 +10,8 @@
xmlns:adonisExtensions="clr-namespace:AdonisUI.Extensions;assembly=AdonisUI"
WindowStartupLocation="CenterScreen" ResizeMode="NoResize" IconVisibility="Collapsed" SizeToContent="Height"
MinHeight="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenHeight}, Converter={converters:RatioConverter}, ConverterParameter='0.10'}"
Width="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenWidth}, Converter={converters:RatioConverter}, ConverterParameter='0.45'}">
Width="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenWidth}, Converter={converters:RatioConverter}, ConverterParameter='0.45'}"
AllowDrop="True">
<adonisControls:AdonisWindow.Style>
<Style TargetType="adonisControls:AdonisWindow" BasedOn="{StaticResource {x:Type adonisControls:AdonisWindow}}" >
<Setter Property="Title" Value="Settings" />
@ -43,8 +44,6 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
@ -162,7 +161,7 @@
IsChecked="{Binding KeepDirectoryStructure, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}" Margin="0 5 0 10"
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" />
<TextBlock Grid.Row="10" Grid.Column="0" Text="Local Mapping File" VerticalAlignment="Center" Margin="0 5 0 0" />
<TextBlock Grid.Row="10" Grid.Column="0" Text="Local Mapping File (drag &amp; drop)" VerticalAlignment="Center" Margin="0 5 0 0" />
<CheckBox Grid.Row="10" Grid.Column="2" Margin="0 5 0 0"
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}"
Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
@ -223,51 +222,41 @@
<Button Grid.Column="2" Content="Mapping" Click="OpenMappingEndpoint" />
</Grid>
<TextBlock Grid.Row="16" Grid.Column="0" Text="Allow Raw Data Export (.uasset)" VerticalAlignment="Center" Margin="0 0 0 5" />
<TextBlock Grid.Row="16" Grid.Column="0" Text="Serialize Script Bytecode" VerticalAlignment="Center" Margin="0 0 0 5" />
<CheckBox Grid.Row="16" Grid.Column="2" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
IsChecked="{Binding CanExportRawData, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}" Margin="0 5 0 10"
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" />
<TextBlock Grid.Row="17" Grid.Column="0" Text="Serialize Script Bytecode" VerticalAlignment="Center" Margin="0 0 0 5" />
<CheckBox Grid.Row="17" Grid.Column="2" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
IsChecked="{Binding ReadScriptData, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}" Margin="0 5 0 10"
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" />
<TextBlock Grid.Row="18" Grid.Column="0" Text="Serialize Inlined Shader Maps" VerticalAlignment="Center" Margin="0 0 0 5" />
<CheckBox Grid.Row="18" Grid.Column="2" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
<TextBlock Grid.Row="17" Grid.Column="0" Text="Serialize Inlined Shader Maps" VerticalAlignment="Center" Margin="0 0 0 5" />
<CheckBox Grid.Row="17" Grid.Column="2" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
IsChecked="{Binding ReadShaderMaps, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}" Margin="0 5 0 10"
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" />
<TextBlock Grid.Row="19" Grid.Column="0" Text="Decompile Blueprint to Pseudo C++" VerticalAlignment="Center" Margin="0 0 0 5" ToolTip="Adds a right click option to decompile UClass packages into a pseudo C++ friendly format" />
<CheckBox Grid.Row="19" Grid.Column="2" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
<TextBlock Grid.Row="18" Grid.Column="0" Text="Decompile Blueprint to Pseudo C++" VerticalAlignment="Center" Margin="0 0 0 5" ToolTip="Adds a right click option to decompile UClass packages into a pseudo C++ friendly format" />
<CheckBox Grid.Row="18" Grid.Column="2" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
IsChecked="{Binding ShowDecompileOption, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}" Margin="0 5 0 10"
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" />
<TextBlock Grid.Row="20"
<TextBlock Grid.Row="19"
Grid.Column="0"
Text="Convert Audio During Export (.wav)"
VerticalAlignment="Center"
Margin="0 0 0 5" />
<CheckBox Grid.Row="20"
<CheckBox Grid.Row="19"
Grid.Column="2"
Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
IsChecked="{Binding ConvertAudioOnBulkExport, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"
Margin="0 5 0 10"
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" />
<TextBlock Grid.Row="21" Grid.Column="0" Text="Max Wwise Bank (.BNK) Prefetch" VerticalAlignment="Center" Margin="0 0 0 5" />
<Slider Grid.Row="21" Grid.Column="2" Grid.ColumnSpan="5" TickPlacement="None" Minimum="0" Maximum="2048" Ticks="0,8,32,128,256,512,1024,2048"
AutoToolTipPlacement="BottomRight" IsMoveToPointEnabled="True" IsSnapToTickEnabled="True" Margin="0 5 0 5"
Value="{Binding WwiseMaxBnkPrefetch, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"/>
<TextBlock Grid.Row="22"
<TextBlock Grid.Row="20"
Grid.Column="0"
Text="CRIWARE Decryption Key"
VerticalAlignment="Center"
Margin="0 0 0 10" />
<TextBox x:Name="CriwareKeyBox"
Grid.Row="22"
Grid.Row="20"
Grid.Column="2"
Grid.ColumnSpan="5"
Margin="0 5 0 10"
@ -398,6 +387,8 @@
<ContentControl.Style>
<Style TargetType="{x:Type ContentControl}">
<Setter Property="Visibility" Value="Collapsed" />
<EventSetter Event="Hyperlink.Click" Handler="OnHyperlinkClick" />
<Style.Triggers>
<DataTrigger Binding="{Binding DataContext.SettingsView.SelectedMeshExportFormat, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}" Value="{x:Static c4pMeshes:EMeshFormat.UEFormat}">
<Setter Property="ContentTemplate">
@ -704,12 +695,15 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="* Require a restart for changes to take effect"
<TextBlock Grid.Column="0" Text="* May Require a restart for changes to take effect"
HorizontalAlignment="Right" VerticalAlignment="Center" FontSize="11" Margin="0 0 10 0"
Foreground="{DynamicResource {x:Static adonisUi:Brushes.Layer1InteractionForegroundBrush}}" />
<Button Grid.Column="1" MinWidth="78" Margin="0 0 12 0" IsDefault="True" IsCancel="False"
HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="OK" Click="OnClick" />
</Grid>
</Border>
<controls:DropOverlay Grid.RowSpan="99"
Grid.ColumnSpan="99"
Panel.ZIndex="1000" />
</Grid>
</adonisControls:AdonisWindow>

View File

@ -1,9 +1,11 @@
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using FModel.Services;
using FModel.Settings;
using FModel.ViewModels;
@ -59,6 +61,8 @@ public partial class SettingsView
_applicationView.CUE4Parse.Provider.ReadScriptData = UserSettings.Default.ReadScriptData;
_applicationView.CUE4Parse.Provider.ReadShaderMaps = UserSettings.Default.ReadShaderMaps;
UserSettings.Save();
}
private void OnBrowseOutput(object sender, RoutedEventArgs e)
@ -72,6 +76,7 @@ public partial class SettingsView
UserSettings.Default.PropertiesDirectory = path;
UserSettings.Default.TextureDirectory = path;
UserSettings.Default.AudioDirectory = path;
UserSettings.Default.CodeDirectory = path;
}
private void OnBrowseDirectories(object sender, RoutedEventArgs e)
@ -153,7 +158,11 @@ public partial class SettingsView
private void OpenCustomVersions(object sender, RoutedEventArgs e)
{
var editor = new DictionaryEditor(_applicationView.SettingsView.SelectedCustomVersions, "Versioning Configuration (Custom Versions)");
if (_applicationView.Status.IsReady)
_applicationView.Status.SetStatus(EStatusKind.Configuring);
var result = editor.ShowDialog();
if (_applicationView.Status.IsReady)
_applicationView.Status.SetStatus(EStatusKind.Ready);
if (!result.HasValue || !result.Value)
return;
@ -163,7 +172,11 @@ public partial class SettingsView
private void OpenOptions(object sender, RoutedEventArgs e)
{
var editor = new DictionaryEditor(_applicationView.SettingsView.SelectedOptions, "Versioning Configuration (Options)");
if (_applicationView.Status.IsReady)
_applicationView.Status.SetStatus(EStatusKind.Configuring);
var result = editor.ShowDialog();
if (_applicationView.Status.IsReady)
_applicationView.Status.SetStatus(EStatusKind.Ready);
if (!result.HasValue || !result.Value)
return;
@ -173,7 +186,11 @@ public partial class SettingsView
private void OpenMapStructTypes(object sender, RoutedEventArgs e)
{
var editor = new DictionaryEditor(_applicationView.SettingsView.SelectedMapStructTypes, "Versioning Configuration (MapStructTypes)");
if (_applicationView.Status.IsReady)
_applicationView.Status.SetStatus(EStatusKind.Configuring);
var result = editor.ShowDialog();
if (_applicationView.Status.IsReady)
_applicationView.Status.SetStatus(EStatusKind.Ready);
if (!result.HasValue || !result.Value)
return;
@ -184,14 +201,22 @@ public partial class SettingsView
{
var editor = new EndpointEditor(
_applicationView.SettingsView.AesEndpoint, "Endpoint Configuration (AES)", EEndpointType.Aes);
if (_applicationView.Status.IsReady)
_applicationView.Status.SetStatus(EStatusKind.Configuring);
editor.ShowDialog();
if (_applicationView.Status.IsReady)
_applicationView.Status.SetStatus(EStatusKind.Ready);
}
private void OpenMappingEndpoint(object sender, RoutedEventArgs e)
{
var editor = new EndpointEditor(
_applicationView.SettingsView.MappingEndpoint, "Endpoint Configuration (Mapping)", EEndpointType.Mapping);
if (_applicationView.Status.IsReady)
_applicationView.Status.SetStatus(EStatusKind.Configuring);
editor.ShowDialog();
if (_applicationView.Status.IsReady)
_applicationView.Status.SetStatus(EStatusKind.Ready);
}
private void CriwareKeyBox_Loaded(object sender, RoutedEventArgs e)
@ -241,4 +266,12 @@ public partial class SettingsView
out value
);
}
private void OnHyperlinkClick(object sender, RoutedEventArgs e)
{
if (e.OriginalSource is not Hyperlink hyperlink)
return;
Process.Start(new ProcessStartInfo(hyperlink.NavigateUri.AbsoluteUri) { UseShellExecute = true });
}
}

View File

@ -93,7 +93,7 @@ public abstract class UModel : IRenderableModel
{
_export = export;
Path = _export.GetPathName();
Name = Path.SubstringAfterLast('/').SubstringBefore('.');
Name = export.Name;
Type = export.ExportType;
UvCount = 1;

View File

@ -63,7 +63,7 @@
</adonisControls:SplitButton.SplitMenu>
</adonisControls:SplitButton>
<TextBlock VerticalAlignment="Bottom" HorizontalAlignment="Right" FontSize="10" Margin="0 2.5 0 0"
Text="{Binding NextUpdateCheck, Source={x:Static local:Settings.UserSettings.Default}, StringFormat=Next Refresh: {0:MMM d, yyyy}}" />
Text="{Binding NextUpdateCheck, Source={x:Static local:Settings.UserSettings.Default}, Converter={x:Static converters:TextToRefreshConverter.Instance}}" />
</StackPanel>
</Grid>