mirror of
https://github.com/4sval/FModel.git
synced 2026-03-21 17:24:26 -05:00
that's the way
This commit is contained in:
parent
011046aa22
commit
25c10e8638
|
|
@ -1 +1 @@
|
|||
Subproject commit fb4e3d5f2fcae1b761dee4eed311a1b132ac5735
|
||||
Subproject commit 3d99ba8f8ee84d2052403858d5657f9015a5d2ab
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Directories" ItemsSource="{Binding CustomDirectories.Directories}" IsEnabled="{Binding Status.IsReady}">
|
||||
<MenuItem Header="Favorite Directories" ItemsSource="{Binding CustomDirectories.Directories}" IsEnabled="{Binding Status.IsReady}">
|
||||
<MenuItem.Icon>
|
||||
<Viewbox Width="16" Height="16">
|
||||
<Canvas Width="24" Height="24">
|
||||
|
|
@ -396,7 +396,7 @@
|
|||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Header="Save Directory" Click="OnSaveDirectoryClick">
|
||||
<MenuItem Header="Favorite Directory" Click="OnFavoriteDirectoryClick">
|
||||
<MenuItem.Icon>
|
||||
<Viewbox Width="16" Height="16">
|
||||
<Canvas Width="24" Height="24">
|
||||
|
|
|
|||
|
|
@ -228,13 +228,13 @@ public partial class MainWindow
|
|||
}
|
||||
}
|
||||
|
||||
private void OnSaveDirectoryClick(object sender, RoutedEventArgs e)
|
||||
private void OnFavoriteDirectoryClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (AssetsFolderName.SelectedItem is not TreeItem folder) return;
|
||||
|
||||
_applicationView.CustomDirectories.Add(new CustomDirectory(folder.Header, folder.PathAtThisPoint));
|
||||
FLogger.Append(ELog.Information, () =>
|
||||
FLogger.Text($"Successfully saved '{folder.PathAtThisPoint}' as a new custom directory", Constants.WHITE, true));
|
||||
FLogger.Text($"Successfully saved '{folder.PathAtThisPoint}' as a new favorite directory", Constants.WHITE, true));
|
||||
}
|
||||
|
||||
private void OnCopyDirectoryPathClick(object sender, RoutedEventArgs e)
|
||||
|
|
|
|||
54
FModel/Settings/CustomDirectory.cs
Normal file
54
FModel/Settings/CustomDirectory.cs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
using System.Collections.Generic;
|
||||
using FModel.Framework;
|
||||
|
||||
namespace FModel.Settings;
|
||||
|
||||
public class CustomDirectory : ViewModel
|
||||
{
|
||||
public static IList<CustomDirectory> Default(string gameName)
|
||||
{
|
||||
switch (gameName)
|
||||
{
|
||||
case "Fortnite":
|
||||
case "Fortnite [LIVE]":
|
||||
return new List<CustomDirectory>
|
||||
{
|
||||
new("Cosmetics", "FortniteGame/Content/Athena/Items/Cosmetics/"),
|
||||
new("Emotes [AUDIO]", "FortniteGame/Content/Athena/Sounds/Emotes/"),
|
||||
new("Music Packs [AUDIO]", "FortniteGame/Content/Athena/Sounds/MusicPacks/"),
|
||||
new("Weapons", "FortniteGame/Content/Athena/Items/Weapons/"),
|
||||
new("Strings", "FortniteGame/Content/Localization/")
|
||||
};
|
||||
default:
|
||||
return new List<CustomDirectory>();
|
||||
}
|
||||
}
|
||||
|
||||
private string _header;
|
||||
public string Header
|
||||
{
|
||||
get => _header;
|
||||
set => SetProperty(ref _header, value);
|
||||
}
|
||||
|
||||
private string _directoryPath;
|
||||
public string DirectoryPath
|
||||
{
|
||||
get => _directoryPath;
|
||||
set => SetProperty(ref _directoryPath, value);
|
||||
}
|
||||
|
||||
public CustomDirectory()
|
||||
{
|
||||
Header = string.Empty;
|
||||
DirectoryPath = string.Empty;
|
||||
}
|
||||
|
||||
public CustomDirectory(string header, string path)
|
||||
{
|
||||
Header = header;
|
||||
DirectoryPath = path;
|
||||
}
|
||||
|
||||
public override string ToString() => Header;
|
||||
}
|
||||
|
|
@ -3,13 +3,30 @@ using System.Collections.Generic;
|
|||
using CUE4Parse.UE4.Assets.Exports.Texture;
|
||||
using CUE4Parse.UE4.Versions;
|
||||
using FModel.Framework;
|
||||
using FModel.ViewModels;
|
||||
using FModel.ViewModels.ApiEndpoints.Models;
|
||||
|
||||
namespace FModel.Settings;
|
||||
|
||||
public class DirectorySettings : ViewModel
|
||||
{
|
||||
public static DirectorySettings Default(
|
||||
string gameName, string gameDir, bool manual = false, EGame ue = EGame.GAME_UE4_LATEST,
|
||||
ETexturePlatform texture = ETexturePlatform.DesktopMobile, VersioningSettings ver = null)
|
||||
{
|
||||
UserSettings.Default.PerDirectory.TryGetValue(gameDir, out var old);
|
||||
return new DirectorySettings
|
||||
{
|
||||
GameName = gameName,
|
||||
GameDirectory = gameDir,
|
||||
IsManual = manual,
|
||||
UeVersion = ue,
|
||||
TexturePlatform = texture,
|
||||
Versioning = ver ?? new VersioningSettings(),
|
||||
Endpoints = old?.Endpoints ?? EndpointSettings.Default(gameName),
|
||||
Directories = old?.Directories ?? CustomDirectory.Default(gameName)
|
||||
};
|
||||
}
|
||||
|
||||
private string _gameName;
|
||||
public string GameName
|
||||
{
|
||||
|
|
@ -31,20 +48,41 @@ public class DirectorySettings : ViewModel
|
|||
set => SetProperty(ref _isManual, value);
|
||||
}
|
||||
|
||||
private EGame _ueVersion = EGame.GAME_UE4_LATEST;
|
||||
private EGame _ueVersion;
|
||||
public EGame UeVersion
|
||||
{
|
||||
get => _ueVersion;
|
||||
set => SetProperty(ref _ueVersion, value);
|
||||
}
|
||||
|
||||
private ETexturePlatform _texturePlatform = ETexturePlatform.DesktopMobile;
|
||||
private ETexturePlatform _texturePlatform;
|
||||
public ETexturePlatform TexturePlatform
|
||||
{
|
||||
get => _texturePlatform;
|
||||
set => SetProperty(ref _texturePlatform, value);
|
||||
}
|
||||
|
||||
private VersioningSettings _versioning;
|
||||
public VersioningSettings Versioning
|
||||
{
|
||||
get => _versioning;
|
||||
set => SetProperty(ref _versioning, value);
|
||||
}
|
||||
|
||||
private EndpointSettings[] _endpoints;
|
||||
public EndpointSettings[] Endpoints
|
||||
{
|
||||
get => _endpoints;
|
||||
set => SetProperty(ref _endpoints, value);
|
||||
}
|
||||
|
||||
private IList<CustomDirectory> _directories;
|
||||
public IList<CustomDirectory> Directories
|
||||
{
|
||||
get => _directories;
|
||||
set => SetProperty(ref _directories, value);
|
||||
}
|
||||
|
||||
private AesResponse _aesKeys;
|
||||
public AesResponse AesKeys
|
||||
{
|
||||
|
|
@ -52,27 +90,6 @@ public class DirectorySettings : ViewModel
|
|||
set => SetProperty(ref _aesKeys, value);
|
||||
}
|
||||
|
||||
private VersioningSettings _versioning = new ();
|
||||
public VersioningSettings Versioning
|
||||
{
|
||||
get => _versioning;
|
||||
set => SetProperty(ref _versioning, value);
|
||||
}
|
||||
|
||||
private FEndpoint[] _endpoints = { new (), new () };
|
||||
public FEndpoint[] Endpoints
|
||||
{
|
||||
get => _endpoints;
|
||||
set => SetProperty(ref _endpoints, value);
|
||||
}
|
||||
|
||||
private IList<CustomDirectory> _directories = new List<CustomDirectory>();
|
||||
public IList<CustomDirectory> Directories
|
||||
{
|
||||
get => _directories;
|
||||
set => SetProperty(ref _directories, value);
|
||||
}
|
||||
|
||||
private bool Equals(DirectorySettings other)
|
||||
{
|
||||
return GameDirectory == other.GameDirectory && UeVersion == other.UeVersion;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,29 @@
|
|||
using System.Linq;
|
||||
using FModel.Framework;
|
||||
using FModel.ViewModels.ApiEndpoints;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace FModel.Framework;
|
||||
namespace FModel.Settings;
|
||||
|
||||
public class FEndpoint : ViewModel
|
||||
public class EndpointSettings : ViewModel
|
||||
{
|
||||
public static EndpointSettings[] Default(string gameName)
|
||||
{
|
||||
switch (gameName)
|
||||
{
|
||||
case "Fortnite":
|
||||
case "Fortnite [LIVE]":
|
||||
return new EndpointSettings[]
|
||||
{
|
||||
new("https://fortnitecentral.genxgames.gg/api/v1/aes", "$.['mainKey','dynamicKeys']"),
|
||||
new("https://fortnitecentral.genxgames.gg/api/v1/mappings", "$.[?(@.meta.compressionMethod=='Oodle')].['url','fileName']")
|
||||
};
|
||||
default:
|
||||
return new EndpointSettings[] { new(), new() };
|
||||
}
|
||||
}
|
||||
|
||||
private string _url;
|
||||
public string Url
|
||||
{
|
||||
|
|
@ -51,8 +68,8 @@ public class FEndpoint : ViewModel
|
|||
"Your endpoint configuration is valid! Please, avoid any unnecessary modifications!" :
|
||||
"Your endpoint configuration DOES NOT seem to be valid yet! Please, test it out!";
|
||||
|
||||
public FEndpoint() {}
|
||||
public FEndpoint(string url, string path)
|
||||
public EndpointSettings() {}
|
||||
public EndpointSettings(string url, string path)
|
||||
{
|
||||
Url = url;
|
||||
Path = path;
|
||||
|
|
@ -42,7 +42,7 @@ namespace FModel.Settings
|
|||
if (File.Exists(FilePath)) File.Delete(FilePath);
|
||||
}
|
||||
|
||||
public static bool IsEndpointValid(EEndpointType type, out FEndpoint endpoint)
|
||||
public static bool IsEndpointValid(EEndpointType type, out EndpointSettings endpoint)
|
||||
{
|
||||
endpoint = Default.CurrentDir.Endpoints[(int) type];
|
||||
return endpoint.Overwrite || endpoint.IsValid;
|
||||
|
|
@ -253,38 +253,6 @@ namespace FModel.Settings
|
|||
set => SetProperty(ref _manualGames, value);
|
||||
}
|
||||
|
||||
private IDictionary<FGame, FEndpoint[]> _customEndpoints = new Dictionary<FGame, FEndpoint[]>
|
||||
{
|
||||
{FGame.Unknown, new FEndpoint[]{new (), new ()}},
|
||||
{
|
||||
FGame.FortniteGame, new []
|
||||
{
|
||||
new FEndpoint("https://fortnitecentral.genxgames.gg/api/v1/aes", "$.['mainKey','dynamicKeys']"),
|
||||
new FEndpoint("https://fortnitecentral.genxgames.gg/api/v1/mappings", "$.[?(@.meta.compressionMethod=='Oodle')].['url','fileName']") // && @.meta.platform=='Windows'
|
||||
}
|
||||
},
|
||||
{FGame.ShooterGame, new FEndpoint[]{new (), new ()}},
|
||||
{FGame.DeadByDaylight, new FEndpoint[]{new (), new ()}},
|
||||
{FGame.OakGame, new FEndpoint[]{new (), new ()}},
|
||||
{FGame.Dungeons, new FEndpoint[]{new (), new ()}},
|
||||
{FGame.WorldExplorers, new FEndpoint[]{new (), new ()}},
|
||||
{FGame.g3, new FEndpoint[]{new (), new ()}},
|
||||
{FGame.StateOfDecay2, new FEndpoint[]{new (), new ()}},
|
||||
{FGame.Prospect, new FEndpoint[]{new (), new ()}},
|
||||
{FGame.Indiana, new FEndpoint[]{new (), new ()}},
|
||||
{FGame.RogueCompany, new FEndpoint[]{new (), new ()}},
|
||||
{FGame.SwGame, new FEndpoint[]{new (), new ()}},
|
||||
{FGame.Platform, new FEndpoint[]{new (), new ()}},
|
||||
{FGame.BendGame, new FEndpoint[]{new (), new ()}},
|
||||
{FGame.TslGame, new FEndpoint[]{new (), new ()}},
|
||||
{FGame.PortalWars, new FEndpoint[]{new (), new ()}},
|
||||
{FGame.Gameface, new FEndpoint[]{new (), new ()}},
|
||||
{FGame.Athena, new FEndpoint[]{new (), new ()}},
|
||||
{FGame.MultiVersus, new FEndpoint[]{new (), new ()}},
|
||||
{FGame.Hotta, new FEndpoint[]{new (), new ()}},
|
||||
{FGame.eFootball, new FEndpoint[]{new (), new ()}}
|
||||
};
|
||||
|
||||
private IDictionary<FGame, IList<CustomDirectory>> _customDirectories = new Dictionary<FGame, IList<CustomDirectory>>
|
||||
{
|
||||
{FGame.Unknown, new List<CustomDirectory>()},
|
||||
|
|
|
|||
|
|
@ -26,4 +26,6 @@ public class VersioningSettings : ViewModel
|
|||
get => _mapStructTypes;
|
||||
set => SetProperty(ref _mapStructTypes, value);
|
||||
}
|
||||
|
||||
public VersioningSettings() {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,11 +170,6 @@ public class CUE4ParseViewModel : ViewModel
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (Game == FGame.FortniteGame) currentDir.Endpoints = new[]
|
||||
{
|
||||
new FEndpoint("https://fortnitecentral.genxgames.gg/api/v1/aes", "$.['mainKey','dynamicKeys']"),
|
||||
new FEndpoint("https://fortnitecentral.genxgames.gg/api/v1/mappings", "$.[?(@.meta.compressionMethod=='Oodle')].['url','fileName']")
|
||||
};
|
||||
Provider.ReadScriptData = UserSettings.Default.ReadScriptData;
|
||||
|
||||
GameDirectory = new GameDirectoryViewModel();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using AdonisUI.Controls;
|
||||
using FModel.Framework;
|
||||
using FModel.Settings;
|
||||
using FModel.Views;
|
||||
|
||||
namespace FModel.ViewModels.Commands;
|
||||
|
|
@ -31,4 +32,4 @@ public class AddEditDirectoryCommand : ViewModelCommand<CustomDirectoriesViewMod
|
|||
contextViewModel.Add(customDir);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using FModel.Framework;
|
||||
using FModel.Settings;
|
||||
|
||||
namespace FModel.ViewModels.Commands;
|
||||
|
||||
|
|
@ -17,4 +18,4 @@ public class DeleteDirectoryCommand : ViewModelCommand<CustomDirectoriesViewMode
|
|||
|
||||
contextViewModel.Delete(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,37 +11,6 @@ using FModel.ViewModels.Commands;
|
|||
|
||||
namespace FModel.ViewModels;
|
||||
|
||||
public class CustomDirectory : ViewModel
|
||||
{
|
||||
private string _header;
|
||||
public string Header
|
||||
{
|
||||
get => _header;
|
||||
set => SetProperty(ref _header, value);
|
||||
}
|
||||
|
||||
private string _directoryPath;
|
||||
public string DirectoryPath
|
||||
{
|
||||
get => _directoryPath;
|
||||
set => SetProperty(ref _directoryPath, value);
|
||||
}
|
||||
|
||||
public CustomDirectory()
|
||||
{
|
||||
Header = string.Empty;
|
||||
DirectoryPath = string.Empty;
|
||||
}
|
||||
|
||||
public CustomDirectory(string header, string path)
|
||||
{
|
||||
Header = header;
|
||||
DirectoryPath = path;
|
||||
}
|
||||
|
||||
public override string ToString() => Header;
|
||||
}
|
||||
|
||||
public class CustomDirectoriesViewModel : ViewModel
|
||||
{
|
||||
private GoToCommand _goToCommand;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ public class GameSelectorViewModel : ViewModel
|
|||
public void AddUndetectedDir(string gameDirectory) => AddUndetectedDir(gameDirectory.SubstringAfterLast('\\'), gameDirectory);
|
||||
public void AddUndetectedDir(string gameName, string gameDirectory)
|
||||
{
|
||||
var setting = new DirectorySettings { GameName = gameName, GameDirectory = gameDirectory, IsManual = true };
|
||||
var setting = DirectorySettings.Default(gameName, gameDirectory, true);
|
||||
UserSettings.Default.PerDirectory[gameDirectory] = setting;
|
||||
_detectedDirectories.Add(setting);
|
||||
SelectedDirectory = DetectedDirectories.Last();
|
||||
|
|
@ -84,7 +84,7 @@ public class GameSelectorViewModel : ViewModel
|
|||
private IEnumerable<DirectorySettings> EnumerateDetectedGames()
|
||||
{
|
||||
yield return GetUnrealEngineGame("Fortnite", "\\FortniteGame\\Content\\Paks", EGame.GAME_UE5_2);
|
||||
yield return new DirectorySettings { GameName = "Fortnite [LIVE]", GameDirectory = Constants._FN_LIVE_TRIGGER, UeVersion = EGame.GAME_UE5_2 };
|
||||
yield return DirectorySettings.Default("Fortnite [LIVE]", Constants._FN_LIVE_TRIGGER, ue: EGame.GAME_UE5_2);
|
||||
yield return GetUnrealEngineGame("Pewee", "\\RogueCompany\\Content\\Paks", EGame.GAME_RogueCompany);
|
||||
yield return GetUnrealEngineGame("Rosemallow", "\\Indiana\\Content\\Paks", EGame.GAME_UE4_21);
|
||||
yield return GetUnrealEngineGame("Catnip", "\\OakGame\\Content\\Paks", EGame.GAME_Borderlands3);
|
||||
|
|
@ -94,7 +94,7 @@ public class GameSelectorViewModel : ViewModel
|
|||
yield return GetUnrealEngineGame("711c5e95dc094ca58e5f16bd48e751d6", "\\MultiVersus\\Content\\Paks", EGame.GAME_UE4_26);
|
||||
yield return GetUnrealEngineGame("9361c8c6d2f34b42b5f2f61093eedf48", "\\TslGame\\Content\\Paks", EGame.GAME_PlayerUnknownsBattlegrounds);
|
||||
yield return GetRiotGame("VALORANT", "ShooterGame\\Content\\Paks", EGame.GAME_Valorant);
|
||||
yield return new DirectorySettings { GameName = "Valorant [LIVE]", GameDirectory = Constants._VAL_LIVE_TRIGGER, UeVersion = EGame.GAME_Valorant };
|
||||
yield return DirectorySettings.Default("Valorant [LIVE]", Constants._VAL_LIVE_TRIGGER, ue: EGame.GAME_Valorant);
|
||||
yield return GetSteamGame(381210, "\\DeadByDaylight\\Content\\Paks", EGame.GAME_UE4_27); // Dead By Daylight
|
||||
yield return GetSteamGame(578080, "\\TslGame\\Content\\Paks", EGame.GAME_PlayerUnknownsBattlegrounds); // PUBG
|
||||
yield return GetSteamGame(1172380, "\\SwGame\\Content\\Paks", EGame.GAME_StarWarsJediFallenOrder); // STAR WARS Jedi: Fallen Order™
|
||||
|
|
@ -119,7 +119,7 @@ public class GameSelectorViewModel : ViewModel
|
|||
if (installationList.AppName.Equals(gameName, StringComparison.OrdinalIgnoreCase) && Directory.Exists(gameDir))
|
||||
{
|
||||
Log.Debug("Found {GameName} in LauncherInstalled.dat", gameName);
|
||||
return new DirectorySettings { GameName = installationList.AppName, GameDirectory = gameDir, UeVersion = ueVersion };
|
||||
return DirectorySettings.Default(installationList.AppName, gameDir, ue: ueVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -139,7 +139,7 @@ public class GameSelectorViewModel : ViewModel
|
|||
if (key.Contains(gameName, StringComparison.OrdinalIgnoreCase) && Directory.Exists(gameDir))
|
||||
{
|
||||
Log.Debug("Found {GameName} in RiotClientInstalls.json", gameName);
|
||||
return new DirectorySettings { GameName = gameName, GameDirectory = gameDir, UeVersion = ueVersion };
|
||||
return DirectorySettings.Default(gameName, gameDir, ue: ueVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -147,30 +147,13 @@ public class GameSelectorViewModel : ViewModel
|
|||
return null;
|
||||
}
|
||||
|
||||
private LauncherSettings _launcherSettings;
|
||||
private DirectorySettings GetMojangGame(string gameName, string pakDirectory, EGame ueVersion)
|
||||
{
|
||||
_launcherSettings ??= GetDataLauncherInstalls<LauncherSettings>("\\.minecraft\\launcher_settings.json");
|
||||
if (_launcherSettings is { ProductLibraryDir: { } })
|
||||
{
|
||||
var gameDir = $"{_launcherSettings.ProductLibraryDir}{pakDirectory}";
|
||||
if (Directory.Exists(gameDir))
|
||||
{
|
||||
Log.Debug("Found {GameName} in launcher_settings.json", gameName);
|
||||
return new DirectorySettings { GameName = gameName, GameDirectory = gameDir, UeVersion = ueVersion };
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private DirectorySettings GetSteamGame(int id, string pakDirectory, EGame ueVersion)
|
||||
{
|
||||
var steamInfo = SteamDetection.GetSteamGameById(id);
|
||||
if (steamInfo is not null)
|
||||
{
|
||||
Log.Debug("Found {GameName} in steam manifests", steamInfo.Name);
|
||||
return new DirectorySettings { GameName = steamInfo.Name, GameDirectory = $"{steamInfo.GameRoot}{pakDirectory}", UeVersion = ueVersion };
|
||||
return DirectorySettings.Default(steamInfo.Name, $"{steamInfo.GameRoot}{pakDirectory}", ue: ueVersion);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -192,7 +175,7 @@ public class GameSelectorViewModel : ViewModel
|
|||
if (Directory.Exists(gameDir))
|
||||
{
|
||||
Log.Debug("Found {GameName} in the registry", key);
|
||||
return new DirectorySettings { GameName = key, GameDirectory = gameDir, UeVersion = ueVersion };
|
||||
return DirectorySettings.Default(key, gameDir, ue: ueVersion);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -217,7 +200,7 @@ public class GameSelectorViewModel : ViewModel
|
|||
if (Directory.Exists(gameDir))
|
||||
{
|
||||
Log.Debug("Found {GameName} in the registry", key);
|
||||
return new DirectorySettings { GameName = displayName, GameDirectory = gameDir, UeVersion = ueVersion };
|
||||
return DirectorySettings.Default(displayName, gameDir, ue: ueVersion);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -237,19 +220,6 @@ public class GameSelectorViewModel : ViewModel
|
|||
return default;
|
||||
}
|
||||
|
||||
private T GetDataLauncherInstalls<T>(string jsonFile)
|
||||
{
|
||||
var appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||
var launcher = $"{appData}{jsonFile}";
|
||||
if (File.Exists(launcher))
|
||||
{
|
||||
Log.Debug("\"{Launcher}\" found in \"{AppData}\"", launcher, appData);
|
||||
return JsonConvert.DeserializeObject<T>(File.ReadAllText(launcher));
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
#pragma warning disable 649
|
||||
private class LauncherInstalled
|
||||
{
|
||||
|
|
|
|||
|
|
@ -72,15 +72,15 @@ public class SettingsViewModel : ViewModel
|
|||
set => SetProperty(ref _selectedMapStructTypes, value);
|
||||
}
|
||||
|
||||
private FEndpoint _aesEndpoint;
|
||||
public FEndpoint AesEndpoint
|
||||
private EndpointSettings _aesEndpoint;
|
||||
public EndpointSettings AesEndpoint
|
||||
{
|
||||
get => _aesEndpoint;
|
||||
set => SetProperty(ref _aesEndpoint, value);
|
||||
}
|
||||
|
||||
private FEndpoint _mappingEndpoint;
|
||||
public FEndpoint MappingEndpoint
|
||||
private EndpointSettings _mappingEndpoint;
|
||||
public EndpointSettings MappingEndpoint
|
||||
{
|
||||
get => _mappingEndpoint;
|
||||
set => SetProperty(ref _mappingEndpoint, value);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using System.Windows;
|
||||
using FModel.ViewModels;
|
||||
using FModel.Settings;
|
||||
|
||||
namespace FModel.Views;
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ public partial class CustomDir
|
|||
{
|
||||
DataContext = customDir;
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
Activate();
|
||||
WpfSuckMyDick.Focus();
|
||||
WpfSuckMyDick.SelectAll();
|
||||
|
|
@ -20,4 +20,4 @@ public partial class CustomDir
|
|||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,10 @@
|
|||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using FModel.Extensions;
|
||||
using FModel.Framework;
|
||||
using FModel.Services;
|
||||
using FModel.Settings;
|
||||
using ICSharpCode.AvalonEdit.Document;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using RestSharp;
|
||||
|
||||
namespace FModel.Views.Resources.Controls;
|
||||
|
||||
|
|
@ -16,7 +14,7 @@ public partial class EndpointEditor
|
|||
private readonly EEndpointType _type;
|
||||
private bool _isTested;
|
||||
|
||||
public EndpointEditor(FEndpoint endpoint, string title, EEndpointType type)
|
||||
public EndpointEditor(EndpointSettings endpoint, string title, EEndpointType type)
|
||||
{
|
||||
DataContext = endpoint;
|
||||
_type = type;
|
||||
|
|
@ -52,13 +50,13 @@ public partial class EndpointEditor
|
|||
|
||||
private void OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = _isTested && DataContext is FEndpoint { IsValid: true };
|
||||
DialogResult = _isTested && DataContext is EndpointSettings { IsValid: true };
|
||||
Close();
|
||||
}
|
||||
|
||||
private async void OnSend(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (DataContext is not FEndpoint endpoint) return;
|
||||
if (DataContext is not EndpointSettings endpoint) return;
|
||||
|
||||
var body = await ApplicationService.ApiEndpointView.DynamicApi.GetRequestBody(default, endpoint.Url).ConfigureAwait(false);
|
||||
Application.Current.Dispatcher.Invoke(delegate
|
||||
|
|
@ -70,7 +68,7 @@ public partial class EndpointEditor
|
|||
|
||||
private void OnTest(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (DataContext is not FEndpoint endpoint) return;
|
||||
if (DataContext is not EndpointSettings endpoint) return;
|
||||
|
||||
endpoint.TryValidate(ApplicationService.ApiEndpointView.DynamicApi, _type, out var response);
|
||||
_isTested = true;
|
||||
|
|
@ -82,7 +80,7 @@ public partial class EndpointEditor
|
|||
private void OnTextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (sender is not TextBox { IsLoaded: true } ||
|
||||
DataContext is not FEndpoint endpoint) return;
|
||||
DataContext is not EndpointSettings endpoint) return;
|
||||
endpoint.IsValid = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user