From eed0c53e9c2eed5ab4320f6cb0ce47ed2ca39e7f Mon Sep 17 00:00:00 2001 From: ema Date: Sun, 25 May 2025 03:45:07 +0800 Subject: [PATCH] Code Cleanup --- .../RecycleBinPanel.xaml.cs | 2 +- .../QuickLook.Plugin.CLSIDViewer/ThisPCPanel.xaml.cs | 2 +- .../QuickLook.Plugin.TextViewer/TextViewerPanel.cs | 10 +++++----- .../AudioTrack/MidiPlayer.cs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/RecycleBinPanel.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/RecycleBinPanel.xaml.cs index 147659b..651ded6 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/RecycleBinPanel.xaml.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/RecycleBinPanel.xaml.cs @@ -38,7 +38,7 @@ namespace QuickLook.Plugin.CLSIDViewer; public partial class RecycleBinPanel : UserControl, INotifyPropertyChanged { - private ContextObject _context; + private readonly ContextObject _context; private RecycleBinHelper.RecycleBinInfo _info; private ICommand _emptyRecycleBinCommand; diff --git a/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/ThisPCPanel.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/ThisPCPanel.xaml.cs index 318ff14..ad70c94 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/ThisPCPanel.xaml.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.CLSIDViewer/ThisPCPanel.xaml.cs @@ -23,7 +23,7 @@ namespace QuickLook.Plugin.CLSIDViewer; public partial class ThisPCPanel : UserControl { - private ContextObject _context; + private readonly ContextObject _context; public ThisPCPanel(ContextObject context) { diff --git a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.cs b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.cs index 92735cd..e1d062a 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/TextViewerPanel.cs @@ -99,7 +99,7 @@ public class TextViewerPanel : TextEditor, IDisposable e.TranslationBehavior = new InertiaTranslationBehavior { InitialVelocity = e.InitialVelocities.LinearVelocity, - DesiredDeceleration = 10.0 * 96.0 / (1000.0 * 1000.0) + DesiredDeceleration = 10d * 96d / (1000d * 1000d) }; } @@ -148,10 +148,10 @@ public class TextViewerPanel : TextEditor, IDisposable private void LoadFileAsync(string path) { - Task.Run(() => + _ = Task.Run(() => { const int maxLength = 5 * 1024 * 1024; - const int maxHighlightingLength = (int)(0.5 * 1024 * 1024); + const int maxHighlightingLength = (int)(0.5d * 1024 * 1024); var buffer = new MemoryStream(); bool fileTooLong; @@ -187,7 +187,7 @@ public class TextViewerPanel : TextEditor, IDisposable if (_disposed) return; - Dispatcher.BeginInvoke(new Action(() => + Dispatcher.BeginInvoke(() => { Encoding = encoding; SyntaxHighlighting = bufferCopy.Length > maxHighlightingLength @@ -196,7 +196,7 @@ public class TextViewerPanel : TextEditor, IDisposable Document = doc; _context.IsBusy = false; - }), DispatcherPriority.Render); + }, DispatcherPriority.Render); }); } } diff --git a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/AudioTrack/MidiPlayer.cs b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/AudioTrack/MidiPlayer.cs index 8eef58c..b499af1 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/AudioTrack/MidiPlayer.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/AudioTrack/MidiPlayer.cs @@ -34,8 +34,8 @@ namespace QuickLook.Plugin.VideoViewer.AudioTrack; internal class MidiPlayer : IDisposable, INotifyPropertyChanged { - private ViewerPanel _vp; private ContextObject _context; + private ViewerPanel _vp; private MidiFile _midiFile; private OutputDevice _outputDevice; private Playback _playback;