1
0
mirror of synced 2024-11-23 16:23:50 +00:00

Fixed ReSharper code issues

This commit is contained in:
Mark van Renswoude 2021-03-08 20:27:17 +01:00
parent 543b55f3ba
commit df57d665bf
13 changed files with 28 additions and 19 deletions

View File

@ -1,7 +1,6 @@
using System; using System;
using System.Windows.Controls; using System.Windows.Controls;
using AudioSwitcher.AudioApi; using AudioSwitcher.AudioApi;
using MassiveKnob.Plugin.CoreAudio.OSD;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace MassiveKnob.Plugin.CoreAudio.GetDefault namespace MassiveKnob.Plugin.CoreAudio.GetDefault
@ -93,9 +92,11 @@ namespace MassiveKnob.Plugin.CoreAudio.GetDefault
if (playbackDevice == null) if (playbackDevice == null)
return; return;
// ReSharper disable ArrangeRedundantParentheses - maybe, but way easier to read
var isDefault = (settings.Playback && playbackDevice.IsDefaultDevice) || var isDefault = (settings.Playback && playbackDevice.IsDefaultDevice) ||
(settings.Communications && playbackDevice.IsDefaultCommunicationsDevice); (settings.Communications && playbackDevice.IsDefaultCommunicationsDevice);
// ReSharper restore ArrangeRedundantParentheses
actionContext.SetDigitalOutput(settings.Inverted ? !isDefault : isDefault); actionContext.SetDigitalOutput(settings.Inverted ? !isDefault : isDefault);
} }
} }

View File

@ -43,6 +43,16 @@ namespace MassiveKnob.Plugin.SerialDevice.Worker
public void Dispose() public void Dispose()
{ {
IMINProtocol instance;
lock (minProtocolLock)
{
instance = minProtocol;
}
if (instance != null)
Task.WaitAny(new [] { instance.QueueFrame((byte) MassiveKnobFrameID.Quit, Array.Empty<byte>()) }, 500);
Disconnect(); Disconnect();
} }

View File

@ -1,6 +1,4 @@
using System; namespace MassiveKnob.Plugin.VoiceMeeter.Base
namespace MassiveKnob.Plugin.VoiceMeeter.Base
{ {
/// <summary> /// <summary>
/// Interaction logic for BaseVoiceMeeterSettingsView.xaml /// Interaction logic for BaseVoiceMeeterSettingsView.xaml

View File

@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Runtime.Remoting.Channels;
using System.Windows.Controls; using System.Windows.Controls;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Voicemeeter; using Voicemeeter;

View File

@ -142,7 +142,7 @@ namespace MassiveKnob.Plugin.VoiceMeeter
public void Dispose() public void Dispose()
{ {
InstanceRegister.RemoveParameterSubscriber(action); RemoveParameterSubscriber(action);
} }
} }
} }

View File

@ -1,5 +1,4 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following

View File

@ -1,5 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Controls; using System.Windows.Controls;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;

View File

@ -5,7 +5,7 @@ using MassiveKnob.Plugin.VoiceMeeter.Base;
namespace MassiveKnob.Plugin.VoiceMeeter.RunMacro namespace MassiveKnob.Plugin.VoiceMeeter.RunMacro
{ {
public class VoiceMeeterRunMacroActionSettingsViewModel : BaseVoiceMeeterSettingsViewModel<VoiceMeeterRunMacroActionSettings>, IDisposable public class VoiceMeeterRunMacroActionSettingsViewModel : BaseVoiceMeeterSettingsViewModel<VoiceMeeterRunMacroActionSettings>
{ {
private readonly Subject<bool> throttledScriptChanged = new Subject<bool>(); private readonly Subject<bool> throttledScriptChanged = new Subject<bool>();
private readonly IDisposable scriptChangedSubscription; private readonly IDisposable scriptChangedSubscription;

View File

@ -4,4 +4,6 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OSD/@EntryIndexedValue">OSD</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OSD/@EntryIndexedValue">OSD</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SOF/@EntryIndexedValue">SOF</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SOF/@EntryIndexedValue">SOF</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=UI/@EntryIndexedValue">UI</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=UI/@EntryIndexedValue">UI</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=OSD/@EntryIndexedValue">OSD</s:String></wpf:ResourceDictionary> <s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=OSD/@EntryIndexedValue">OSD</s:String>
<s:Boolean x:Key="/Default/Housekeeping/ExcludedProjects/ProjectMasksToIgnore/=Voicemeeter/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/Housekeeping/ExcludedProjects/ProjectMasksToIgnore/=Voicemeeter_002Ecsproj/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
@ -278,6 +277,7 @@ namespace MassiveKnob.Core
private class PluginMetadata private class PluginMetadata
{ {
// ReSharper disable once UnusedAutoPropertyAccessor.Local - for JSON deserialization
public string EntryAssembly { get; set; } public string EntryAssembly { get; set; }
} }
} }

View File

@ -1,5 +1,4 @@
using System; using Serilog.Core;
using Serilog.Core;
using Serilog.Events; using Serilog.Events;
namespace MassiveKnob.Settings namespace MassiveKnob.Settings

View File

@ -174,7 +174,7 @@ namespace MassiveKnob.ViewModel
.Throttle(TimeSpan.FromMilliseconds(250)) .Throttle(TimeSpan.FromMilliseconds(250))
.Subscribe(b => .Subscribe(b =>
{ {
orchestrator?.UpdateDigitalToAnalogSettings(index, settings => orchestrator.UpdateDigitalToAnalogSettings(index, settings =>
{ {
settings.OnValue = digitalToAnalogOn; settings.OnValue = digitalToAnalogOn;
settings.OffValue = digitalToAnalogOff; settings.OffValue = digitalToAnalogOff;

View File

@ -48,8 +48,8 @@ namespace MassiveKnob.ViewModel
private IEnumerable<InputOutputViewModel> analogOutputs; private IEnumerable<InputOutputViewModel> analogOutputs;
private IEnumerable<InputOutputViewModel> digitalOutputs; private IEnumerable<InputOutputViewModel> digitalOutputs;
private IDisposable activeDeviceSubscription; private readonly IDisposable activeDeviceSubscription;
private IDisposable deviceStatusSubscription; private readonly IDisposable deviceStatusSubscription;
// ReSharper disable UnusedMember.Global - used by WPF Binding // ReSharper disable UnusedMember.Global - used by WPF Binding
public SettingsMenuItem SelectedMenuItem public SettingsMenuItem SelectedMenuItem
@ -393,7 +393,7 @@ namespace MassiveKnob.ViewModel
new LoggingLevelViewModel(LogEventLevel.Error, Strings.LoggingLevelError, Strings.LoggingLevelErrorDescription), new LoggingLevelViewModel(LogEventLevel.Error, Strings.LoggingLevelError, Strings.LoggingLevelErrorDescription),
new LoggingLevelViewModel(LogEventLevel.Warning, Strings.LoggingLevelWarning, Strings.LoggingLevelWarningDescription), new LoggingLevelViewModel(LogEventLevel.Warning, Strings.LoggingLevelWarning, Strings.LoggingLevelWarningDescription),
new LoggingLevelViewModel(LogEventLevel.Information, Strings.LoggingLevelInformation, Strings.LoggingLevelInformationDescription), new LoggingLevelViewModel(LogEventLevel.Information, Strings.LoggingLevelInformation, Strings.LoggingLevelInformationDescription),
new LoggingLevelViewModel(LogEventLevel.Verbose, Strings.LoggingLevelVerbose, Strings.LoggingLevelVerboseDescription), new LoggingLevelViewModel(LogEventLevel.Verbose, Strings.LoggingLevelVerbose, Strings.LoggingLevelVerboseDescription)
}; };
selectedLoggingLevel = LoggingLevels.SingleOrDefault(l => l.Level == logSettings.Level) selectedLoggingLevel = LoggingLevels.SingleOrDefault(l => l.Level == logSettings.Level)
@ -415,6 +415,9 @@ namespace MassiveKnob.ViewModel
DisposeInputOutputViewModels(DigitalInputs); DisposeInputOutputViewModels(DigitalInputs);
DisposeInputOutputViewModels(AnalogOutputs); DisposeInputOutputViewModels(AnalogOutputs);
DisposeInputOutputViewModels(DigitalOutputs); DisposeInputOutputViewModels(DigitalOutputs);
activeDeviceSubscription?.Dispose();
deviceStatusSubscription?.Dispose();
} }