mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-06-15 00:45:16 +12:00
Code Cleanup, version 1.0.23.0
This commit is contained in:
parent
ed362a8f9d
commit
680c093659
|
@ -18,9 +18,6 @@ namespace SystemTrayMenu
|
|||
private readonly AppNotifyIcon menuNotifyIcon = new AppNotifyIcon();
|
||||
private readonly Menus menus = new Menus();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="App"/> class.
|
||||
/// </summary>
|
||||
public App()
|
||||
{
|
||||
AppRestart.BeforeRestarting += Dispose;
|
||||
|
@ -39,7 +36,6 @@ namespace SystemTrayMenu
|
|||
menus.MainPreload();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
SystemEvents.DisplaySettingsChanged -= AppRestart.ByDisplaySettings;
|
||||
|
|
|
@ -41,7 +41,6 @@ namespace SystemTrayMenu.Handler
|
|||
|
||||
internal bool InUse { get; set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
hook.Dispose();
|
||||
|
|
|
@ -281,7 +281,6 @@ namespace SystemTrayMenu.Business
|
|||
|
||||
private List<Menu> AsList => AsEnumerable.ToList();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
workerMainMenu.Dispose();
|
||||
|
|
|
@ -20,7 +20,6 @@ namespace SystemTrayMenu.Handler
|
|||
|
||||
public event EventHandlerEmpty LeaveTriggered;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
timerLeaveCheck.Dispose();
|
||||
|
|
|
@ -39,7 +39,6 @@ namespace SystemTrayMenu.Handler
|
|||
|
||||
internal bool MouseActive { get; set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
timerStartLoad.Stop();
|
||||
|
|
|
@ -13,9 +13,6 @@ namespace SystemTrayMenu.DataClasses
|
|||
using SystemTrayMenu.Utilities;
|
||||
using Menu = SystemTrayMenu.UserInterface.Menu;
|
||||
|
||||
/// <summary>
|
||||
/// Contains data of row.
|
||||
/// </summary>
|
||||
internal class RowData
|
||||
{
|
||||
private static readonly Icon White50PercentageIcon = Properties.Resources.White50Percentage;
|
||||
|
@ -26,97 +23,43 @@ namespace SystemTrayMenu.DataClasses
|
|||
private string text;
|
||||
private Icon icon;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RowData"/> class.
|
||||
/// </summary>
|
||||
internal RowData()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets fileInfo.
|
||||
/// </summary>
|
||||
internal FileInfo FileInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets SubMenu.
|
||||
/// </summary>
|
||||
internal Menu SubMenu { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether IsMenuOpen.
|
||||
/// </summary>
|
||||
internal bool IsMenuOpen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether IsSelected.
|
||||
/// </summary>
|
||||
internal bool IsSelected { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether ContainsMenu.
|
||||
/// </summary>
|
||||
internal bool ContainsMenu { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether IsContextMenuOpen.
|
||||
/// </summary>
|
||||
internal bool IsContextMenuOpen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether IsResolvedLnk.
|
||||
/// </summary>
|
||||
internal bool IsResolvedLnk { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether is a HiddenEntry.
|
||||
/// </summary>
|
||||
internal bool HiddenEntry { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets TargetFilePath.
|
||||
/// </summary>
|
||||
internal string TargetFilePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets TargetFilePathOrig.
|
||||
/// </summary>
|
||||
internal string TargetFilePathOrig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets RowIndex.
|
||||
/// </summary>
|
||||
internal int RowIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets MenuLevel.
|
||||
/// </summary>
|
||||
internal int MenuLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether IconLoading.
|
||||
/// </summary>
|
||||
internal bool IconLoading { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets FilePathIcon.
|
||||
/// </summary>
|
||||
internal string FilePathIcon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set text of row.
|
||||
/// </summary>
|
||||
/// <param name="text">text of row.</param>
|
||||
internal void SetText(string text)
|
||||
{
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SetData.
|
||||
/// </summary>
|
||||
/// <param name="data">data.</param>
|
||||
/// <param name="dataTable">dataTable.</param>
|
||||
internal void SetData(RowData data, DataTable dataTable)
|
||||
{
|
||||
DataRow row = dataTable.Rows.Add();
|
||||
|
@ -144,12 +87,6 @@ namespace SystemTrayMenu.DataClasses
|
|||
row[2] = data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ReadIcon.
|
||||
/// </summary>
|
||||
/// <param name="isDirectory">isDirectory.</param>
|
||||
/// <param name="resolvedLnkPath">resolvedLnkPath.</param>
|
||||
/// <returns>isLnkDirectory.</returns>
|
||||
internal bool ReadIcon(bool isDirectory, ref string resolvedLnkPath)
|
||||
{
|
||||
bool isLnkDirectory = false;
|
||||
|
@ -213,12 +150,6 @@ namespace SystemTrayMenu.DataClasses
|
|||
return isLnkDirectory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MouseDown.
|
||||
/// </summary>
|
||||
/// <param name="dgv">dgv.</param>
|
||||
/// <param name="e">e.</param>
|
||||
/// <param name="toCloseByDoubleClick">toCloseByDoubleClick.</param>
|
||||
internal void MouseDown(DataGridView dgv, MouseEventArgs e, out bool toCloseByDoubleClick)
|
||||
{
|
||||
toCloseByDoubleClick = false;
|
||||
|
@ -260,11 +191,6 @@ namespace SystemTrayMenu.DataClasses
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DoubleClick.
|
||||
/// </summary>
|
||||
/// <param name="e">e.</param>
|
||||
/// <param name="toCloseByDoubleClick">toCloseByDoubleClick.</param>
|
||||
internal void DoubleClick(MouseEventArgs e, out bool toCloseByDoubleClick)
|
||||
{
|
||||
toCloseByDoubleClick = false;
|
||||
|
@ -283,10 +209,6 @@ namespace SystemTrayMenu.DataClasses
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ReadLoadedIcon.
|
||||
/// </summary>
|
||||
/// <returns>Icon.</returns>
|
||||
internal Icon ReadLoadedIcon()
|
||||
{
|
||||
if (ContainsMenu)
|
||||
|
|
|
@ -5,4 +5,9 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA0001:XML comment analysis is disabled due to project configuration", Justification = "no idea what this is")]
|
||||
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "we need to document")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1601:Partial elements should be documented", Justification = "we need to document")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1602:Enumeration items should be documented", Justification = "we need to document")]
|
||||
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1101:Prefix local calls with this", Justification = "Standard codecleanup removes the this")]
|
||||
|
|
|
@ -28,7 +28,6 @@ namespace SystemTrayMenu.Helper
|
|||
|
||||
internal event Action<object, DataGridViewCellEventArgs> RowMouseLeave;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
|
|
|
@ -51,7 +51,6 @@ namespace SystemTrayMenu.UserInterface
|
|||
|
||||
internal bool IsHiding => state == FadingState.Hide;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
|
|
|
@ -41,7 +41,6 @@ namespace SystemTrayMenu.Helper
|
|||
/// </summary>
|
||||
internal event EventHandler<KeyPressedEventArgs> KeyPressed;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
// unregister all the registered hot keys.
|
||||
|
|
|
@ -8,7 +8,6 @@ namespace SystemTrayMenu.Helper
|
|||
|
||||
internal class WindowsExplorerSort : IComparer<string>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public int Compare(string x, string y)
|
||||
{
|
||||
return DllImports.NativeMethods.ShlwapiStrCmpLogicalW(x, y);
|
||||
|
|
|
@ -222,6 +222,31 @@ namespace SystemTrayMenu.Properties
|
|||
return isconfigPathAssembly;
|
||||
}
|
||||
|
||||
private static XDocument LoadOrGetNew(string path)
|
||||
{
|
||||
XDocument xDocument = null;
|
||||
try
|
||||
{
|
||||
xDocument = XDocument.Load(path);
|
||||
}
|
||||
catch (Exception exceptionWarning)
|
||||
{
|
||||
Log.Warn($"Could not load {path}", exceptionWarning);
|
||||
try
|
||||
{
|
||||
File.Delete(path);
|
||||
CreateEmptyConfigIfNotExists(path);
|
||||
xDocument = XDocument.Load(path);
|
||||
}
|
||||
catch (Exception exceptionError)
|
||||
{
|
||||
Log.Error($"Could not delete and create {path}", exceptionError);
|
||||
}
|
||||
}
|
||||
|
||||
return xDocument;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads the values of the file into memory.
|
||||
/// </summary>
|
||||
|
@ -260,31 +285,6 @@ namespace SystemTrayMenu.Properties
|
|||
}
|
||||
}
|
||||
|
||||
private XDocument LoadOrGetNew(string path)
|
||||
{
|
||||
XDocument xDocument = null;
|
||||
try
|
||||
{
|
||||
xDocument = XDocument.Load(path);
|
||||
}
|
||||
catch (Exception exceptionWarning)
|
||||
{
|
||||
Log.Warn($"Could not load {path}", exceptionWarning);
|
||||
try
|
||||
{
|
||||
File.Delete(path);
|
||||
CreateEmptyConfigIfNotExists(path);
|
||||
xDocument = XDocument.Load(path);
|
||||
}
|
||||
catch (Exception exceptionError)
|
||||
{
|
||||
Log.Error($"Could not delete and create {path}", exceptionError);
|
||||
}
|
||||
}
|
||||
|
||||
return xDocument;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the in memory dictionary to the user config file.
|
||||
/// </summary>
|
||||
|
|
|
@ -80,7 +80,6 @@ namespace SystemTrayMenu.UserInterface
|
|||
|
||||
public event EventHandlerEmpty Exit;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
notifyIcon.Icon = null;
|
||||
|
|
|
@ -141,7 +141,6 @@ namespace SystemTrayMenu.UserInterface
|
|||
|
||||
public int Delta => Value - lastValue;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool AutoSize
|
||||
{
|
||||
get => base.AutoSize;
|
||||
|
@ -208,14 +207,12 @@ namespace SystemTrayMenu.UserInterface
|
|||
Invalidate();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
timerMouseStillClicked.Dispose();
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
|
|
|
@ -9,7 +9,6 @@ namespace SystemTrayMenu.UserInterface
|
|||
|
||||
internal class ScrollbarControlDesigner : ControlDesigner
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public override SelectionRules SelectionRules
|
||||
{
|
||||
get
|
||||
|
|
|
@ -30,13 +30,11 @@ namespace SystemTrayMenu.UserInterface.FolderBrowseDialog
|
|||
/// </summary>
|
||||
public string Folder { get; set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public DialogResult ShowDialog()
|
||||
{
|
||||
return ShowDialog(owner: new WindowWrapper(IntPtr.Zero));
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public DialogResult ShowDialog(IWin32Window owner)
|
||||
{
|
||||
if (Environment.OSVersion.Version.Major >= 6)
|
||||
|
@ -49,7 +47,6 @@ namespace SystemTrayMenu.UserInterface.FolderBrowseDialog
|
|||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public DialogResult ShowVistaDialog(IWin32Window owner)
|
||||
{
|
||||
NativeMethods.IFileDialog frm = (NativeMethods.IFileDialog)new NativeMethods.FileOpenDialogRCW();
|
||||
|
@ -113,7 +110,6 @@ namespace SystemTrayMenu.UserInterface.FolderBrowseDialog
|
|||
return DialogResult.Cancel;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public DialogResult ShowLegacyDialog(IWin32Window owner)
|
||||
{
|
||||
using SaveFileDialog frm = new SaveFileDialog
|
||||
|
@ -143,7 +139,6 @@ namespace SystemTrayMenu.UserInterface.FolderBrowseDialog
|
|||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
|
|
|
@ -6,9 +6,6 @@ namespace SystemTrayMenu.UserInterface.FolderBrowseDialog
|
|||
{
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// WindowWrapper.
|
||||
/// </summary>
|
||||
public class WindowWrapper : System.Windows.Forms.IWin32Window
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -485,7 +485,6 @@ namespace SystemTrayMenu.UserInterface.HotkeyTextboxControl
|
|||
Redraw(true);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString()
|
||||
{
|
||||
return HotkeyToString(HotkeyModifiers, Hotkey);
|
||||
|
|
|
@ -21,7 +21,6 @@ namespace SystemTrayMenu.UserInterface
|
|||
{
|
||||
private string text;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string Text
|
||||
{
|
||||
get => text;
|
||||
|
|
|
@ -193,7 +193,6 @@ namespace SystemTrayMenu.UserInterface
|
|||
internal bool IsUsable => Visible && !fading.IsHiding &&
|
||||
!IsDisposed && !Disposing;
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override CreateParams CreateParams
|
||||
{
|
||||
get
|
||||
|
@ -483,7 +482,6 @@ namespace SystemTrayMenu.UserInterface
|
|||
labelFilesCount.Text = filesCount.ToString();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override bool ProcessCmdKey(ref Message msg, Keys keys)
|
||||
{
|
||||
switch (keys)
|
||||
|
|
|
@ -18,9 +18,6 @@ namespace SystemTrayMenu.UserInterface
|
|||
using Windows.ApplicationModel;
|
||||
using static SystemTrayMenu.UserInterface.HotkeyTextboxControl.HotkeyControl;
|
||||
|
||||
/// <summary>
|
||||
/// SettingsForm.
|
||||
/// </summary>
|
||||
public partial class SettingsForm : Form
|
||||
{
|
||||
private const string MenuName = @"Software\Classes\directory\shell\SystemTrayMenu_SetAsRootFolder";
|
||||
|
@ -30,9 +27,6 @@ namespace SystemTrayMenu.UserInterface
|
|||
private readonly ColorConverter colorConverter = new ColorConverter();
|
||||
private bool inHotkey;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SettingsForm"/> class.
|
||||
/// </summary>
|
||||
public SettingsForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -381,7 +375,6 @@ namespace SystemTrayMenu.UserInterface
|
|||
return RegisterHotkeys(false);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
||||
{
|
||||
switch (keyData)
|
||||
|
|
|
@ -8,17 +8,10 @@ namespace SystemTrayMenu.Utilities
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
/// <summary>
|
||||
/// Read *.ini files.
|
||||
/// </summary>
|
||||
public class FileIni
|
||||
{
|
||||
private readonly Dictionary<string, string> values;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FileIni"/> class.
|
||||
/// </summary>
|
||||
/// <param name="path">path of *.ini file.</param>
|
||||
public FileIni(string path)
|
||||
{
|
||||
values = File.ReadLines(path)
|
||||
|
@ -29,12 +22,6 @@ namespace SystemTrayMenu.Utilities
|
|||
parts.Length > 1 ? parts[1].Trim() : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get value of line in *.ini file.
|
||||
/// </summary>
|
||||
/// <param name="name">attribute name of line.</param>
|
||||
/// <param name="value">default value.</param>
|
||||
/// <returns>value of attribute name of line.</returns>
|
||||
public string Value(string name, string value = null)
|
||||
{
|
||||
if (values != null && values.ContainsKey(name))
|
||||
|
|
Loading…
Reference in a new issue