diff --git a/Ryujinx.Common/Configuration/LoggerModule.cs b/Ryujinx.Common/Configuration/LoggerModule.cs index f5db0eed92..504a81418f 100644 --- a/Ryujinx.Common/Configuration/LoggerModule.cs +++ b/Ryujinx.Common/Configuration/LoggerModule.cs @@ -25,49 +25,49 @@ namespace Ryujinx.Configuration private static void ReloadEnableDebug(object sender, ReactiveEventArgs e) { - Logger.SetEnable(LogLevel.Debug, e.Value); + Logger.SetEnable(LogLevel.Debug, e.NewValue); } private static void ReloadEnableStub(object sender, ReactiveEventArgs e) { - Logger.SetEnable(LogLevel.Stub, e.Value); + Logger.SetEnable(LogLevel.Stub, e.NewValue); } private static void ReloadEnableInfo(object sender, ReactiveEventArgs e) { - Logger.SetEnable(LogLevel.Info, e.Value); + Logger.SetEnable(LogLevel.Info, e.NewValue); } private static void ReloadEnableWarning(object sender, ReactiveEventArgs e) { - Logger.SetEnable(LogLevel.Warning, e.Value); + Logger.SetEnable(LogLevel.Warning, e.NewValue); } private static void ReloadEnableError(object sender, ReactiveEventArgs e) { - Logger.SetEnable(LogLevel.Error, e.Value); + Logger.SetEnable(LogLevel.Error, e.NewValue); } private static void ReloadEnableGuest(object sender, ReactiveEventArgs e) { - Logger.SetEnable(LogLevel.Guest, e.Value); + Logger.SetEnable(LogLevel.Guest, e.NewValue); } private static void ReloadEnableFsAccessLog(object sender, ReactiveEventArgs e) { - Logger.SetEnable(LogLevel.AccessLog, e.Value); + Logger.SetEnable(LogLevel.AccessLog, e.NewValue); } private static void ReloadFilteredClasses(object sender, ReactiveEventArgs e) { - bool noFilter = e.Value.Length == 0; + bool noFilter = e.NewValue.Length == 0; foreach (var logClass in EnumExtensions.GetValues()) { Logger.SetEnable(logClass, noFilter); } - foreach (var logClass in e.Value) + foreach (var logClass in e.NewValue) { Logger.SetEnable(logClass, true); } @@ -75,20 +75,17 @@ namespace Ryujinx.Configuration private static void ReloadFileLogger(object sender, ReactiveEventArgs e) { - if (e.Value != e.OldValue) + if (e.NewValue) { - if (e.Value) - { - Logger.AddTarget(new AsyncLogTargetWrapper( - new FileLogTarget(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Ryujinx.log"), "file"), - 1000, - AsyncLogTargetOverflowAction.Block - )); - } - else - { - Logger.RemoveTarget("file"); - } + Logger.AddTarget(new AsyncLogTargetWrapper( + new FileLogTarget(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Ryujinx.log"), "file"), + 1000, + AsyncLogTargetOverflowAction.Block + )); + } + else + { + Logger.RemoveTarget("file"); } } diff --git a/Ryujinx.Common/Logging/Logger.cs b/Ryujinx.Common/Logging/Logger.cs index 300ec1308d..15995b0e1e 100644 --- a/Ryujinx.Common/Logging/Logger.cs +++ b/Ryujinx.Common/Logging/Logger.cs @@ -54,7 +54,7 @@ namespace Ryujinx.Common.Logging { foreach (var target in m_LogTargets) { - if (target.GetName().Equals(targetName)) + if (target.Name.Equals(targetName)) { return target; } diff --git a/Ryujinx.Common/Logging/Targets/AsyncLogTargetWrapper.cs b/Ryujinx.Common/Logging/Targets/AsyncLogTargetWrapper.cs index f8efd7b252..cab3f8c18e 100644 --- a/Ryujinx.Common/Logging/Targets/AsyncLogTargetWrapper.cs +++ b/Ryujinx.Common/Logging/Targets/AsyncLogTargetWrapper.cs @@ -27,6 +27,8 @@ namespace Ryujinx.Common.Logging private readonly int _overflowTimeout; + string ILogTarget.Name { get => _target.Name; set => throw new NotImplementedException(); } + public AsyncLogTargetWrapper(ILogTarget target) : this(target, -1, AsyncLogTargetOverflowAction.Block) { } @@ -72,10 +74,5 @@ namespace Ryujinx.Common.Logging _messageQueue.CompleteAdding(); _messageThread.Join(); } - - public string GetName() - { - return _target.GetName(); - } } } \ No newline at end of file diff --git a/Ryujinx.Common/Logging/Targets/ConsoleLogTarget.cs b/Ryujinx.Common/Logging/Targets/ConsoleLogTarget.cs index 6b04dd820c..9c669ccea7 100644 --- a/Ryujinx.Common/Logging/Targets/ConsoleLogTarget.cs +++ b/Ryujinx.Common/Logging/Targets/ConsoleLogTarget.cs @@ -11,6 +11,8 @@ namespace Ryujinx.Common.Logging private readonly string _name; + string ILogTarget.Name { get => _name; set => throw new NotImplementedException(); } + static ConsoleLogTarget() { _logColors = new ConcurrentDictionary { @@ -47,10 +49,5 @@ namespace Ryujinx.Common.Logging { Console.ResetColor(); } - - public string GetName() - { - return _name; - } } } diff --git a/Ryujinx.Common/Logging/Targets/FileLogTarget.cs b/Ryujinx.Common/Logging/Targets/FileLogTarget.cs index 16d1c74d26..3a3d2e19b1 100644 --- a/Ryujinx.Common/Logging/Targets/FileLogTarget.cs +++ b/Ryujinx.Common/Logging/Targets/FileLogTarget.cs @@ -1,4 +1,5 @@ -using System.IO; +using System; +using System.IO; using System.Text; namespace Ryujinx.Common.Logging @@ -11,6 +12,8 @@ namespace Ryujinx.Common.Logging private readonly ILogFormatter _formatter; private readonly string _name; + string ILogTarget.Name { get => _name; set => throw new NotImplementedException(); } + public FileLogTarget(string path, string name) : this(path, name, FileShare.Read, FileMode.Append) { } @@ -34,10 +37,5 @@ namespace Ryujinx.Common.Logging _logWriter.Flush(); _logWriter.Dispose(); } - - public string GetName() - { - return _name; - } } } diff --git a/Ryujinx.Common/Logging/Targets/ILogTarget.cs b/Ryujinx.Common/Logging/Targets/ILogTarget.cs index cee1705942..2f9a77f2ab 100644 --- a/Ryujinx.Common/Logging/Targets/ILogTarget.cs +++ b/Ryujinx.Common/Logging/Targets/ILogTarget.cs @@ -6,6 +6,6 @@ namespace Ryujinx.Common.Logging { void Log(object sender, LogEventArgs args); - string GetName(); + string Name { get; protected set; } } } diff --git a/Ryujinx.Common/Logging/Targets/JsonLogTarget.cs b/Ryujinx.Common/Logging/Targets/JsonLogTarget.cs index 1b7cb1a7fd..3d88a0a6dd 100644 --- a/Ryujinx.Common/Logging/Targets/JsonLogTarget.cs +++ b/Ryujinx.Common/Logging/Targets/JsonLogTarget.cs @@ -1,4 +1,5 @@ -using System.IO; +using System; +using System.IO; using Utf8Json; namespace Ryujinx.Common.Logging @@ -9,6 +10,8 @@ namespace Ryujinx.Common.Logging private bool _leaveOpen; private string _name; + string ILogTarget.Name { get => _name; set => throw new NotImplementedException(); } + public JsonLogTarget(Stream stream, string name) { _stream = stream; @@ -33,10 +36,5 @@ namespace Ryujinx.Common.Logging _stream.Dispose(); } } - - public string GetName() - { - return _name; - } } } diff --git a/Ryujinx.Common/ReactiveObject.cs b/Ryujinx.Common/ReactiveObject.cs index 6fa18d3e1a..8a22ac3627 100644 --- a/Ryujinx.Common/ReactiveObject.cs +++ b/Ryujinx.Common/ReactiveObject.cs @@ -46,12 +46,12 @@ namespace Ryujinx.Common public class ReactiveEventArgs { public T OldValue { get; private set; } - public T Value { get; private set; } + public T NewValue { get; private set; } - public ReactiveEventArgs(T oldValue, T value) + public ReactiveEventArgs(T oldValue, T newValue) { OldValue = oldValue; - Value = value; + NewValue = newValue; } } } diff --git a/Ryujinx/Configuration/DiscordIntegrationModule.cs b/Ryujinx/Configuration/DiscordIntegrationModule.cs index 0be422ead0..6ca8b44404 100644 --- a/Ryujinx/Configuration/DiscordIntegrationModule.cs +++ b/Ryujinx/Configuration/DiscordIntegrationModule.cs @@ -31,7 +31,7 @@ namespace Ryujinx.Configuration private static void Update(object sender, ReactiveEventArgs e) { - if (e.OldValue != e.Value) + if (e.OldValue != e.NewValue) { // If the integration was active, disable it and unload everything if (e.OldValue) @@ -42,7 +42,7 @@ namespace Ryujinx.Configuration } // If we need to activate it and the client isn't active, initialize it - if (e.Value && DiscordClient == null) + if (e.NewValue && DiscordClient == null) { DiscordClient = new DiscordRpcClient("568815339807309834"); @@ -81,7 +81,7 @@ namespace Ryujinx.Configuration DiscordPresence.State = state; DiscordPresence.Assets.LargeImageText = titleName; DiscordPresence.Assets.SmallImageKey = "ryujinx"; - DiscordPresence.Assets.SmallImageText = "Ryujinx is an emulator for the Nintendo Switch"; + DiscordPresence.Assets.SmallImageText = "Ryujinx is a Nintendo Switch emulator"; DiscordPresence.Timestamps = new Timestamps(DateTime.UtcNow); DiscordClient?.SetPresence(DiscordPresence);