mirror of
https://github.com/4sval/FModel.git
synced 2026-04-17 15:07:27 -05:00
little better game name detection ig
This commit is contained in:
parent
c6383a1d22
commit
ac835497da
|
|
@ -1,4 +1,7 @@
|
|||
using FModel.ViewModels;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using FModel.ViewModels;
|
||||
using Ookii.Dialogs.Wpf;
|
||||
using System.Windows;
|
||||
using CUE4Parse.Utils;
|
||||
|
|
@ -39,8 +42,29 @@ public partial class DirectorySelector
|
|||
var folderBrowser = new VistaFolderBrowserDialog {ShowNewFolderButton = false};
|
||||
if (folderBrowser.ShowDialog() == true)
|
||||
{
|
||||
HelloMyNameIsGame.Text = folderBrowser.SelectedPath.SubstringAfterLast('\\');
|
||||
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('\\');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user