mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-14 12:19:08 +00:00
Code Cleanup
This commit is contained in:
@@ -8,13 +8,6 @@
|
||||
FontSize="14"
|
||||
UseLayoutRounding="True"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/QuickLook.Common;component/Styles/MainWindowStyles.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="15" />
|
||||
|
@@ -35,9 +35,6 @@ public partial class MsiInfoPanel : UserControl, IAppInfoPanel
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// apply global theme
|
||||
Resources.MergedDictionaries[0].Clear();
|
||||
|
||||
string translationFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Translations.config");
|
||||
productNameTitle.Text = TranslationHelper.Get("PRODUCT_NAME", translationFile);
|
||||
productVersionTitle.Text = TranslationHelper.Get("PRODUCT_VERSION", translationFile);
|
||||
|
@@ -44,13 +44,13 @@ internal static class WindowsThumbnailProvider
|
||||
private static extern int SHCreateItemFromParsingName(
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string path,
|
||||
// The following parameter is not used - binding context.
|
||||
IntPtr pbc,
|
||||
nint pbc,
|
||||
ref Guid riid,
|
||||
[MarshalAs(UnmanagedType.Interface)] out IShellItem shellItem);
|
||||
|
||||
[DllImport("gdi32.dll")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
private static extern bool DeleteObject(IntPtr hObject);
|
||||
private static extern bool DeleteObject(nint hObject);
|
||||
|
||||
public static Bitmap GetThumbnail(string fileName, int width, int height, ThumbnailOptions options)
|
||||
{
|
||||
@@ -71,7 +71,7 @@ internal static class WindowsThumbnailProvider
|
||||
}
|
||||
}
|
||||
|
||||
internal static Bitmap GetBitmapFromHBitmap(IntPtr nativeHBitmap)
|
||||
internal static Bitmap GetBitmapFromHBitmap(nint nativeHBitmap)
|
||||
{
|
||||
var bmp = Image.FromHbitmap(nativeHBitmap);
|
||||
|
||||
@@ -115,7 +115,7 @@ internal static class WindowsThumbnailProvider
|
||||
return srcBitmap;
|
||||
}
|
||||
|
||||
private static IntPtr GetHBitmap(string fileName, int width, int height, ThumbnailOptions options)
|
||||
private static nint GetHBitmap(string fileName, int width, int height, ThumbnailOptions options)
|
||||
{
|
||||
var shellItem2Guid = new Guid(IShellItem2Guid);
|
||||
var retCode =
|
||||
@@ -142,18 +142,18 @@ internal static class WindowsThumbnailProvider
|
||||
[Guid("43826d1e-e718-42ee-bc55-a1e261c37bfe")]
|
||||
internal interface IShellItem
|
||||
{
|
||||
void BindToHandler(IntPtr pbc,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid bhid,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid riid,
|
||||
out IntPtr ppv);
|
||||
public void BindToHandler(nint pbc,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid bhid,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid riid,
|
||||
out nint ppv);
|
||||
|
||||
void GetParent(out IShellItem ppsi);
|
||||
public void GetParent(out IShellItem ppsi);
|
||||
|
||||
void GetDisplayName(SIGDN sigdnName, out IntPtr ppszName);
|
||||
public void GetDisplayName(SIGDN sigdnName, out nint ppszName);
|
||||
|
||||
void GetAttributes(uint sfgaoMask, out uint psfgaoAttribs);
|
||||
public void GetAttributes(uint sfgaoMask, out uint psfgaoAttribs);
|
||||
|
||||
void Compare(IShellItem psi, uint hint, out int piOrder);
|
||||
public void Compare(IShellItem psi, uint hint, out int piOrder);
|
||||
}
|
||||
|
||||
internal enum SIGDN : uint
|
||||
@@ -165,7 +165,7 @@ internal static class WindowsThumbnailProvider
|
||||
PARENTRELATIVEEDITING = 0x80031001,
|
||||
DESKTOPABSOLUTEEDITING = 0x8004c000,
|
||||
FILESYSPATH = 0x80058000,
|
||||
URL = 0x80068000
|
||||
URL = 0x80068000,
|
||||
}
|
||||
|
||||
internal enum HResult
|
||||
@@ -182,7 +182,7 @@ internal static class WindowsThumbnailProvider
|
||||
Win32ErrorCanceled = 1223,
|
||||
Canceled = unchecked((int)0x800704C7),
|
||||
ResourceInUse = unchecked((int)0x800700AA),
|
||||
AccessDenied = unchecked((int)0x80030005)
|
||||
AccessDenied = unchecked((int)0x80030005),
|
||||
}
|
||||
|
||||
[ComImport]
|
||||
@@ -191,10 +191,10 @@ internal static class WindowsThumbnailProvider
|
||||
internal interface IShellItemImageFactory
|
||||
{
|
||||
[PreserveSig]
|
||||
HResult GetImage(
|
||||
public HResult GetImage(
|
||||
[In][MarshalAs(UnmanagedType.Struct)] NativeSize size,
|
||||
[In] ThumbnailOptions flags,
|
||||
[Out] out IntPtr phbm);
|
||||
[Out] out nint phbm);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
|
@@ -20,9 +20,6 @@ using System.Windows.Controls;
|
||||
|
||||
namespace QuickLook.Plugin.ArchiveViewer;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for ArchiveFileListView.xaml
|
||||
/// </summary>
|
||||
public partial class ArchiveFileListView : UserControl, IDisposable
|
||||
{
|
||||
public ArchiveFileListView()
|
||||
|
@@ -32,9 +32,6 @@ using System.Windows.Controls;
|
||||
|
||||
namespace QuickLook.Plugin.ArchiveViewer;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for ArchiveInfoPanel.xaml
|
||||
/// </summary>
|
||||
public partial class ArchiveInfoPanel : UserControl, IDisposable, INotifyPropertyChanged
|
||||
{
|
||||
private readonly Dictionary<string, ArchiveFileEntry> _fileEntries = [];
|
||||
|
@@ -196,7 +196,7 @@ public static class IconManager
|
||||
public const uint FileAttributeDirectory = 0x00000010;
|
||||
|
||||
[DllImport("Shell32.dll")]
|
||||
public static extern IntPtr SHGetFileInfo(
|
||||
public static extern nint SHGetFileInfo(
|
||||
string pszPath,
|
||||
uint dwFileAttributes,
|
||||
ref Shfileinfo psfi,
|
||||
@@ -208,7 +208,7 @@ public static class IconManager
|
||||
public struct Shfileinfo
|
||||
{
|
||||
private const int Namesize = 80;
|
||||
public readonly IntPtr hIcon;
|
||||
public readonly nint hIcon;
|
||||
private readonly int iIcon;
|
||||
private readonly uint dwAttributes;
|
||||
|
||||
@@ -232,6 +232,6 @@ public static class IconManager
|
||||
/// <param name="hIcon">Pointer to icon handle.</param>
|
||||
/// <returns>N/A</returns>
|
||||
[DllImport("User32.dll")]
|
||||
public static extern int DestroyIcon(IntPtr hIcon);
|
||||
public static extern int DestroyIcon(nint hIcon);
|
||||
}
|
||||
}
|
||||
|
@@ -31,9 +31,6 @@ using UtfUnknown;
|
||||
|
||||
namespace QuickLook.Plugin.CsvViewer;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for CsvViewerPanel.xaml
|
||||
/// </summary>
|
||||
public partial class CsvViewerPanel : UserControl
|
||||
{
|
||||
public CsvViewerPanel()
|
||||
|
@@ -38,9 +38,6 @@ using System.Windows.Threading;
|
||||
|
||||
namespace QuickLook.Plugin.ImageViewer;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for ImagePanel.xaml
|
||||
/// </summary>
|
||||
public partial class ImagePanel : UserControl, INotifyPropertyChanged, IDisposable
|
||||
{
|
||||
private Visibility _backgroundVisibility = Visibility.Visible;
|
||||
|
@@ -29,9 +29,6 @@ using System.Windows.Controls;
|
||||
|
||||
namespace QuickLook.Plugin.PDFViewer;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for PdfViewer.xaml
|
||||
/// </summary>
|
||||
public partial class PdfViewerControl : UserControl, INotifyPropertyChanged, IDisposable
|
||||
{
|
||||
private int _changePageDeltaSum;
|
||||
|
@@ -8,13 +8,6 @@
|
||||
FontSize="14"
|
||||
UseLayoutRounding="True"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/QuickLook.Common;component/Styles/MainWindowStyles.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="15" />
|
||||
|
@@ -29,27 +29,16 @@ namespace QuickLook.Plugin.PEViewer;
|
||||
|
||||
public partial class PEInfoPanel : UserControl
|
||||
{
|
||||
private bool _stop;
|
||||
|
||||
public PEInfoPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// apply global theme
|
||||
Resources.MergedDictionaries[0].Clear();
|
||||
|
||||
string translationFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Translations.config");
|
||||
totalSizeTitle.Text = TranslationHelper.Get("TOTAL_SIZE", translationFile);
|
||||
fileVersionTitle.Text = TranslationHelper.Get("FILE_VERSION", translationFile);
|
||||
productVersionTitle.Text = TranslationHelper.Get("PRODUCT_VERSION", translationFile);
|
||||
}
|
||||
|
||||
public bool Stop
|
||||
{
|
||||
set => _stop = value;
|
||||
get => _stop;
|
||||
}
|
||||
|
||||
public void DisplayInfo(string path)
|
||||
{
|
||||
_ = Task.Run(() =>
|
||||
@@ -71,8 +60,6 @@ public partial class PEInfoPanel : UserControl
|
||||
var name = Path.GetFileName(path);
|
||||
filename.Text = string.IsNullOrEmpty(name) ? path : name;
|
||||
|
||||
Stop = false;
|
||||
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
if (File.Exists(path))
|
||||
|
@@ -44,7 +44,7 @@ internal static class WindowsThumbnailProvider
|
||||
private static extern int SHCreateItemFromParsingName(
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string path,
|
||||
// The following parameter is not used - binding context.
|
||||
IntPtr pbc,
|
||||
nint pbc,
|
||||
ref Guid riid,
|
||||
[MarshalAs(UnmanagedType.Interface)] out IShellItem shellItem);
|
||||
|
||||
@@ -71,7 +71,7 @@ internal static class WindowsThumbnailProvider
|
||||
}
|
||||
}
|
||||
|
||||
internal static Bitmap GetBitmapFromHBitmap(IntPtr nativeHBitmap)
|
||||
internal static Bitmap GetBitmapFromHBitmap(nint nativeHBitmap)
|
||||
{
|
||||
var bmp = Image.FromHbitmap(nativeHBitmap);
|
||||
|
||||
@@ -115,7 +115,7 @@ internal static class WindowsThumbnailProvider
|
||||
return srcBitmap;
|
||||
}
|
||||
|
||||
private static IntPtr GetHBitmap(string fileName, int width, int height, ThumbnailOptions options)
|
||||
private static nint GetHBitmap(string fileName, int width, int height, ThumbnailOptions options)
|
||||
{
|
||||
var shellItem2Guid = new Guid(IShellItem2Guid);
|
||||
var retCode =
|
||||
@@ -142,18 +142,18 @@ internal static class WindowsThumbnailProvider
|
||||
[Guid("43826d1e-e718-42ee-bc55-a1e261c37bfe")]
|
||||
internal interface IShellItem
|
||||
{
|
||||
void BindToHandler(IntPtr pbc,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid bhid,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid riid,
|
||||
out IntPtr ppv);
|
||||
public void BindToHandler(nint pbc,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid bhid,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid riid,
|
||||
out nint ppv);
|
||||
|
||||
void GetParent(out IShellItem ppsi);
|
||||
public void GetParent(out IShellItem ppsi);
|
||||
|
||||
void GetDisplayName(SIGDN sigdnName, out IntPtr ppszName);
|
||||
public void GetDisplayName(SIGDN sigdnName, out nint ppszName);
|
||||
|
||||
void GetAttributes(uint sfgaoMask, out uint psfgaoAttribs);
|
||||
public void GetAttributes(uint sfgaoMask, out uint psfgaoAttribs);
|
||||
|
||||
void Compare(IShellItem psi, uint hint, out int piOrder);
|
||||
public void Compare(IShellItem psi, uint hint, out int piOrder);
|
||||
}
|
||||
|
||||
internal enum SIGDN : uint
|
||||
@@ -165,7 +165,7 @@ internal static class WindowsThumbnailProvider
|
||||
PARENTRELATIVEEDITING = 0x80031001,
|
||||
DESKTOPABSOLUTEEDITING = 0x8004c000,
|
||||
FILESYSPATH = 0x80058000,
|
||||
URL = 0x80068000
|
||||
URL = 0x80068000,
|
||||
}
|
||||
|
||||
internal enum HResult
|
||||
@@ -182,7 +182,7 @@ internal static class WindowsThumbnailProvider
|
||||
Win32ErrorCanceled = 1223,
|
||||
Canceled = unchecked((int)0x800704C7),
|
||||
ResourceInUse = unchecked((int)0x800700AA),
|
||||
AccessDenied = unchecked((int)0x80030005)
|
||||
AccessDenied = unchecked((int)0x80030005),
|
||||
}
|
||||
|
||||
[ComImport]
|
||||
@@ -191,10 +191,10 @@ internal static class WindowsThumbnailProvider
|
||||
internal interface IShellItemImageFactory
|
||||
{
|
||||
[PreserveSig]
|
||||
HResult GetImage(
|
||||
public HResult GetImage(
|
||||
[In][MarshalAs(UnmanagedType.Struct)] NativeSize size,
|
||||
[In] ThumbnailOptions flags,
|
||||
[Out] out IntPtr phbm);
|
||||
[Out] out nint phbm);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
|
@@ -7,13 +7,6 @@
|
||||
Height="200"
|
||||
FontSize="14"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/QuickLook.Common;component/Styles/MainWindowStyles.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
|
@@ -37,9 +37,6 @@ public partial class PluginInfoPanel : UserControl
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// apply global theme
|
||||
Resources.MergedDictionaries[0].Clear();
|
||||
|
||||
_path = path;
|
||||
_context = context;
|
||||
ReadInfo();
|
||||
|
@@ -45,9 +45,6 @@ using WPFMediaKit.DirectShow.MediaPlayers;
|
||||
|
||||
namespace QuickLook.Plugin.VideoViewer;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for UserControl1.xaml
|
||||
/// </summary>
|
||||
public partial class ViewerPanel : UserControl, IDisposable, INotifyPropertyChanged
|
||||
{
|
||||
private readonly ContextObject _context;
|
||||
|
Reference in New Issue
Block a user