2019-09-02 18:03:57 +02:00
|
|
|
using JsonPrettyPrinterPlus;
|
2019-06-01 02:31:10 +02:00
|
|
|
using LibHac.Fs;
|
2019-02-11 13:00:32 +01:00
|
|
|
using OpenTK.Input;
|
|
|
|
using Ryujinx.Common;
|
|
|
|
using Ryujinx.Common.Logging;
|
|
|
|
using Ryujinx.HLE;
|
|
|
|
using Ryujinx.HLE.HOS.SystemState;
|
2019-04-16 01:22:55 +02:00
|
|
|
using Ryujinx.HLE.HOS.Services;
|
2019-02-11 13:00:32 +01:00
|
|
|
using Ryujinx.HLE.Input;
|
2019-09-02 18:03:57 +02:00
|
|
|
using Ryujinx.UI;
|
2019-02-11 13:00:32 +01:00
|
|
|
using Ryujinx.UI.Input;
|
|
|
|
using System;
|
2019-09-02 18:03:57 +02:00
|
|
|
using System.Collections.Generic;
|
2019-02-11 13:00:32 +01:00
|
|
|
using System.IO;
|
2019-09-02 18:03:57 +02:00
|
|
|
using System.Text;
|
2019-02-11 13:00:32 +01:00
|
|
|
using System.Threading.Tasks;
|
|
|
|
using Utf8Json;
|
|
|
|
using Utf8Json.Resolvers;
|
|
|
|
|
|
|
|
namespace Ryujinx
|
|
|
|
{
|
|
|
|
public class Configuration
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// The default configuration instance
|
|
|
|
/// </summary>
|
|
|
|
public static Configuration Instance { get; private set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Dumps shaders in this local directory
|
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public string GraphicsShadersDumpPath { get; set; }
|
2019-02-11 13:00:32 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Enables printing debug log messages
|
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public bool LoggingEnableDebug { get; set; }
|
2019-02-11 13:00:32 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Enables printing stub log messages
|
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public bool LoggingEnableStub { get; set; }
|
2019-02-11 13:00:32 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Enables printing info log messages
|
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public bool LoggingEnableInfo { get; set; }
|
2019-02-11 13:00:32 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Enables printing warning log messages
|
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public bool LoggingEnableWarn { get; set; }
|
2019-02-11 13:00:32 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Enables printing error log messages
|
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public bool LoggingEnableError { get; set; }
|
2019-02-11 13:00:32 +01:00
|
|
|
|
2019-06-16 03:31:18 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Enables printing guest log messages
|
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public bool LoggingEnableGuest { get; set; }
|
2019-06-16 03:31:18 +02:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Enables printing FS access log messages
|
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public bool LoggingEnableFsAccessLog { get; set; }
|
2019-06-16 03:31:18 +02:00
|
|
|
|
2019-02-11 13:00:32 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Controls which log messages are written to the log targets
|
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public LogClass[] LoggingFilteredClasses { get; set; }
|
2019-02-11 13:00:32 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Enables or disables logging to a file on disk
|
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public bool EnableFileLog { get; set; }
|
2019-02-11 13:00:32 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Change System Language
|
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public SystemLanguage SystemLanguage { get; set; }
|
2019-02-11 13:00:32 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Enables or disables Docked Mode
|
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public bool DockedMode { get; set; }
|
2019-02-11 13:00:32 +01:00
|
|
|
|
2019-05-30 22:27:43 +02:00
|
|
|
/// <summary>
|
2019-07-02 04:39:22 +02:00
|
|
|
/// Enables or disables Discord Rich Presence
|
2019-05-30 22:27:43 +02:00
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public bool EnableDiscordIntegration { get; set; }
|
2019-05-30 22:27:43 +02:00
|
|
|
|
2019-02-11 13:00:32 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Enables or disables Vertical Sync
|
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public bool EnableVsync { get; set; }
|
2019-02-11 13:00:32 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Enables or disables multi-core scheduling of threads
|
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public bool EnableMulticoreScheduling { get; set; }
|
2019-02-11 13:00:32 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Enables integrity checks on Game content files
|
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public bool EnableFsIntegrityChecks { get; set; }
|
2019-02-11 13:00:32 +01:00
|
|
|
|
2019-06-16 03:31:18 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Enables FS access log output to the console. Possible modes are 0-3
|
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public int FsGlobalAccessLogMode { get; set; }
|
2019-06-16 03:31:18 +02:00
|
|
|
|
2019-02-28 03:03:31 +01:00
|
|
|
/// <summary>
|
Add a new JIT compiler for CPU code (#693)
* Start of the ARMeilleure project
* Refactoring around the old IRAdapter, now renamed to PreAllocator
* Optimize the LowestBitSet method
* Add CLZ support and fix CLS implementation
* Add missing Equals and GetHashCode overrides on some structs, misc small tweaks
* Implement the ByteSwap IR instruction, and some refactoring on the assembler
* Implement the DivideUI IR instruction and fix 64-bits IDIV
* Correct constant operand type on CSINC
* Move division instructions implementation to InstEmitDiv
* Fix destination type for the ConditionalSelect IR instruction
* Implement UMULH and SMULH, with new IR instructions
* Fix some issues with shift instructions
* Fix constant types for BFM instructions
* Fix up new tests using the new V128 struct
* Update tests
* Move DIV tests to a separate file
* Add support for calls, and some instructions that depends on them
* Start adding support for SIMD & FP types, along with some of the related ARM instructions
* Fix some typos and the divide instruction with FP operands
* Fix wrong method call on Clz_V
* Implement ARM FP & SIMD move instructions, Saddlv_V, and misc. fixes
* Implement SIMD logical instructions and more misc. fixes
* Fix PSRAD x86 instruction encoding, TRN, UABD and UABDL implementations
* Implement float conversion instruction, merge in LDj3SNuD fixes, and some other misc. fixes
* Implement SIMD shift instruction and fix Dup_V
* Add SCVTF and UCVTF (vector, fixed-point) variants to the opcode table
* Fix check with tolerance on tester
* Implement FP & SIMD comparison instructions, and some fixes
* Update FCVT (Scalar) encoding on the table to support the Half-float variants
* Support passing V128 structs, some cleanup on the register allocator, merge LDj3SNuD fixes
* Use old memory access methods, made a start on SIMD memory insts support, some fixes
* Fix float constant passed to functions, save and restore non-volatile XMM registers, other fixes
* Fix arguments count with struct return values, other fixes
* More instructions
* Misc. fixes and integrate LDj3SNuD fixes
* Update tests
* Add a faster linear scan allocator, unwinding support on windows, and other changes
* Update Ryujinx.HLE
* Update Ryujinx.Graphics
* Fix V128 return pointer passing, RCX is clobbered
* Update Ryujinx.Tests
* Update ITimeZoneService
* Stop using GetFunctionPointer as that can't be called from native code, misc. fixes and tweaks
* Use generic GetFunctionPointerForDelegate method and other tweaks
* Some refactoring on the code generator, assert on invalid operations and use a separate enum for intrinsics
* Remove some unused code on the assembler
* Fix REX.W prefix regression on float conversion instructions, add some sort of profiler
* Add hardware capability detection
* Fix regression on Sha1h and revert Fcm** changes
* Add SSE2-only paths on vector extract and insert, some refactoring on the pre-allocator
* Fix silly mistake introduced on last commit on CpuId
* Generate inline stack probes when the stack allocation is too large
* Initial support for the System-V ABI
* Support multiple destination operands
* Fix SSE2 VectorInsert8 path, and other fixes
* Change placement of XMM callee save and restore code to match other compilers
* Rename Dest to Destination and Inst to Instruction
* Fix a regression related to calls and the V128 type
* Add an extra space on comments to match code style
* Some refactoring
* Fix vector insert FP32 SSE2 path
* Port over the ARM32 instructions
* Avoid memory protection races on JIT Cache
* Another fix on VectorInsert FP32 (thanks to LDj3SNuD
* Float operands don't need to use the same register when VEX is supported
* Add a new register allocator, higher quality code for hot code (tier up), and other tweaks
* Some nits, small improvements on the pre allocator
* CpuThreadState is gone
* Allow changing CPU emulators with a config entry
* Add runtime identifiers on the ARMeilleure project
* Allow switching between CPUs through a config entry (pt. 2)
* Change win10-x64 to win-x64 on projects
* Update the Ryujinx project to use ARMeilleure
* Ensure that the selected register is valid on the hybrid allocator
* Allow exiting on returns to 0 (should fix test regression)
* Remove register assignments for most used variables on the hybrid allocator
* Do not use fixed registers as spill temp
* Add missing namespace and remove unneeded using
* Address PR feedback
* Fix types, etc
* Enable AssumeStrictAbiCompliance by default
* Ensure that Spill and Fill don't load or store any more than necessary
2019-08-08 20:56:22 +02:00
|
|
|
/// Use old ChocolArm64 ARM emulator
|
2019-02-28 03:03:31 +01:00
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public bool EnableLegacyJit { get; set; }
|
2019-02-28 03:03:31 +01:00
|
|
|
|
2019-04-16 01:22:55 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Enable or disable ignoring missing services
|
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public bool IgnoreMissingServices { get; set; }
|
2019-04-16 01:22:55 +02:00
|
|
|
|
2019-02-11 13:00:32 +01:00
|
|
|
/// <summary>
|
|
|
|
/// The primary controller's type
|
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public ControllerStatus ControllerType { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Used to toggle columns in the GUI
|
|
|
|
/// </summary>
|
|
|
|
public List<bool> GuiColumns { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// A list of directories containing games to be used to load games into the games list
|
|
|
|
/// </summary>
|
|
|
|
public List<string> GameDirs { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Enable or disable custom themes in the GUI
|
|
|
|
/// </summary>
|
|
|
|
public bool EnableCustomTheme { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Path to custom GUI theme
|
|
|
|
/// </summary>
|
|
|
|
public string CustomThemePath { get; set; }
|
2019-02-11 13:00:32 +01:00
|
|
|
|
2019-05-03 01:29:01 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Enable or disable keyboard support (Independent from controllers binding)
|
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public bool EnableKeyboard { get; set; }
|
2019-05-03 01:29:01 +02:00
|
|
|
|
2019-02-11 13:00:32 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Keyboard control bindings
|
|
|
|
/// </summary>
|
2019-09-02 18:03:57 +02:00
|
|
|
public NpadKeyboard KeyboardControls { get; set; }
|
2019-02-11 13:00:32 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Controller control bindings
|
|
|
|
/// </summary>
|
2019-08-05 20:58:27 +02:00
|
|
|
public UI.Input.NpadController JoystickControls { get; private set; }
|
2019-02-11 13:00:32 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Loads a configuration file from disk
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="path">The path to the JSON configuration file</param>
|
|
|
|
public static void Load(string path)
|
|
|
|
{
|
|
|
|
var resolver = CompositeResolver.Create(
|
|
|
|
new[] { new ConfigurationEnumFormatter<Key>() },
|
|
|
|
new[] { StandardResolver.AllowPrivateSnakeCase }
|
|
|
|
);
|
|
|
|
|
|
|
|
using (Stream stream = File.OpenRead(path))
|
|
|
|
{
|
|
|
|
Instance = JsonSerializer.Deserialize<Configuration>(stream, resolver);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Loads a configuration file asynchronously from disk
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="path">The path to the JSON configuration file</param>
|
|
|
|
public static async Task LoadAsync(string path)
|
|
|
|
{
|
2019-09-02 18:03:57 +02:00
|
|
|
IJsonFormatterResolver resolver = CompositeResolver.Create(
|
|
|
|
new[] { new ConfigurationEnumFormatter<Key>() },
|
2019-02-11 13:00:32 +01:00
|
|
|
new[] { StandardResolver.AllowPrivateSnakeCase }
|
|
|
|
);
|
|
|
|
|
|
|
|
using (Stream stream = File.OpenRead(path))
|
|
|
|
{
|
|
|
|
Instance = await JsonSerializer.DeserializeAsync<Configuration>(stream, resolver);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-02 18:03:57 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Save a configuration file to disk
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="path">The path to the JSON configuration file</param>
|
|
|
|
public static void SaveConfig(Configuration config, string path)
|
|
|
|
{
|
|
|
|
IJsonFormatterResolver resolver = CompositeResolver.Create(
|
|
|
|
new[] { new ConfigurationEnumFormatter<Key>() },
|
|
|
|
new[] { StandardResolver.AllowPrivateSnakeCase }
|
|
|
|
);
|
|
|
|
|
|
|
|
byte[] data = JsonSerializer.Serialize(config, resolver);
|
|
|
|
File.WriteAllText(path, Encoding.UTF8.GetString(data, 0, data.Length).PrettyPrintJson());
|
|
|
|
}
|
|
|
|
|
2019-02-11 13:00:32 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Configures a <see cref="Switch"/> instance
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="device">The instance to configure</param>
|
2019-09-02 18:03:57 +02:00
|
|
|
public static void InitialConfigure(Switch device)
|
2019-02-11 13:00:32 +01:00
|
|
|
{
|
|
|
|
if (Instance == null)
|
|
|
|
{
|
|
|
|
throw new InvalidOperationException("Configuration has not been loaded yet.");
|
|
|
|
}
|
|
|
|
|
2019-09-02 18:03:57 +02:00
|
|
|
SwitchSettings.ConfigureSettings(Instance);
|
2019-02-11 13:00:32 +01:00
|
|
|
|
|
|
|
Logger.AddTarget(new AsyncLogTargetWrapper(
|
|
|
|
new ConsoleLogTarget(),
|
|
|
|
1000,
|
|
|
|
AsyncLogTargetOverflowAction.Block
|
|
|
|
));
|
|
|
|
|
|
|
|
if (Instance.EnableFileLog)
|
|
|
|
{
|
|
|
|
Logger.AddTarget(new AsyncLogTargetWrapper(
|
2019-09-02 18:03:57 +02:00
|
|
|
new FileLogTarget(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Ryujinx.log")),
|
2019-02-11 13:00:32 +01:00
|
|
|
1000,
|
|
|
|
AsyncLogTargetOverflowAction.Block
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
2019-09-02 18:03:57 +02:00
|
|
|
Configure(device, Instance);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void Configure(Switch device, Configuration SwitchConfig)
|
|
|
|
{
|
|
|
|
GraphicsConfig.ShadersDumpPath = SwitchConfig.GraphicsShadersDumpPath;
|
|
|
|
|
|
|
|
Logger.SetEnable(LogLevel.Debug, SwitchConfig.LoggingEnableDebug );
|
|
|
|
Logger.SetEnable(LogLevel.Stub, SwitchConfig.LoggingEnableStub );
|
|
|
|
Logger.SetEnable(LogLevel.Info, SwitchConfig.LoggingEnableInfo );
|
|
|
|
Logger.SetEnable(LogLevel.Warning, SwitchConfig.LoggingEnableWarn );
|
|
|
|
Logger.SetEnable(LogLevel.Error, SwitchConfig.LoggingEnableError );
|
|
|
|
Logger.SetEnable(LogLevel.Guest, SwitchConfig.LoggingEnableGuest );
|
|
|
|
Logger.SetEnable(LogLevel.AccessLog, SwitchConfig.LoggingEnableFsAccessLog);
|
2019-02-11 13:00:32 +01:00
|
|
|
|
2019-09-02 18:03:57 +02:00
|
|
|
if (SwitchConfig.LoggingFilteredClasses.Length > 0)
|
2019-02-11 13:00:32 +01:00
|
|
|
{
|
|
|
|
foreach (var logClass in EnumExtensions.GetValues<LogClass>())
|
|
|
|
{
|
|
|
|
Logger.SetEnable(logClass, false);
|
|
|
|
}
|
|
|
|
|
2019-09-02 18:03:57 +02:00
|
|
|
foreach (var logClass in SwitchConfig.LoggingFilteredClasses)
|
2019-02-11 13:00:32 +01:00
|
|
|
{
|
|
|
|
Logger.SetEnable(logClass, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-02 18:03:57 +02:00
|
|
|
MainWindow.DiscordIntegrationEnabled = SwitchConfig.EnableDiscordIntegration;
|
2019-05-30 22:27:43 +02:00
|
|
|
|
2019-09-02 18:03:57 +02:00
|
|
|
device.EnableDeviceVsync = SwitchConfig.EnableVsync;
|
2019-02-11 13:00:32 +01:00
|
|
|
|
2019-09-02 18:03:57 +02:00
|
|
|
device.System.State.DockedMode = SwitchConfig.DockedMode;
|
2019-02-11 13:00:32 +01:00
|
|
|
|
2019-09-02 18:03:57 +02:00
|
|
|
device.System.State.SetLanguage(SwitchConfig.SystemLanguage);
|
2019-02-11 13:00:32 +01:00
|
|
|
|
2019-09-02 18:03:57 +02:00
|
|
|
if (SwitchConfig.EnableMulticoreScheduling)
|
2019-02-11 13:00:32 +01:00
|
|
|
{
|
|
|
|
device.System.EnableMultiCoreScheduling();
|
|
|
|
}
|
|
|
|
|
2019-09-02 18:03:57 +02:00
|
|
|
device.System.FsIntegrityCheckLevel = SwitchConfig.EnableFsIntegrityChecks
|
2019-02-11 13:00:32 +01:00
|
|
|
? IntegrityCheckLevel.ErrorOnInvalid
|
|
|
|
: IntegrityCheckLevel.None;
|
|
|
|
|
2019-09-02 18:03:57 +02:00
|
|
|
device.System.GlobalAccessLogMode = SwitchConfig.FsGlobalAccessLogMode;
|
2019-06-16 03:31:18 +02:00
|
|
|
|
2019-09-02 18:03:57 +02:00
|
|
|
device.System.UseLegacyJit = SwitchConfig.EnableLegacyJit;
|
2019-02-28 03:03:31 +01:00
|
|
|
|
2019-09-02 18:03:57 +02:00
|
|
|
ServiceConfiguration.IgnoreMissingServices = SwitchConfig.IgnoreMissingServices;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void ConfigureHid(Switch device, Configuration SwitchConfig)
|
|
|
|
{
|
|
|
|
if (SwitchConfig.JoystickControls.Enabled)
|
2019-02-11 13:00:32 +01:00
|
|
|
{
|
2019-09-02 18:03:57 +02:00
|
|
|
if (!Joystick.GetState(SwitchConfig.JoystickControls.Index).IsConnected)
|
2019-02-11 13:00:32 +01:00
|
|
|
{
|
2019-09-02 18:03:57 +02:00
|
|
|
SwitchConfig.JoystickControls.SetEnabled(false);
|
2019-02-11 13:00:32 +01:00
|
|
|
}
|
|
|
|
}
|
2019-09-02 18:03:57 +02:00
|
|
|
device.Hid.InitializePrimaryController(SwitchConfig.ControllerType);
|
2019-07-02 04:39:22 +02:00
|
|
|
device.Hid.InitializeKeyboard();
|
2019-02-11 13:00:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private class ConfigurationEnumFormatter<T> : IJsonFormatter<T>
|
|
|
|
where T : struct
|
|
|
|
{
|
|
|
|
public void Serialize(ref JsonWriter writer, T value, IJsonFormatterResolver formatterResolver)
|
|
|
|
{
|
|
|
|
formatterResolver.GetFormatterWithVerify<string>()
|
|
|
|
.Serialize(ref writer, value.ToString(), formatterResolver);
|
|
|
|
}
|
|
|
|
|
|
|
|
public T Deserialize(ref JsonReader reader, IJsonFormatterResolver formatterResolver)
|
|
|
|
{
|
|
|
|
if (reader.ReadIsNull())
|
|
|
|
{
|
|
|
|
return default(T);
|
|
|
|
}
|
|
|
|
|
2019-07-02 04:39:22 +02:00
|
|
|
string enumName = formatterResolver.GetFormatterWithVerify<string>()
|
|
|
|
.Deserialize(ref reader, formatterResolver);
|
2019-02-11 13:00:32 +01:00
|
|
|
|
2019-07-02 04:39:22 +02:00
|
|
|
if (Enum.TryParse<T>(enumName, out T result))
|
2019-02-11 13:00:32 +01:00
|
|
|
{
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
return default(T);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|