This commit is contained in:
4sval
2023-05-23 00:54:56 +02:00
parent be061df238
commit fa25b362cc
4 changed files with 32 additions and 21 deletions

View File

@@ -608,7 +608,7 @@ public class CUE4ParseViewModel : ViewModel
{
foreach (var asset in assetItems)
{
Thread.Yield();
Thread.Sleep(10);
cancellationToken.ThrowIfCancellationRequested();
Extract(cancellationToken, asset.FullPath, TabControl.HasNoTabs);
}
@@ -618,7 +618,7 @@ public class CUE4ParseViewModel : ViewModel
{
foreach (var asset in folder.AssetsList.Assets)
{
Thread.Yield();
Thread.Sleep(10);
cancellationToken.ThrowIfCancellationRequested();
try
{

View File

@@ -111,7 +111,7 @@ public class MenuCommand : ViewModelCommand<ApplicationViewModel>
if (!expand && folder.IsExpanded)
{
folder.IsExpanded = false;
Thread.Yield();
Thread.Sleep(10);
cancellationToken.ThrowIfCancellationRequested();
}
@@ -129,7 +129,7 @@ public class MenuCommand : ViewModelCommand<ApplicationViewModel>
for (var node = nodes.Last; node != null; node = node.Previous)
{
node.Value.IsExpanded = true;
Thread.Yield();
Thread.Sleep(10);
cancellationToken.ThrowIfCancellationRequested();
}
}

View File

@@ -29,7 +29,7 @@ public class RightClickMenuCommand : ViewModelCommand<ApplicationViewModel>
case "Assets_Extract_New_Tab":
foreach (var asset in assetItems)
{
Thread.Yield();
Thread.Sleep(10);
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.Extract(cancellationToken, asset.FullPath, true);
}
@@ -37,7 +37,7 @@ public class RightClickMenuCommand : ViewModelCommand<ApplicationViewModel>
case "Assets_Export_Data":
foreach (var asset in assetItems)
{
Thread.Yield();
Thread.Sleep(10);
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.ExportData(asset.FullPath);
}
@@ -45,7 +45,7 @@ public class RightClickMenuCommand : ViewModelCommand<ApplicationViewModel>
case "Assets_Save_Properties":
foreach (var asset in assetItems)
{
Thread.Yield();
Thread.Sleep(10);
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.Extract(cancellationToken, asset.FullPath, false, EBulkType.Properties);
}
@@ -53,7 +53,7 @@ public class RightClickMenuCommand : ViewModelCommand<ApplicationViewModel>
case "Assets_Save_Textures":
foreach (var asset in assetItems)
{
Thread.Yield();
Thread.Sleep(10);
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.Extract(cancellationToken, asset.FullPath, false, EBulkType.Textures);
}
@@ -61,7 +61,7 @@ public class RightClickMenuCommand : ViewModelCommand<ApplicationViewModel>
case "Assets_Save_Models":
foreach (var asset in assetItems)
{
Thread.Yield();
Thread.Sleep(10);
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.Extract(cancellationToken, asset.FullPath, false, EBulkType.Meshes | EBulkType.Auto);
}
@@ -69,7 +69,7 @@ public class RightClickMenuCommand : ViewModelCommand<ApplicationViewModel>
case "Assets_Save_Animations":
foreach (var asset in assetItems)
{
Thread.Yield();
Thread.Sleep(10);
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.Extract(cancellationToken, asset.FullPath, false, EBulkType.Animations | EBulkType.Auto);
}

View File

@@ -139,12 +139,15 @@ public class GameSelectorViewModel : ViewModel
if (installationList.AppName.Equals(gameName, StringComparison.OrdinalIgnoreCase))
{
var pak = Directory.GetDirectories(installationList.InstallLocation, "Paks*", SearchOption.AllDirectories);
if (pak.Length > 0) return new DetectedGame { GameName = installationList.AppName, GameDirectory = pak[0] };
if (pak.Length > 0)
{
Log.Debug("Found {GameName} in LauncherInstalled.dat", gameName);
return new DetectedGame { GameName = installationList.AppName, GameDirectory = pak[0] };
}
}
}
}
Log.Warning("Could not find {GameName} in LauncherInstalled.dat", gameName);
return null;
}
@@ -157,11 +160,13 @@ public class GameSelectorViewModel : ViewModel
foreach (var (key, _) in _riotClientInstalls.AssociatedClient)
{
if (key.Contains(gameName, StringComparison.OrdinalIgnoreCase))
{
Log.Debug("Found {GameName} in RiotClientInstalls.json", gameName);
return new DetectedGame { GameName = gameName, GameDirectory = $"{key.Replace('/', '\\')}{pakDirectory}" };
}
}
}
Log.Warning("Could not find {GameName} in RiotClientInstalls.json", gameName);
return null;
}
@@ -170,9 +175,11 @@ public class GameSelectorViewModel : ViewModel
{
_launcherSettings ??= GetDataLauncherInstalls<LauncherSettings>("\\.minecraft\\launcher_settings.json");
if (_launcherSettings is { ProductLibraryDir: { } })
{
Log.Debug("Found {GameName} in launcher_settings.json", gameName);
return new DetectedGame { GameName = gameName, GameDirectory = $"{_launcherSettings.ProductLibraryDir}{pakDirectory}" };
}
Log.Warning("Could not find {GameName} in launcher_settings.json", gameName);
return null;
}
@@ -180,9 +187,11 @@ public class GameSelectorViewModel : ViewModel
{
var steamInfo = SteamDetection.GetSteamGameById(id);
if (steamInfo is not null)
{
Log.Debug("Found {GameName} in steam manifests", steamInfo.Name);
return new DetectedGame { GameName = steamInfo.Name, GameDirectory = $"{steamInfo.GameRoot}{pakDirectory}" };
}
Log.Warning("Could not find {GameId} in steam manifests", id);
return null;
}
@@ -199,9 +208,11 @@ public class GameSelectorViewModel : ViewModel
}
if (!string.IsNullOrEmpty(installLocation))
{
Log.Debug("Found {GameName} in the registry", key);
return new DetectedGame { GameName = key, GameDirectory = $"{installLocation}{pakDirectory}" };
}
Log.Warning("Could not find {GameName} in the registry", key);
return null;
}
@@ -221,9 +232,11 @@ public class GameSelectorViewModel : ViewModel
}
if (!string.IsNullOrEmpty(installLocation))
{
Log.Debug("Found {GameName} in the registry", key);
return new DetectedGame { GameName = displayName, GameDirectory = $"{installLocation}{pakDirectory}" };
}
Log.Warning("Could not find {GameName} in the registry", key);
return null;
}
@@ -234,11 +247,10 @@ public class GameSelectorViewModel : ViewModel
var launcher = $"{drive.Name}{jsonFile}";
if (!File.Exists(launcher)) continue;
Log.Information("\"{Launcher}\" found in drive \"{DriveName}\"", launcher, drive.Name);
Log.Debug("\"{Launcher}\" found in drive \"{DriveName}\"", launcher, drive.Name);
return JsonConvert.DeserializeObject<T>(File.ReadAllText(launcher));
}
Log.Warning("\"{JsonFile}\" not found in any drives", jsonFile);
return default;
}
@@ -248,11 +260,10 @@ public class GameSelectorViewModel : ViewModel
var launcher = $"{appData}{jsonFile}";
if (File.Exists(launcher))
{
Log.Information("\"{Launcher}\" found in \"{AppData}\"", launcher, appData);
Log.Debug("\"{Launcher}\" found in \"{AppData}\"", launcher, appData);
return JsonConvert.DeserializeObject<T>(File.ReadAllText(launcher));
}
Log.Warning("\"{Json}\" not found anywhere", jsonFile);
return default;
}