2020-08-02 15:41:24 +01:00
|
|
|
using Ryujinx.Common.Configuration;
|
2020-04-30 13:07:41 +01:00
|
|
|
using Ryujinx.Common.Configuration.Hid;
|
|
|
|
using Ryujinx.Common.Logging;
|
|
|
|
using Ryujinx.Common.Utilities;
|
2022-05-15 12:30:15 +01:00
|
|
|
using Ryujinx.Ui.Common.Configuration.System;
|
|
|
|
using Ryujinx.Ui.Common.Configuration.Ui;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.IO;
|
2019-02-11 12:00:32 +00:00
|
|
|
|
2022-05-15 12:30:15 +01:00
|
|
|
namespace Ryujinx.Ui.Common.Configuration
|
2019-02-11 12:00:32 +00:00
|
|
|
{
|
2019-12-21 19:52:31 +00:00
|
|
|
public class ConfigurationFileFormat
|
2019-02-11 12:00:32 +00:00
|
|
|
{
|
2020-03-25 22:23:21 +00:00
|
|
|
/// <summary>
|
|
|
|
/// The current version of the file format
|
|
|
|
/// </summary>
|
2022-05-15 12:30:15 +01:00
|
|
|
public const int CurrentVersion = 38;
|
2020-03-25 22:23:21 +00:00
|
|
|
|
2021-12-26 14:17:13 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Version of the configuration file format
|
|
|
|
/// </summary>
|
2019-12-21 19:52:31 +00:00
|
|
|
public int Version { get; set; }
|
2019-02-11 12:00:32 +00:00
|
|
|
|
2021-04-30 20:39:42 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Enables or disables logging to a file on disk
|
|
|
|
/// </summary>
|
|
|
|
public bool EnableFileLog { get; set; }
|
|
|
|
|
Add a Multithreading layer for the GAL, multi-thread shader compilation at runtime (#2501)
* Initial Implementation
About as fast as nvidia GL multithreading, can be improved with faster command queuing.
* Struct based command list
Speeds up a bit. Still a lot of time lost to resource copy.
* Do shader init while the render thread is active.
* Introduce circular span pool V1
Ideally should be able to use structs instead of references for storing these spans on commands. Will try that next.
* Refactor SpanRef some more
Use a struct to represent SpanRef, rather than a reference.
* Flush buffers on background thread
* Use a span for UpdateRenderScale.
Much faster than copying the array.
* Calculate command size using reflection
* WIP parallel shaders
* Some minor optimisation
* Only 2 max refs per command now.
The command with 3 refs is gone. :relieved:
* Don't cast on the GPU side
* Remove redundant casts, force sync on window present
* Fix Shader Cache
* Fix host shader save.
* Fixup to work with new renderer stuff
* Make command Run static, use array of delegates as lookup
Profile says this takes less time than the previous way.
* Bring up to date
* Add settings toggle. Fix Muiltithreading Off mode.
* Fix warning.
* Release tracking lock for flushes
* Fix Conditional Render fast path with threaded gal
* Make handle iteration safe when releasing the lock
This is mostly temporary.
* Attempt to set backend threading on driver
Only really works on nvidia before launching a game.
* Fix race condition with BufferModifiedRangeList, exceptions in tracking actions
* Update buffer set commands
* Some cleanup
* Only use stutter workaround when using opengl renderer non-threaded
* Add host-conditional reservation of counter events
There has always been the possibility that conditional rendering could use a query object just as it is disposed by the counter queue. This change makes it so that when the host decides to use host conditional rendering, the query object is reserved so that it cannot be deleted. Counter events can optionally start reserved, as the threaded implementation can reserve them before the backend creates them, and there would otherwise be a short amount of time where the counter queue could dispose the event before a call to reserve it could be made.
* Address Feedback
* Make counter flush tracked again.
Hopefully does not cause any issues this time.
* Wait for FlushTo on the main queue thread.
Currently assumes only one thread will want to FlushTo (in this case, the GPU thread)
* Add SDL2 headless integration
* Add HLE macro commands.
Co-authored-by: Mary <mary@mary.zone>
2021-08-26 23:31:29 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Whether or not backend threading is enabled. The "Auto" setting will determine whether threading should be enabled at runtime.
|
|
|
|
/// </summary>
|
|
|
|
public BackendThreading BackendThreading { get; set; }
|
|
|
|
|
2020-07-07 03:41:07 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Resolution Scale. An integer scale applied to applicable render targets. Values 1-4, or -1 to use a custom floating point scale instead.
|
|
|
|
/// </summary>
|
|
|
|
public int ResScale { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Custom Resolution Scale. A custom floating point scale applied to applicable render targets. Only active when Resolution Scale is -1.
|
|
|
|
/// </summary>
|
|
|
|
public float ResScaleCustom { get; set; }
|
|
|
|
|
2020-03-30 22:38:52 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Max Anisotropy. Values range from 0 - 16. Set to -1 to let the game decide.
|
|
|
|
/// </summary>
|
|
|
|
public float MaxAnisotropy { get; set; }
|
2020-12-16 02:19:07 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Aspect Ratio applied to the renderer window.
|
|
|
|
/// </summary>
|
|
|
|
public AspectRatio AspectRatio { get; set; }
|
2020-03-30 22:38:52 +01:00
|
|
|
|
2019-02-11 12:00:32 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Dumps shaders in this local directory
|
|
|
|
/// </summary>
|
2019-09-02 17:03:57 +01:00
|
|
|
public string GraphicsShadersDumpPath { get; set; }
|
2019-02-11 12:00:32 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Enables printing debug log messages
|
|
|
|
/// </summary>
|
2019-09-02 17:03:57 +01:00
|
|
|
public bool LoggingEnableDebug { get; set; }
|
2019-02-11 12:00:32 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Enables printing stub log messages
|
|
|
|
/// </summary>
|
2019-09-02 17:03:57 +01:00
|
|
|
public bool LoggingEnableStub { get; set; }
|
2019-02-11 12:00:32 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Enables printing info log messages
|
|
|
|
/// </summary>
|
2019-09-02 17:03:57 +01:00
|
|
|
public bool LoggingEnableInfo { get; set; }
|
2019-02-11 12:00:32 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Enables printing warning log messages
|
|
|
|
/// </summary>
|
2019-09-02 17:03:57 +01:00
|
|
|
public bool LoggingEnableWarn { get; set; }
|
2019-02-11 12:00:32 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Enables printing error log messages
|
|
|
|
/// </summary>
|
2019-09-02 17:03:57 +01:00
|
|
|
public bool LoggingEnableError { get; set; }
|
2022-05-15 12:30:15 +01:00
|
|
|
|
2022-02-18 00:08:07 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Enables printing trace log messages
|
|
|
|
/// </summary>
|
|
|
|
public bool LoggingEnableTrace { get; set; }
|
|
|
|
|
2019-06-16 02:31:18 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Enables printing guest log messages
|
|
|
|
/// </summary>
|
2019-09-02 17:03:57 +01:00
|
|
|
public bool LoggingEnableGuest { get; set; }
|
2019-06-16 02:31:18 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Enables printing FS access log messages
|
|
|
|
/// </summary>
|
2019-09-02 17:03:57 +01:00
|
|
|
public bool LoggingEnableFsAccessLog { get; set; }
|
2019-06-16 02:31:18 +01:00
|
|
|
|
2019-02-11 12:00:32 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Controls which log messages are written to the log targets
|
|
|
|
/// </summary>
|
2019-09-02 17:03:57 +01:00
|
|
|
public LogClass[] LoggingFilteredClasses { get; set; }
|
2019-02-11 12:00:32 +00:00
|
|
|
|
2020-08-02 15:41:24 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Change Graphics API debug log level
|
|
|
|
/// </summary>
|
|
|
|
public GraphicsDebugLevel LoggingGraphicsDebugLevel { get; set; }
|
|
|
|
|
2019-02-11 12:00:32 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Change System Language
|
|
|
|
/// </summary>
|
2019-12-21 19:52:31 +00:00
|
|
|
public Language SystemLanguage { get; set; }
|
2019-02-11 12:00:32 +00:00
|
|
|
|
2020-03-19 22:37:55 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Change System Region
|
|
|
|
/// </summary>
|
|
|
|
public Region SystemRegion { get; set; }
|
|
|
|
|
2020-03-25 22:23:21 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Change System TimeZone
|
|
|
|
/// </summary>
|
|
|
|
public string SystemTimeZone { get; set; }
|
|
|
|
|
2020-04-17 00:18:54 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Change System Time Offset in seconds
|
|
|
|
/// </summary>
|
|
|
|
public long SystemTimeOffset { get; set; }
|
|
|
|
|
2019-02-11 12:00:32 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Enables or disables Docked Mode
|
|
|
|
/// </summary>
|
2019-09-02 17:03:57 +01:00
|
|
|
public bool DockedMode { get; set; }
|
2019-02-11 12:00:32 +00:00
|
|
|
|
2019-05-30 21:27:43 +01:00
|
|
|
/// <summary>
|
2019-07-02 03:39:22 +01:00
|
|
|
/// Enables or disables Discord Rich Presence
|
2019-05-30 21:27:43 +01:00
|
|
|
/// </summary>
|
2019-09-02 17:03:57 +01:00
|
|
|
public bool EnableDiscordIntegration { get; set; }
|
2019-05-30 21:27:43 +01:00
|
|
|
|
2020-09-29 21:05:25 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Checks for updates when Ryujinx starts when enabled
|
|
|
|
/// </summary>
|
|
|
|
public bool CheckUpdatesOnStart { get; set; }
|
|
|
|
|
2021-01-14 22:30:52 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Show "Confirm Exit" Dialog
|
|
|
|
/// </summary>
|
|
|
|
public bool ShowConfirmExit { get; set; }
|
|
|
|
|
2021-02-15 21:48:21 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Hide Cursor on Idle
|
|
|
|
/// </summary>
|
|
|
|
public bool HideCursorOnIdle { get; set; }
|
|
|
|
|
2019-02-11 12:00:32 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Enables or disables Vertical Sync
|
|
|
|
/// </summary>
|
2019-09-02 17:03:57 +01:00
|
|
|
public bool EnableVsync { get; set; }
|
2019-02-11 12:00:32 +00:00
|
|
|
|
2020-11-12 23:15:34 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Enables or disables Shader cache
|
|
|
|
/// </summary>
|
|
|
|
public bool EnableShaderCache { get; set; }
|
|
|
|
|
2019-02-11 12:00:32 +00:00
|
|
|
/// <summary>
|
2021-12-26 14:17:13 +00:00
|
|
|
/// Enables or disables profiled translation cache persistency
|
2019-02-11 12:00:32 +00:00
|
|
|
/// </summary>
|
2021-12-26 14:17:13 +00:00
|
|
|
public bool EnablePtc { get; set; }
|
2019-02-11 12:00:32 +00:00
|
|
|
|
2020-06-16 19:28:02 +01:00
|
|
|
/// <summary>
|
2021-12-26 14:17:13 +00:00
|
|
|
/// Enables or disables guest Internet access
|
2020-06-16 19:28:02 +01:00
|
|
|
/// </summary>
|
2021-12-26 14:17:13 +00:00
|
|
|
public bool EnableInternetAccess { get; set; }
|
2020-06-16 19:28:02 +01:00
|
|
|
|
2019-02-11 12:00:32 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Enables integrity checks on Game content files
|
|
|
|
/// </summary>
|
2019-09-02 17:03:57 +01:00
|
|
|
public bool EnableFsIntegrityChecks { get; set; }
|
2019-02-11 12:00:32 +00:00
|
|
|
|
2019-06-16 02:31:18 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Enables FS access log output to the console. Possible modes are 0-3
|
|
|
|
/// </summary>
|
2019-09-02 17:03:57 +01:00
|
|
|
public int FsGlobalAccessLogMode { get; set; }
|
2019-06-16 02:31:18 +01:00
|
|
|
|
2020-07-04 00:16:49 +01:00
|
|
|
/// <summary>
|
|
|
|
/// The selected audio backend
|
|
|
|
/// </summary>
|
|
|
|
public AudioBackend AudioBackend { get; set; }
|
|
|
|
|
2021-12-23 16:33:56 +00:00
|
|
|
/// <summary>
|
|
|
|
/// The audio volume
|
|
|
|
/// </summary>
|
|
|
|
public float AudioVolume { get; set; }
|
|
|
|
|
POWER - Performance Optimizations With Extensive Ramifications (#2286)
* Refactoring of KMemoryManager class
* Replace some trivial uses of DRAM address with VA
* Get rid of GetDramAddressFromVa
* Abstracting more operations on derived page table class
* Run auto-format on KPageTableBase
* Managed to make TryConvertVaToPa private, few uses remains now
* Implement guest physical pages ref counting, remove manual freeing
* Make DoMmuOperation private and call new abstract methods only from the base class
* Pass pages count rather than size on Map/UnmapMemory
* Change memory managers to take host pointers
* Fix a guest memory leak and simplify KPageTable
* Expose new methods for host range query and mapping
* Some refactoring of MapPagesFromClientProcess to allow proper page ref counting and mapping without KPageLists
* Remove more uses of AddVaRangeToPageList, now only one remains (shared memory page checking)
* Add a SharedMemoryStorage class, will be useful for host mapping
* Sayonara AddVaRangeToPageList, you served us well
* Start to implement host memory mapping (WIP)
* Support memory tracking through host exception handling
* Fix some access violations from HLE service guest memory access and CPU
* Fix memory tracking
* Fix mapping list bugs, including a race and a error adding mapping ranges
* Simple page table for memory tracking
* Simple "volatile" region handle mode
* Update UBOs directly (experimental, rough)
* Fix the overlap check
* Only set non-modified buffers as volatile
* Fix some memory tracking issues
* Fix possible race in MapBufferFromClientProcess (block list updates were not locked)
* Write uniform update to memory immediately, only defer the buffer set.
* Fix some memory tracking issues
* Pass correct pages count on shared memory unmap
* Armeilleure Signal Handler v1 + Unix changes
Unix currently behaves like windows, rather than remapping physical
* Actually check if the host platform is unix
* Fix decommit on linux.
* Implement windows 10 placeholder shared memory, fix a buffer issue.
* Make PTC version something that will never match with master
* Remove testing variable for block count
* Add reference count for memory manager, fix dispose
Can still deadlock with OpenAL
* Add address validation, use page table for mapped check, add docs
Might clean up the page table traversing routines.
* Implement batched mapping/tracking.
* Move documentation, fix tests.
* Cleanup uniform buffer update stuff.
* Remove unnecessary assignment.
* Add unsafe host mapped memory switch
On by default. Would be good to turn this off for untrusted code (homebrew, exefs mods) and give the user the option to turn it on manually, though that requires some UI work.
* Remove C# exception handlers
They have issues due to current .NET limitations, so the meilleure one fully replaces them for now.
* Fix MapPhysicalMemory on the software MemoryManager.
* Null check for GetHostAddress, docs
* Add configuration for setting memory manager mode (not in UI yet)
* Add config to UI
* Fix type mismatch on Unix signal handler code emit
* Fix 6GB DRAM mode.
The size can be greater than `uint.MaxValue` when the DRAM is >4GB.
* Address some feedback.
* More detailed error if backing memory cannot be mapped.
* SetLastError on all OS functions for consistency
* Force pages dirty with UBO update instead of setting them directly.
Seems to be much faster across a few games. Need retesting.
* Rebase, configuration rework, fix mem tracking regression
* Fix race in FreePages
* Set memory managers null after decrementing ref count
* Remove readonly keyword, as this is now modified.
* Use a local variable for the signal handler rather than a register.
* Fix bug with buffer resize, and index/uniform buffer binding.
Should fix flickering in games.
* Add InvalidAccessHandler to MemoryTracking
Doesn't do anything yet
* Call invalid access handler on unmapped read/write.
Same rules as the regular memory manager.
* Make unsafe mapped memory its own MemoryManagerType
* Move FlushUboDirty into UpdateState.
* Buffer dirty cache, rather than ubo cache
Much cleaner, may be reusable for Inline2Memory updates.
* This doesn't return anything anymore.
* Add sigaction remove methods, correct a few function signatures.
* Return empty list of physical regions for size 0.
* Also on AddressSpaceManager
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2021-05-24 21:52:44 +01:00
|
|
|
/// <summary>
|
|
|
|
/// The selected memory manager mode
|
|
|
|
/// </summary>
|
|
|
|
public MemoryManagerMode MemoryManagerMode { get; set; }
|
|
|
|
|
2021-04-04 13:06:59 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Expands the RAM amount on the emulated system from 4GB to 6GB
|
|
|
|
/// </summary>
|
|
|
|
public bool ExpandRam { get; set; }
|
|
|
|
|
2019-04-16 00:22:55 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Enable or disable ignoring missing services
|
|
|
|
/// </summary>
|
2019-09-02 17:03:57 +01:00
|
|
|
public bool IgnoreMissingServices { get; set; }
|
2019-04-16 00:22:55 +01:00
|
|
|
|
2019-09-02 17:03:57 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Used to toggle columns in the GUI
|
|
|
|
/// </summary>
|
2019-11-29 04:32:51 +00:00
|
|
|
public GuiColumns GuiColumns { get; set; }
|
2019-09-02 17:03:57 +01:00
|
|
|
|
2020-06-26 11:30:16 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Used to configure column sort settings in the GUI
|
|
|
|
/// </summary>
|
|
|
|
public ColumnSort ColumnSort { get; set; }
|
|
|
|
|
2019-09-02 17:03:57 +01:00
|
|
|
/// <summary>
|
|
|
|
/// A list of directories containing games to be used to load games into the games list
|
|
|
|
/// </summary>
|
|
|
|
public List<string> GameDirs { get; set; }
|
|
|
|
|
2022-05-15 12:30:15 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Language Code for the UI
|
|
|
|
/// </summary>
|
|
|
|
public string LanguageCode { get; set; }
|
|
|
|
|
2019-09-02 17:03:57 +01:00
|
|
|
/// <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 12:00:32 +00:00
|
|
|
|
2022-05-15 12:30:15 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Chooses the base style // Not Used
|
|
|
|
/// </summary>
|
|
|
|
public string BaseStyle { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Chooses the view mode of the game list // Not Used
|
|
|
|
/// </summary>
|
|
|
|
public int GameListViewMode { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Show application name in Grid Mode // Not Used
|
|
|
|
/// </summary>
|
|
|
|
public bool ShowNames { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Sets App Icon Size // Not Used
|
|
|
|
/// </summary>
|
|
|
|
public int GridSize { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Sorts Apps in the game list // Not Used
|
|
|
|
/// </summary>
|
|
|
|
public int ApplicationSort { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Sets if Grid is ordered in Ascending Order // Not Used
|
|
|
|
/// </summary>
|
|
|
|
public bool IsAscendingOrder { get; set; }
|
|
|
|
|
2020-12-01 22:02:27 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Start games in fullscreen mode
|
|
|
|
/// </summary>
|
|
|
|
public bool StartFullscreen { get; set; }
|
|
|
|
|
2022-03-15 01:35:41 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Show console window
|
|
|
|
/// </summary>
|
|
|
|
public bool ShowConsole { get; set; }
|
|
|
|
|
2019-05-03 00:29:01 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Enable or disable keyboard support (Independent from controllers binding)
|
|
|
|
/// </summary>
|
2019-09-02 17:03:57 +01:00
|
|
|
public bool EnableKeyboard { get; set; }
|
2019-05-03 00:29:01 +01:00
|
|
|
|
2021-06-24 01:09:08 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Enable or disable mouse support (Independent from controllers binding)
|
|
|
|
/// </summary>
|
|
|
|
public bool EnableMouse { get; set; }
|
|
|
|
|
2020-06-26 11:30:16 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Hotkey Keyboard Bindings
|
|
|
|
/// </summary>
|
|
|
|
public KeyboardHotkeys Hotkeys { get; set; }
|
|
|
|
|
2019-02-11 12:00:32 +00:00
|
|
|
/// <summary>
|
2021-04-14 11:28:43 +01:00
|
|
|
/// Legacy keyboard control bindings
|
2019-02-11 12:00:32 +00:00
|
|
|
/// </summary>
|
2021-04-14 11:28:43 +01:00
|
|
|
/// <remarks>Kept for file format compatibility (to avoid possible failure when parsing configuration on old versions)</remarks>
|
|
|
|
/// TODO: Remove this when those older versions aren't in use anymore.
|
|
|
|
public List<object> KeyboardConfig { get; set; }
|
2019-02-11 12:00:32 +00:00
|
|
|
|
|
|
|
/// <summary>
|
2021-04-14 11:28:43 +01:00
|
|
|
/// Legacy controller control bindings
|
2019-02-11 12:00:32 +00:00
|
|
|
/// </summary>
|
2021-04-14 11:28:43 +01:00
|
|
|
/// <remarks>Kept for file format compatibility (to avoid possible failure when parsing configuration on old versions)</remarks>
|
|
|
|
/// TODO: Remove this when those older versions aren't in use anymore.
|
|
|
|
public List<object> ControllerConfig { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Input configurations
|
|
|
|
/// </summary>
|
|
|
|
public List<InputConfig> InputConfig { get; set; }
|
2019-02-11 12:00:32 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Loads a configuration file from disk
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="path">The path to the JSON configuration file</param>
|
2021-02-09 09:24:37 +00:00
|
|
|
public static bool TryLoad(string path, out ConfigurationFileFormat configurationFileFormat)
|
2019-02-11 12:00:32 +00:00
|
|
|
{
|
2021-02-09 09:24:37 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
configurationFileFormat = JsonHelper.DeserializeFromFile<ConfigurationFileFormat>(path);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
catch
|
|
|
|
{
|
|
|
|
configurationFileFormat = null;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2019-02-11 12:00:32 +00:00
|
|
|
}
|
|
|
|
|
2019-09-02 17:03:57 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Save a configuration file to disk
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="path">The path to the JSON configuration file</param>
|
2019-12-21 19:52:31 +00:00
|
|
|
public void SaveConfig(string path)
|
2019-09-02 17:03:57 +01:00
|
|
|
{
|
2021-02-09 09:24:37 +00:00
|
|
|
using FileStream fileStream = File.Create(path, 4096, FileOptions.WriteThrough);
|
|
|
|
JsonHelper.Serialize(fileStream, this, true);
|
2019-02-11 12:00:32 +00:00
|
|
|
}
|
|
|
|
}
|
2021-02-15 21:48:21 +00:00
|
|
|
}
|