Code Cleanup
Some checks failed
MSBuild / build (push) Has been cancelled
MSBuild / publish (push) Has been cancelled

This commit is contained in:
ema
2025-08-09 00:36:39 +08:00
parent 3dbc9fc763
commit 14a5bea926
11 changed files with 92 additions and 105 deletions

View File

@@ -45,7 +45,7 @@ public class ArchiveFileEntry : IComparable<ArchiveFileEntry>
public DateTime ModifiedDate { get; set; }
/// <summary>
/// Returns the maximum depth of all siblings
/// Returns the maximum depth of all siblings
/// </summary>
public int Level
{
@@ -75,7 +75,7 @@ public class ArchiveFileEntry : IComparable<ArchiveFileEntry>
}
/// <summary>
/// Returns the number of nodes in the longest path to a leaf
/// Returns the number of nodes in the longest path to a leaf
/// </summary>
private int GetDepth()
{

View File

@@ -28,9 +28,9 @@ using System.Windows.Media.Imaging;
namespace QuickLook.Plugin.ArchiveViewer;
/// <summary>
/// Internals are mostly from here:
/// http://www.codeproject.com/Articles/2532/Obtaining-and-managing-file-and-folder-icons-using
/// Caches all results.
/// Internals are mostly from here:
/// http://www.codeproject.com/Articles/2532/Obtaining-and-managing-file-and-folder-icons-using
/// Caches all results.
/// </summary>
public static class IconManager
{
@@ -48,7 +48,7 @@ public static class IconManager
}
/// <summary>
/// Get the icon of a directory
/// Get the icon of a directory
/// </summary>
/// <param name="large">16x16 or 32x32 icon</param>
/// <returns>an icon</returns>
@@ -68,7 +68,7 @@ public static class IconManager
}
/// <summary>
/// Get an icon for a given filename
/// Get an icon for a given filename
/// </summary>
/// <param name="fileName">any filename</param>
/// <param name="large">16x16 or 32x32 icon</param>
@@ -89,7 +89,7 @@ public static class IconManager
}
/// <summary>
/// http://stackoverflow.com/a/6580799/1943849
/// http://stackoverflow.com/a/6580799/1943849
/// </summary>
private static ImageSource ToImageSource(this Icon icon)
{
@@ -101,31 +101,31 @@ public static class IconManager
}
/// <summary>
/// Provides static methods to read system icons for both folders and files.
/// Provides static methods to read system icons for both folders and files.
/// </summary>
/// <example>
/// <code>IconReader.GetFileIcon("c:\\general.xls");</code>
/// <code>IconReader.GetFileIcon("c:\\general.xls");</code>
/// </example>
private static class IconReader
{
/// <summary>
/// Options to specify the size of icons to return.
/// Options to specify the size of icons to return.
/// </summary>
public enum IconSize
{
/// <summary>
/// Specify large icon - 32 pixels by 32 pixels.
/// Specify large icon - 32 pixels by 32 pixels.
/// </summary>
Large = 0,
/// <summary>
/// Specify small icon - 16 pixels by 16 pixels.
/// Specify small icon - 16 pixels by 16 pixels.
/// </summary>
Small = 1
}
/// <summary>
/// Returns the icon of a folder.
/// Returns the icon of a folder.
/// </summary>
/// <param name="size">Large or small</param>
/// <param name="linkOverlay">Whether to include the link icon</param>
@@ -152,7 +152,7 @@ public static class IconManager
}
/// <summary>
/// Returns an icon for a given file - indicated by the name parameter.
/// Returns an icon for a given file - indicated by the name parameter.
/// </summary>
/// <param name="name">Pathname for file.</param>
/// <param name="size">Large or small</param>
@@ -181,8 +181,8 @@ public static class IconManager
}
/// <summary>
/// Wraps necessary Shell32.dll structures and functions required to retrieve Icon Handles using SHGetFileInfo. Code
/// courtesy of MSDN Cold Rooster Consulting case study.
/// Wraps necessary Shell32.dll structures and functions required to retrieve Icon Handles using SHGetFileInfo. Code
/// courtesy of MSDN Cold Rooster Consulting case study.
/// </summary>
private static class Shell32
{
@@ -221,13 +221,13 @@ public static class IconManager
}
/// <summary>
/// Wraps necessary functions imported from User32.dll. Code courtesy of MSDN Cold Rooster Consulting example.
/// Wraps necessary functions imported from User32.dll. Code courtesy of MSDN Cold Rooster Consulting example.
/// </summary>
private static class User32
{
/// <summary>
/// Provides access to function required to delete handle. This method is used internally
/// and is not required to be called separately.
/// Provides access to function required to delete handle. This method is used internally
/// and is not required to be called separately.
/// </summary>
/// <param name="hIcon">Pointer to icon handle.</param>
/// <returns>N/A</returns>

View File

@@ -8,16 +8,16 @@ using System.Xml.Serialization;
namespace RegFileParser;
/// <summary>
/// The main reg file parsing class.
/// Reads the given reg file and stores the content as
/// a Dictionary of registry keys and values as a Dictionary of registry values <see cref="RegValueObject" />
/// The main reg file parsing class.
/// Reads the given reg file and stores the content as
/// a Dictionary of registry keys and values as a Dictionary of registry values <see cref="RegValueObject" />
/// </summary>
public class RegFileObject
{
#region Public Properties
/// <summary>
/// Gets the dictionary containing all entries
/// Gets the dictionary containing all entries
/// </summary>
public Dictionary<string, Dictionary<string, RegValueObject>> RegValues => regvalues;
@@ -26,12 +26,12 @@ public class RegFileObject
#region Private Fields
/// <summary>
/// Raw content of the reg file
/// Raw content of the reg file
/// </summary>
private string content;
/// <summary>
/// the dictionary containing parsed registry values
/// the dictionary containing parsed registry values
/// </summary>
private readonly Dictionary<string, Dictionary<string, RegValueObject>> regvalues;
@@ -61,7 +61,7 @@ public class RegFileObject
#region Private Methods
/// <summary>
/// Imports the reg file
/// Imports the reg file
/// </summary>
public void Read(string path)
{
@@ -70,7 +70,7 @@ public class RegFileObject
}
/// <summary>
/// Imports the reg file
/// Imports the reg file
/// </summary>
public void Read(byte[] bytes)
{
@@ -109,7 +109,7 @@ public class RegFileObject
}
/// <summary>
/// Parses the reg file for reg keys and reg values
/// Parses the reg file for reg keys and reg values
/// </summary>
/// <returns>A Dictionary with reg keys as Dictionary keys and a Dictionary of (valuename, valuedata)</returns>
private Dictionary<string, Dictionary<string, string>> ParseFile()
@@ -141,7 +141,7 @@ public class RegFileObject
}
/// <summary>
/// Creates a flat Dictionary using given searcn pattern
/// Creates a flat Dictionary using given searcn pattern
/// </summary>
/// <param name="content">The content string to be parsed</param>
/// <returns>A Dictionary with retrieved keys and remaining content</returns>
@@ -202,7 +202,7 @@ public class RegFileObject
}
/// <summary>
/// Creates a flat Dictionary using given searcn pattern
/// Creates a flat Dictionary using given searcn pattern
/// </summary>
/// <param name="content">The content string to be parsed</param>
/// <returns>A Dictionary with retrieved keys and remaining content</returns>
@@ -254,7 +254,7 @@ public class RegFileObject
}
/// <summary>
/// Removes the leading and ending characters from the given string
/// Removes the leading and ending characters from the given string
/// </summary>
/// <param name="sLine">given string</param>
/// <returns>edited string</returns>
@@ -268,7 +268,7 @@ public class RegFileObject
}
/// <summary>
/// Removes the leading and ending parenthesis from the given string
/// Removes the leading and ending parenthesis from the given string
/// </summary>
/// <param name="sLine">given string</param>
/// <returns>edited string</returns>
@@ -294,7 +294,7 @@ public class RegValueObject
private string value;
/// <summary>
/// Parameterless constructor
/// Parameterless constructor
/// </summary>
public RegValueObject()
{
@@ -307,7 +307,7 @@ public class RegValueObject
}
/// <summary>
/// Overloaded constructor
/// Overloaded constructor
/// </summary>
/// <param name="propertyString">A line from the [Registry] section of the *.sig signature file</param>
public RegValueObject(string regKeyName, string regValueName, string regValueData, string encoding)
@@ -326,7 +326,7 @@ public class RegValueObject
#region Public Methods
/// <summary>
/// Overriden Method
/// Overriden Method
/// </summary>
/// <returns>An entry for the [Registry] section of the *.sig signature file</returns>
public override string ToString()
@@ -339,7 +339,7 @@ public class RegValueObject
#region Public Properties
/// <summary>
/// Regsitry value name
/// Regsitry value name
/// </summary>
[XmlElement("entry", typeof(string))]
public string Entry
@@ -349,7 +349,7 @@ public class RegValueObject
}
/// <summary>
/// Registry value parent key
/// Registry value parent key
/// </summary>
[XmlElement("key", typeof(string))]
public string ParentKey
@@ -364,7 +364,7 @@ public class RegValueObject
}
/// <summary>
/// Registry value root hive
/// Registry value root hive
/// </summary>
[XmlElement("root", typeof(string))]
public string Root
@@ -374,7 +374,7 @@ public class RegValueObject
}
/// <summary>
/// Registry value type
/// Registry value type
/// </summary>
[XmlElement("type", typeof(string))]
public string Type
@@ -384,7 +384,7 @@ public class RegValueObject
}
/// <summary>
/// Registry value data
/// Registry value data
/// </summary>
[XmlElement("value", typeof(string))]
public string Value
@@ -447,7 +447,7 @@ public class RegValueObject
}
/// <summary>
/// Retrieves the reg value type, parsing the prefix of the value
/// Retrieves the reg value type, parsing the prefix of the value
/// </summary>
/// <param name="sTextLine">Registry value row string</param>
/// <returns>Value</returns>
@@ -546,7 +546,7 @@ public class RegValueObject
}
/// <summary>
/// Removes the leading and ending characters from the given string
/// Removes the leading and ending characters from the given string
/// </summary>
/// <param name="sline">given string</param>
/// <returns>edited string</returns>
@@ -560,7 +560,7 @@ public class RegValueObject
}
/// <summary>
/// Removes the leading and ending parenthesis from the given string
/// Removes the leading and ending parenthesis from the given string
/// </summary>
/// <param name="sline">given string</param>
/// <returns>edited string</returns>
@@ -573,7 +573,7 @@ public class RegValueObject
}
/// <summary>
/// Removes the ending backslashes from the given string
/// Removes the ending backslashes from the given string
/// </summary>
/// <param name="sline">given string</param>
/// <returns>edited string</returns>
@@ -585,7 +585,7 @@ public class RegValueObject
}
/// <summary>
/// Converts the byte arrays (saved as array of string) into string
/// Converts the byte arrays (saved as array of string) into string
/// </summary>
/// <param name="stringArray">Array of string</param>
/// <returns>String value</returns>

View File

@@ -81,8 +81,7 @@ public class BackgroundVisualHost : FrameworkElement
private readonly CreateContentFunction _createContent;
private readonly Action _invalidateMeasure;
private readonly AutoResetEvent _sync =
new AutoResetEvent(false);
private readonly AutoResetEvent _sync = new(false);
public ThreadedVisualHelper(
CreateContentFunction createContent,
@@ -125,17 +124,11 @@ public class BackgroundVisualHost : FrameworkElement
}
}
#region Private Fields
public ThreadedVisualHelper ThreadedHelper;
private HostVisual _hostVisual;
#endregion Private Fields
#region IsContentShowingProperty
/// <summary>
/// Identifies the IsContentShowing dependency property.
/// Identifies the IsContentShowing dependency property.
/// </summary>
public static readonly DependencyProperty IsContentShowingProperty = DependencyProperty.Register(
"IsContentShowing",
@@ -144,7 +137,7 @@ public class BackgroundVisualHost : FrameworkElement
new FrameworkPropertyMetadata(false, OnIsContentShowingChanged));
/// <summary>
/// Gets or sets if the content is being displayed.
/// Gets or sets if the content is being displayed.
/// </summary>
public bool IsContentShowing
{
@@ -163,12 +156,8 @@ public class BackgroundVisualHost : FrameworkElement
bvh.HideContentHelper();
}
#endregion IsContentShowingProperty
#region CreateContent Property
/// <summary>
/// Identifies the CreateContent dependency property.
/// Identifies the CreateContent dependency property.
/// </summary>
public static readonly DependencyProperty CreateContentProperty = DependencyProperty.Register(
"CreateContent",
@@ -177,7 +166,7 @@ public class BackgroundVisualHost : FrameworkElement
new FrameworkPropertyMetadata(OnCreateContentChanged));
/// <summary>
/// Gets or sets the function used to create the visual to display in a background thread.
/// Gets or sets the function used to create the visual to display in a background thread.
/// </summary>
public CreateContentFunction CreateContent
{
@@ -196,6 +185,4 @@ public class BackgroundVisualHost : FrameworkElement
bvh.CreateContentHelper();
}
}
#endregion CreateContent Property
}

View File

@@ -135,7 +135,7 @@ public class BusyDecorator : Decorator, IDisposable
#region IsBusyIndicatorShowing Property
/// <summary>
/// Identifies the IsBusyIndicatorShowing dependency property.
/// Identifies the IsBusyIndicatorShowing dependency property.
/// </summary>
public static readonly DependencyProperty IsBusyIndicatorShowingProperty = DependencyProperty.Register(
"IsBusyIndicatorShowing",
@@ -146,7 +146,7 @@ public class BusyDecorator : Decorator, IDisposable
OnIsBusyIndicatorShowingChanged));
/// <summary>
/// Gets or sets if the BusyIndicator is being shown.
/// Gets or sets if the BusyIndicator is being shown.
/// </summary>
public bool IsBusyIndicatorShowing
{
@@ -178,7 +178,7 @@ public class BusyDecorator : Decorator, IDisposable
#region BusyStyle
/// <summary>
/// Identifies the <see cref="BusyStyle" /> property.
/// Identifies the <see cref="BusyStyle" /> property.
/// </summary>
public static readonly DependencyProperty BusyStyleProperty =
DependencyProperty.Register(
@@ -188,7 +188,7 @@ public class BusyDecorator : Decorator, IDisposable
new FrameworkPropertyMetadata(OnBusyStyleChanged));
/// <summary>
/// Gets or sets the Style to apply to the Control that is displayed as the busy indication.
/// Gets or sets the Style to apply to the Control that is displayed as the busy indication.
/// </summary>
public Style BusyStyle
{
@@ -208,7 +208,7 @@ public class BusyDecorator : Decorator, IDisposable
#region BusyHorizontalAlignment
/// <summary>
/// Identifies the <see cref="BusyHorizontalAlignment" /> property.
/// Identifies the <see cref="BusyHorizontalAlignment" /> property.
/// </summary>
public static readonly DependencyProperty BusyHorizontalAlignmentProperty = DependencyProperty.Register(
"BusyHorizontalAlignment",
@@ -217,7 +217,7 @@ public class BusyDecorator : Decorator, IDisposable
new FrameworkPropertyMetadata(HorizontalAlignment.Center));
/// <summary>
/// Gets or sets the HorizontalAlignment to use to layout the control that contains the busy indicator control.
/// Gets or sets the HorizontalAlignment to use to layout the control that contains the busy indicator control.
/// </summary>
public HorizontalAlignment BusyHorizontalAlignment
{
@@ -230,7 +230,7 @@ public class BusyDecorator : Decorator, IDisposable
#region BusyVerticalAlignment
/// <summary>
/// Identifies the <see cref="BusyVerticalAlignment" /> property.
/// Identifies the <see cref="BusyVerticalAlignment" /> property.
/// </summary>
public static readonly DependencyProperty BusyVerticalAlignmentProperty = DependencyProperty.Register(
"BusyVerticalAlignment",
@@ -239,7 +239,7 @@ public class BusyDecorator : Decorator, IDisposable
new FrameworkPropertyMetadata(VerticalAlignment.Center));
/// <summary>
/// Gets or sets the the VerticalAlignment to use to layout the control that contains the busy indicator.
/// Gets or sets the the VerticalAlignment to use to layout the control that contains the busy indicator.
/// </summary>
public VerticalAlignment BusyVerticalAlignment
{

View File

@@ -24,17 +24,17 @@ using System.Windows.Media.Animation;
namespace QuickLook.Controls.BusyDecorator;
/// <summary>
/// Control extensions
/// Control extensions
/// </summary>
internal static class ControlExtensions
{
/// <summary>
/// The key used for storing the spinner Storyboard.
/// The key used for storing the spinner Storyboard.
/// </summary>
private static readonly string SpinnerStoryBoardName = $"{typeof(FrameworkElement).Name}Spinner";
/// <summary>
/// Start the spinning animation
/// Start the spinning animation
/// </summary>
/// <typeparam name="T">FrameworkElement and ISpinable</typeparam>
/// <param name="control">Control to apply the rotation </param>
@@ -78,7 +78,7 @@ internal static class ControlExtensions
}
/// <summary>
/// Stop the spinning animation
/// Stop the spinning animation
/// </summary>
/// <typeparam name="T">FrameworkElement and ISpinable</typeparam>
/// <param name="control">Control to stop the rotation.</param>

View File

@@ -18,17 +18,17 @@
namespace QuickLook.Controls.BusyDecorator;
/// <summary>
/// Represents a spinable control
/// Represents a spinable control
/// </summary>
internal interface ISpinable
{
/// <summary>
/// Gets or sets the current spin (angle) animation of the icon.
/// Gets or sets the current spin (angle) animation of the icon.
/// </summary>
public bool Spin { get; set; }
/// <summary>
/// Gets or sets the duration of the spinning animation (in seconds). This will stop and start the spin animation.
/// Gets or sets the duration of the spinning animation (in seconds). This will stop and start the spin animation.
/// </summary>
public double SpinDuration { get; set; }
}

View File

@@ -25,7 +25,7 @@ internal class SpinIcon : TextBlock, ISpinable
#region public bool Spin
/// <summary>
/// Identifies the Spin dependency property.
/// Identifies the Spin dependency property.
/// </summary>
public static DependencyProperty SpinProperty =
DependencyProperty.Register("Spin", typeof(bool), typeof(SpinIcon),
@@ -44,7 +44,7 @@ internal class SpinIcon : TextBlock, ISpinable
}
/// <summary>
/// Gets or sets the current spin (angle) animation of the icon.
/// Gets or sets the current spin (angle) animation of the icon.
/// </summary>
public bool Spin
{
@@ -58,7 +58,7 @@ internal class SpinIcon : TextBlock, ISpinable
#region public double SpinDuration
/// <summary>
/// Identifies the SpinDuration dependency property.
/// Identifies the SpinDuration dependency property.
/// </summary>
public static DependencyProperty SpinDurationProperty =
DependencyProperty.Register("SpinDuration", typeof(double), typeof(SpinIcon),
@@ -76,7 +76,7 @@ internal class SpinIcon : TextBlock, ISpinable
}
/// <summary>
/// Gets or sets the duration of the spinning animation (in seconds). This will stop and start the spin animation.
/// Gets or sets the duration of the spinning animation (in seconds). This will stop and start the spin animation.
/// </summary>
public double SpinDuration
{

View File

@@ -43,7 +43,7 @@ public partial class GlassLayer : UserControl
#region public Visual BlurredElement
/// <summary>
/// Identifies the BlurredElement dependency property.
/// Identifies the BlurredElement dependency property.
/// </summary>
public static DependencyProperty BlurredElementProperty =
DependencyProperty.Register("BlurredElement", typeof(Visual), typeof(GlassLayer), null);
@@ -62,7 +62,7 @@ public partial class GlassLayer : UserControl
#region public SolidColorBrush OverlayColor
/// <summary>
/// Identifies the OverlayColor dependency property.
/// Identifies the OverlayColor dependency property.
/// </summary>
public static DependencyProperty OverlayColorProperty =
DependencyProperty.Register("OverlayColor", typeof(SolidColorBrush), typeof(GlassLayer),
@@ -82,7 +82,7 @@ public partial class GlassLayer : UserControl
#region public Visibility ColorOverlayVisibility
/// <summary>
/// Identifies the ColorOverlayVisibilityProperty dependency property.
/// Identifies the ColorOverlayVisibilityProperty dependency property.
/// </summary>
public static DependencyProperty ColorOverlayVisibilityProperty =
DependencyProperty.Register("ColorOverlayVisibility", typeof(Visibility), typeof(GlassLayer),
@@ -100,7 +100,7 @@ public partial class GlassLayer : UserControl
#region public Visibility NoiseVisibility
/// <summary>
/// Identifies the NoiseVisibility dependency property.
/// Identifies the NoiseVisibility dependency property.
/// </summary>
public static DependencyProperty NoiseVisibilityProperty =
DependencyProperty.Register("NoiseVisibility", typeof(Visibility), typeof(GlassLayer),
@@ -120,7 +120,7 @@ public partial class GlassLayer : UserControl
#region public Visibility GlassVisibility
/// <summary>
/// Identifies the GlassVisibility dependency property.
/// Identifies the GlassVisibility dependency property.
/// </summary>
public static DependencyProperty GlassVisibilityProperty =
DependencyProperty.Register("GlassVisibility", typeof(Visibility), typeof(GlassLayer),

View File

@@ -33,8 +33,8 @@ internal enum SLGP_FLAGS
SLGP_UNCPRIORITY = 0x2,
/// <summary>
/// Retrieves the raw path name. A raw path is something that might not exist and may include environment
/// variables that need to be expanded
/// Retrieves the raw path name. A raw path is something that might not exist and may include environment
/// variables that need to be expanded
/// </summary>
SLGP_RAWPATH = 0x4
}
@@ -62,13 +62,13 @@ internal struct WIN32_FIND_DATAW
internal enum SLR_FLAGS
{
/// <summary>
/// Do not display a dialog box if the link cannot be resolved. When SLR_NO_UI is set,
/// the high-order word of fFlags can be set to a time-out value that specifies the
/// maximum amount of time to be spent resolving the link. The function returns if the
/// link cannot be resolved within the time-out duration. If the high-order word is set
/// to zero, the time-out duration will be set to the default value of 3,000 milliseconds
/// (3 seconds). To specify a value, set the high word of fFlags to the desired time-out
/// duration, in milliseconds.
/// Do not display a dialog box if the link cannot be resolved. When SLR_NO_UI is set,
/// the high-order word of fFlags can be set to a time-out value that specifies the
/// maximum amount of time to be spent resolving the link. The function returns if the
/// link cannot be resolved within the time-out duration. If the high-order word is set
/// to zero, the time-out duration will be set to the default value of 3,000 milliseconds
/// (3 seconds). To specify a value, set the high word of fFlags to the desired time-out
/// duration, in milliseconds.
/// </summary>
SLR_NO_UI = 0x1,
@@ -76,9 +76,9 @@ internal enum SLR_FLAGS
SLR_ANY_MATCH = 0x2,
/// <summary>
/// If the link object has changed, update its path and list of identifiers.
/// If SLR_UPDATE is set, you do not need to call IPersistFile::IsDirty to determine
/// whether or not the link object has changed.
/// If the link object has changed, update its path and list of identifiers.
/// If SLR_UPDATE is set, you do not need to call IPersistFile::IsDirty to determine
/// whether or not the link object has changed.
/// </summary>
SLR_UPDATE = 0x4,
@@ -92,10 +92,10 @@ internal enum SLR_FLAGS
SLR_NOTRACK = 0x20,
/// <summary>
/// Disable distributed link tracking. By default, distributed link tracking tracks
/// removable media across multiple devices based on the volume name. It also uses the
/// Universal Naming Convention (UNC) path to track remote file systems whose drive letter
/// has changed. Setting SLR_NOLINKINFO disables both types of tracking.
/// Disable distributed link tracking. By default, distributed link tracking tracks
/// removable media across multiple devices based on the volume name. It also uses the
/// Universal Naming Convention (UNC) path to track remote file systems whose drive letter
/// has changed. Setting SLR_NOLINKINFO disables both types of tracking.
/// </summary>
SLR_NOLINKINFO = 0x40,