Run code cleanup

This commit is contained in:
ema
2025-05-04 14:26:27 +08:00
parent ff4c9df9a2
commit 34a361e84a
20 changed files with 2963 additions and 2963 deletions

View File

@@ -62,6 +62,6 @@ internal class FocusMonitor
internal static FocusMonitor GetInstance() internal static FocusMonitor GetInstance()
{ {
return _instance ?? (_instance = new FocusMonitor()); return _instance ??= new FocusMonitor();
} }
} }

View File

@@ -43,11 +43,11 @@ internal class KeystrokeDispatcher : IDisposable
{ {
InstallKeyHook(KeyDownEventHandler, KeyUpEventHandler); InstallKeyHook(KeyDownEventHandler, KeyUpEventHandler);
_validKeys = new HashSet<Keys>( _validKeys =
[ [
Keys.Up, Keys.Down, Keys.Left, Keys.Right, Keys.Up, Keys.Down, Keys.Left, Keys.Right,
Keys.Enter, Keys.Space, Keys.Escape Keys.Enter, Keys.Space, Keys.Escape
]); ];
} }
public void Dispose() public void Dispose()

View File

@@ -83,7 +83,7 @@ internal static class QuickLook
internal static string GetCurrentSelection() internal static string GetCurrentSelection()
{ {
StringBuilder sb = new StringBuilder(MaxPath); StringBuilder sb = new(MaxPath);
// communicate with COM in a separate STA thread // communicate with COM in a separate STA thread
var thread = new Thread(() => var thread = new Thread(() =>
{ {
@@ -107,7 +107,7 @@ internal static class QuickLook
// We got a quoted string which breaks ResolveShortcut // We got a quoted string which breaks ResolveShortcut
sb = sb.Replace("\"", string.Empty, 0, 1).Replace("\"", string.Empty, sb.Length - 1, 1); sb = sb.Replace("\"", string.Empty, 0, 1).Replace("\"", string.Empty, sb.Length - 1, 1);
} }
return ResolveShortcut(sb?.ToString() ?? String.Empty); return ResolveShortcut(sb?.ToString() ?? string.Empty);
} }
private static string ResolveShortcut(string path) private static string ResolveShortcut(string path)