diff options
author | sr55 <[email protected]> | 2021-02-20 15:10:49 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2021-02-20 15:10:49 +0000 |
commit | 3f431102f7ba0184a18be805deb5e1bd749c1dd5 (patch) | |
tree | 2b2b8728aa1c22dfb658dfe5b383ab7132562199 /win/CS | |
parent | ec04633356d5519bd6f8b66c9ecb357999532978 (diff) |
WinGui: Fix a number of code warnings.
Diffstat (limited to 'win/CS')
-rw-r--r-- | win/CS/HandBrake.Worker/Logging/LogHandler.cs | 2 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/App.xaml.cs | 4 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Commands/OpenPresetManagerCommand.cs | 19 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs | 2 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Instance/RemoteInstance.cs | 4 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Logging/LogService.cs | 2 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Utilities/EnumHelper.cs | 4 |
7 files changed, 25 insertions, 12 deletions
diff --git a/win/CS/HandBrake.Worker/Logging/LogHandler.cs b/win/CS/HandBrake.Worker/Logging/LogHandler.cs index 7752be874..4055ae2d2 100644 --- a/win/CS/HandBrake.Worker/Logging/LogHandler.cs +++ b/win/CS/HandBrake.Worker/Logging/LogHandler.cs @@ -24,8 +24,6 @@ namespace HandBrake.Worker.Logging public class LogHandler : ILogHandler { - private readonly string logFile; - private readonly object lockObject = new object(); private readonly object fileWriterLock = new object(); diff --git a/win/CS/HandBrakeWPF/App.xaml.cs b/win/CS/HandBrakeWPF/App.xaml.cs index 23d6817c9..c393dd512 100644 --- a/win/CS/HandBrakeWPF/App.xaml.cs +++ b/win/CS/HandBrakeWPF/App.xaml.cs @@ -167,14 +167,14 @@ namespace HandBrakeWPF {
HandBrakeInstanceManager.Init(noHardware);
}
- catch (Exception exception)
+ catch (Exception)
{
if (!noHardware)
{
MessageBox.Show(HandBrakeWPF.Properties.Resources.Startup_InitFailed, HandBrakeWPF.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
}
- throw exception;
+ throw;
}
// Initialise the GUI
diff --git a/win/CS/HandBrakeWPF/Commands/OpenPresetManagerCommand.cs b/win/CS/HandBrakeWPF/Commands/OpenPresetManagerCommand.cs index 27e36b80e..c85792228 100644 --- a/win/CS/HandBrakeWPF/Commands/OpenPresetManagerCommand.cs +++ b/win/CS/HandBrakeWPF/Commands/OpenPresetManagerCommand.cs @@ -1,7 +1,15 @@ -using System; +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="OpenPresetManagerCommand.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Defines the OpenPresetManagerCommand type. +// </summary> +// -------------------------------------------------------------------------------------------------------------------- namespace HandBrakeWPF.Commands { + using System; using System.Windows.Input; using Caliburn.Micro; @@ -10,6 +18,9 @@ namespace HandBrakeWPF.Commands public class OpenPresetManagerCommand : ICommand { +#nullable enable + public event EventHandler? CanExecuteChanged; + public bool CanExecute(object? parameter) { return true; @@ -21,6 +32,10 @@ namespace HandBrakeWPF.Commands viewModel.OpenPresetWindow(); } - public event EventHandler? CanExecuteChanged; + protected virtual void OnCanExecuteChanged() + { + this.CanExecuteChanged?.Invoke(this, EventArgs.Empty); + } +#nullable disable } } diff --git a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs index de04afc1d..99751c2b2 100644 --- a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs +++ b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs @@ -309,7 +309,7 @@ namespace HandBrakeWPF.Helpers return default(DateTime);
}
- throw e;
+ throw;
}
}
}
diff --git a/win/CS/HandBrakeWPF/Instance/RemoteInstance.cs b/win/CS/HandBrakeWPF/Instance/RemoteInstance.cs index 4bb52683c..14f88a221 100644 --- a/win/CS/HandBrakeWPF/Instance/RemoteInstance.cs +++ b/win/CS/HandBrakeWPF/Instance/RemoteInstance.cs @@ -79,7 +79,7 @@ namespace HandBrakeWPF.Instance } } - public async void StartEncode(JsonEncodeObject jobToStart) + public void StartEncode(JsonEncodeObject jobToStart) { if (this.IsServerRunning()) { @@ -264,7 +264,7 @@ namespace HandBrakeWPF.Instance response = await this.MakeHttpGetRequest("PollEncodeProgress"); } - catch (Exception e) + catch (Exception) { retryCount = this.retryCount + 1; } diff --git a/win/CS/HandBrakeWPF/Services/Logging/LogService.cs b/win/CS/HandBrakeWPF/Services/Logging/LogService.cs index bc416bb6e..7abcf69a7 100644 --- a/win/CS/HandBrakeWPF/Services/Logging/LogService.cs +++ b/win/CS/HandBrakeWPF/Services/Logging/LogService.cs @@ -144,7 +144,7 @@ namespace HandBrakeWPF.Services.Logging return log; } - public async void Reset() + public void Reset() { lock (this.lockObject) { diff --git a/win/CS/HandBrakeWPF/Utilities/EnumHelper.cs b/win/CS/HandBrakeWPF/Utilities/EnumHelper.cs index fd19a1cf0..aeb7dfd12 100644 --- a/win/CS/HandBrakeWPF/Utilities/EnumHelper.cs +++ b/win/CS/HandBrakeWPF/Utilities/EnumHelper.cs @@ -143,7 +143,7 @@ namespace HandBrakeWPF.Utilities return string.Empty; } - public static T GetAttribute<T, TK>(TK value) where T : Attribute + public static TH GetAttribute<TH, TK>(TK value) where TH : Attribute { if (value == null) { @@ -153,7 +153,7 @@ namespace HandBrakeWPF.Utilities FieldInfo fieldInfo = value.GetType().GetField(value.ToString()); if (fieldInfo != null) { - T[] attributes = (T[])fieldInfo.GetCustomAttributes(typeof(T), false); + TH[] attributes = (TH[])fieldInfo.GetCustomAttributes(typeof(TH), false); return (attributes.Length > 0) ? attributes[0] : null; } |