Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
emoacht committed Mar 26, 2021
1 parent 02fc5dc commit f196936
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Source/Monitorian.Core/Helper/ArraySearch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static int GetNearestIndex(byte[] array, byte target) =>

public static int GetNearestIndex<T>(T[] array, T target, Func<T, T, T> measure) where T : IComparable
{
if ((array is null) || (array.Length == 0))
if (array is null or { Length: 0 })
throw new ArgumentNullException(nameof(array));

// The source array must be sorted beforehand.
Expand Down
2 changes: 1 addition & 1 deletion Source/Monitorian.Core/Models/Monitor/IMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class AccessResult
public AccessStatus Status { get; }
public string Message { get; }

public AccessResult(AccessStatus status, string message) => (Status, Message) = (status, message);
public AccessResult(AccessStatus status, string message) => (this.Status, this.Message) = (status, message);

public static readonly AccessResult Succeeded = new(AccessStatus.Succeeded, null);
public static readonly AccessResult Failed = new(AccessStatus.Failed, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,6 @@ public class PowerSettingChangedEventArgs : EventArgs
public Guid Guid { get; }
public int Data { get; }

public PowerSettingChangedEventArgs(Guid guid, int data) => (Guid, Data) = (guid, data);
public PowerSettingChangedEventArgs(Guid guid, int data) => (this.Guid, this.Data) = (guid, data);
}
}
4 changes: 2 additions & 2 deletions Source/Monitorian.Core/ViewModels/MonitorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ public string Message

var reason = _monitor switch
{
DdcMonitorItem _ => Resources.StatusReasonDdcFailing,
UnreachableMonitorItem { IsInternal: false } _ => Resources.StatusReasonDdcNotEnabled,
DdcMonitorItem => Resources.StatusReasonDdcFailing,
UnreachableMonitorItem { IsInternal: false } => Resources.StatusReasonDdcNotEnabled,
_ => null,
};

Expand Down
3 changes: 1 addition & 2 deletions Source/Monitorian.Supplement/UIInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ public static bool IsLightThemeUsed()

using var key = Registry.CurrentUser.OpenSubKey(keyName);

return (key?.GetValue(valueName) is int value)
&& (value == 1);
return (key?.GetValue(valueName) is 1);
}

private static readonly object _lock = new object();
Expand Down

0 comments on commit f196936

Please sign in to comment.