From a5e1ff4c258159e4e152ecfe1a048277b56fe629 Mon Sep 17 00:00:00 2001 From: Markus Hofknecht Date: Sat, 17 Apr 2021 02:39:48 +0200 Subject: [PATCH] [Feature] Migrate from deprecated FxCop analyzers to .NET analyzers (#152), version 1.0.17.16 --- Business/KeyboardInput.cs | 4 ++-- Business/Menus.cs | 12 ++++++------ Business/WaitToLoadMenu.cs | 12 ++++++------ Config/Config.cs | 8 ++++---- DataClasses/RowData.cs | 10 ++++++---- Helpers/DgvMouseRow.cs | 4 ++-- Helpers/Fading.cs | 4 ++-- NativeDllImport/BringWindowToTop.cs | 12 ++++++------ NativeDllImport/CreatePopupMenu.cs | 2 +- NativeDllImport/DestroyIcon.cs | 2 +- NativeDllImport/DestroyMenu.cs | 2 +- NativeDllImport/FindExecuteable.cs | 2 +- NativeDllImport/FindWindow.cs | 2 +- NativeDllImport/GetDeviceCaps.cs | 2 +- NativeDllImport/GetIcon.cs | 2 +- NativeDllImport/GetMenuDefaultItem.cs | 2 +- NativeDllImport/IsTouchEnabled.cs | 2 +- NativeDllImport/RegisterHotKey.cs | 8 ++++---- NativeDllImport/SHAppBarMessage.cs | 2 +- NativeDllImport/SHGetDesktopFolder.cs | 2 +- NativeDllImport/SHGetFileInfo.cs | 2 +- NativeDllImport/SHGetFolderPath.cs | 2 +- NativeDllImport/ShowInactiveTopmost.cs | 2 +- NativeDllImport/ShowWindow.cs | 2 +- NativeDllImport/StrCmpLogicalW.cs | 2 +- NativeDllImport/StrRetToBuf.cs | 2 +- NativeDllImport/TrackPopupMenuEx.cs | 2 +- Properties/AssemblyInfo.cs | 4 ++-- SystemTrayMenu.csproj | 5 +++-- UserInterface/AboutBox.Designer.cs | 2 +- UserInterface/AboutBox.cs | 7 +++---- UserInterface/AppNotifyIcon.cs | 6 +++--- UserInterface/FolderBrowseDialog/NativeMethods.cs | 2 +- UserInterface/Menu.cs | 6 +++--- UserInterface/SettingsForm.cs | 2 +- Utilities/FolderOptions.cs | 6 +++--- 36 files changed, 76 insertions(+), 74 deletions(-) diff --git a/Business/KeyboardInput.cs b/Business/KeyboardInput.cs index df086d4..a5e1fea 100644 --- a/Business/KeyboardInput.cs +++ b/Business/KeyboardInput.cs @@ -20,7 +20,7 @@ namespace SystemTrayMenu.Handler private readonly KeyboardHook hook = new KeyboardHook(); private int iRowKey = -1; - private int iMenuKey = 0; + private int iMenuKey; public KeyboardInput(Menu[] menus) { @@ -39,7 +39,7 @@ namespace SystemTrayMenu.Handler internal event EventHandlerEmpty Cleared; - internal bool InUse { get; set; } = false; + internal bool InUse { get; set; } public void Dispose() { diff --git a/Business/Menus.cs b/Business/Menus.cs index d7f0bc8..620c064 100644 --- a/Business/Menus.cs +++ b/Business/Menus.cs @@ -29,15 +29,15 @@ namespace SystemTrayMenu.Business private readonly DgvMouseRow dgvMouseRow = new DgvMouseRow(); private readonly WaitToLoadMenu waitToOpenMenu = new WaitToLoadMenu(); - private readonly KeyboardInput keyboardInput = null; + private readonly KeyboardInput keyboardInput; private readonly Timer timerStillActiveCheck = new Timer(); private readonly WaitLeave waitLeave = new WaitLeave(MenuDefines.TimeUntilClose); private DateTime deactivatedTime = DateTime.MinValue; private OpenCloseState openCloseState = OpenCloseState.Default; - private RowData loadingRowData = null; - private bool showingMessageBox = false; + private RowData loadingRowData; + private bool showingMessageBox; private TaskbarPosition taskbarPosition = new WindowsTaskbar().Position; - private bool searchTextChanging = false; + private bool searchTextChanging; public Menus() { @@ -480,7 +480,7 @@ namespace SystemTrayMenu.Business menuToDispose.CmdKeyProcessed -= keyboardInput.CmdKeyProcessed; menuToDispose.SearchTextChanging -= keyboardInput.SearchTextChanging; menuToDispose.SearchTextChanged -= Menu_SearchTextChanged; - DataGridView dgv = menuToDispose?.GetDataGridView(); + DataGridView dgv = menuToDispose.GetDataGridView(); if (dgv != null) { dgv.CellMouseEnter -= dgvMouseRow.CellMouseEnter; @@ -501,7 +501,7 @@ namespace SystemTrayMenu.Business } } - menuToDispose?.Dispose(); + menuToDispose.Dispose(); } } diff --git a/Business/WaitToLoadMenu.cs b/Business/WaitToLoadMenu.cs index 70dc82d..f418405 100644 --- a/Business/WaitToLoadMenu.cs +++ b/Business/WaitToLoadMenu.cs @@ -14,12 +14,12 @@ namespace SystemTrayMenu.Handler internal class WaitToLoadMenu : IDisposable { private readonly Timer timerStartLoad = new Timer(); - private DataGridView dgv = null; - private int rowIndex = 0; - private DataGridView dgvTmp = null; - private int rowIndexTmp = 0; + private DataGridView dgv; + private int rowIndex; + private DataGridView dgvTmp; + private int rowIndexTmp; - private int mouseMoveEvents = 0; + private int mouseMoveEvents; private DateTime dateTimeLastMouseMoveEvent = DateTime.Now; private bool checkForMouseActive = true; @@ -37,7 +37,7 @@ namespace SystemTrayMenu.Handler internal event Action MouseEnterOk; - internal bool MouseActive { get; set; } = false; + internal bool MouseActive { get; set; } public void Dispose() { diff --git a/Config/Config.cs b/Config/Config.cs index 7f0da80..bbc1668 100644 --- a/Config/Config.cs +++ b/Config/Config.cs @@ -15,10 +15,10 @@ namespace SystemTrayMenu public static class Config { - private static bool readDarkModeDone = false; - private static bool isDarkMode = false; - private static bool readHideFileExtdone = false; - private static bool isHideFileExtension = false; + private static bool readDarkModeDone; + private static bool isDarkMode; + private static bool readHideFileExtdone; + private static bool isHideFileExtension; public static bool IsHideFileExtdone => IsHideFileExtension(); diff --git a/DataClasses/RowData.cs b/DataClasses/RowData.cs index fe063c8..5e5e2b5 100644 --- a/DataClasses/RowData.cs +++ b/DataClasses/RowData.cs @@ -26,9 +26,9 @@ namespace SystemTrayMenu.DataClasses private string workingDirectory; private string arguments; private string text; - private Icon icon = null; + private Icon icon; private bool diposeIcon = true; - private bool isDisposed = false; + private bool isDisposed; internal RowData() { @@ -366,7 +366,8 @@ namespace SystemTrayMenu.DataClasses { Log.Warn( $"path:'{TargetFilePath}', " + - $"iconFile:'{iconFile}'", ex); + $"iconFile:'{iconFile}'", + ex); } else { @@ -404,7 +405,8 @@ namespace SystemTrayMenu.DataClasses { Log.Warn( $"path:'{TargetFilePath}', " + - $"executable:'{executable}'", ex); + $"executable:'{executable}'", + ex); } else { diff --git a/Helpers/DgvMouseRow.cs b/Helpers/DgvMouseRow.cs index 8341539..f7f3041 100644 --- a/Helpers/DgvMouseRow.cs +++ b/Helpers/DgvMouseRow.cs @@ -10,8 +10,8 @@ namespace SystemTrayMenu.Helper public class DgvMouseRow : IDisposable { private readonly Timer timerRaiseRowMouseLeave = new Timer(); - private DataGridView dgv = null; - private DataGridViewCellEventArgs eventArgs = null; + private DataGridView dgv; + private DataGridViewCellEventArgs eventArgs; internal DgvMouseRow() { diff --git a/Helpers/Fading.cs b/Helpers/Fading.cs index b35a9aa..e30950f 100644 --- a/Helpers/Fading.cs +++ b/Helpers/Fading.cs @@ -22,8 +22,8 @@ namespace SystemTrayMenu.UserInterface private readonly Timer timer = new Timer(); private FadingState state = FadingState.Idle; - private double opacity = 0.00; - private bool visible = false; + private double opacity; + private bool visible; internal Fading() { diff --git a/NativeDllImport/BringWindowToTop.cs b/NativeDllImport/BringWindowToTop.cs index eafceee..1247e48 100644 --- a/NativeDllImport/BringWindowToTop.cs +++ b/NativeDllImport/BringWindowToTop.cs @@ -42,27 +42,27 @@ namespace SystemTrayMenu.DllImports } [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern bool IsIconic(IntPtr hWnd); [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern IntPtr GetForegroundWindow(); [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern uint GetWindowThreadProcessId(IntPtr hWnd, IntPtr ProcessId); [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern uint GetCurrentThreadId(); [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern bool AttachThreadInput(uint idAttach, uint idAttachTo, bool fAttach); [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern bool BringWindowToTop(IntPtr hWnd); } } diff --git a/NativeDllImport/CreatePopupMenu.cs b/NativeDllImport/CreatePopupMenu.cs index a883928..5445297 100644 --- a/NativeDllImport/CreatePopupMenu.cs +++ b/NativeDllImport/CreatePopupMenu.cs @@ -19,7 +19,7 @@ namespace SystemTrayMenu.DllImports // The CreatePopupMenu function creates a drop-down menu, submenu, or shortcut menu. The menu is initially empty. You can insert or append menu items by using the InsertMenuItem function. You can also use the InsertMenu function to insert menu items and the AppendMenu function to append menu items. [DllImport("user32", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern IntPtr CreatePopupMenu(); } } diff --git a/NativeDllImport/DestroyIcon.cs b/NativeDllImport/DestroyIcon.cs index a5c51ea..19cb236 100644 --- a/NativeDllImport/DestroyIcon.cs +++ b/NativeDllImport/DestroyIcon.cs @@ -18,7 +18,7 @@ namespace SystemTrayMenu.DllImports } [DllImport("User32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern int DestroyIcon(IntPtr hIcon); } } diff --git a/NativeDllImport/DestroyMenu.cs b/NativeDllImport/DestroyMenu.cs index 819e640..2fd1818 100644 --- a/NativeDllImport/DestroyMenu.cs +++ b/NativeDllImport/DestroyMenu.cs @@ -19,7 +19,7 @@ namespace SystemTrayMenu.DllImports // The DestroyMenu function destroys the specified menu and frees any memory that the menu occupies. [DllImport("user32", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern bool DestroyMenu(IntPtr hMenu); } } diff --git a/NativeDllImport/FindExecuteable.cs b/NativeDllImport/FindExecuteable.cs index 70d33f1..21c16a9 100644 --- a/NativeDllImport/FindExecuteable.cs +++ b/NativeDllImport/FindExecuteable.cs @@ -18,7 +18,7 @@ namespace SystemTrayMenu.DllImports } [DllImport("shell32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern int FindExecutable(string lpFile, string lpDirectory, [Out] StringBuilder lpResult); } } diff --git a/NativeDllImport/FindWindow.cs b/NativeDllImport/FindWindow.cs index 1995ddc..b69e533 100644 --- a/NativeDllImport/FindWindow.cs +++ b/NativeDllImport/FindWindow.cs @@ -18,7 +18,7 @@ namespace SystemTrayMenu.DllImports } [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); } } diff --git a/NativeDllImport/GetDeviceCaps.cs b/NativeDllImport/GetDeviceCaps.cs index 18bb6b6..c5c7574 100644 --- a/NativeDllImport/GetDeviceCaps.cs +++ b/NativeDllImport/GetDeviceCaps.cs @@ -18,7 +18,7 @@ namespace SystemTrayMenu.DllImports } [DllImport("gdi32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern int GetDeviceCaps(IntPtr hdc, int nIndex); } } diff --git a/NativeDllImport/GetIcon.cs b/NativeDllImport/GetIcon.cs index 2b57571..b59ec01 100644 --- a/NativeDllImport/GetIcon.cs +++ b/NativeDllImport/GetIcon.cs @@ -41,7 +41,7 @@ namespace SystemTrayMenu.DllImports /// flags. /// IntPtr. [DllImport("comctl32", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] internal static extern IntPtr ImageList_GetIcon( IntPtr himl, int i, diff --git a/NativeDllImport/GetMenuDefaultItem.cs b/NativeDllImport/GetMenuDefaultItem.cs index 3c86d84..a3ed1a4 100644 --- a/NativeDllImport/GetMenuDefaultItem.cs +++ b/NativeDllImport/GetMenuDefaultItem.cs @@ -19,7 +19,7 @@ namespace SystemTrayMenu.DllImports // Determines the default menu item on the specified menu [DllImport("user32", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern int GetMenuDefaultItem(IntPtr hMenu, bool fByPos, uint gmdiFlags); } } diff --git a/NativeDllImport/IsTouchEnabled.cs b/NativeDllImport/IsTouchEnabled.cs index 2fc9d28..c15a342 100644 --- a/NativeDllImport/IsTouchEnabled.cs +++ b/NativeDllImport/IsTouchEnabled.cs @@ -20,7 +20,7 @@ namespace SystemTrayMenu.DllImports } [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern int GetSystemMetrics(int nIndex); } } diff --git a/NativeDllImport/RegisterHotKey.cs b/NativeDllImport/RegisterHotKey.cs index 0d1d2e7..233ffb2 100644 --- a/NativeDllImport/RegisterHotKey.cs +++ b/NativeDllImport/RegisterHotKey.cs @@ -34,21 +34,21 @@ namespace SystemTrayMenu.DllImports } [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)] + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint virtualKeyCode); [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)] [return: MarshalAs(UnmanagedType.Bool)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern bool UnregisterHotKey(IntPtr hWnd, int id); [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern uint MapVirtualKey(uint uCode, uint uMapType); [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern int GetKeyNameText(uint lParam, [Out] StringBuilder lpString, int nSize); } } diff --git a/NativeDllImport/SHAppBarMessage.cs b/NativeDllImport/SHAppBarMessage.cs index daaae25..f29da4f 100644 --- a/NativeDllImport/SHAppBarMessage.cs +++ b/NativeDllImport/SHAppBarMessage.cs @@ -41,7 +41,7 @@ namespace SystemTrayMenu.DllImports } [DllImport("shell32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern IntPtr SHAppBarMessage(ABM dwMessage, [In] ref APPBARDATA pData); [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] diff --git a/NativeDllImport/SHGetDesktopFolder.cs b/NativeDllImport/SHGetDesktopFolder.cs index 5de7e2b..30d6f4f 100644 --- a/NativeDllImport/SHGetDesktopFolder.cs +++ b/NativeDllImport/SHGetDesktopFolder.cs @@ -19,7 +19,7 @@ namespace SystemTrayMenu.DllImports // Retrieves the IShellFolder interface for the desktop folder, which is the root of the Shell's namespace. [DllImport("shell32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern int SHGetDesktopFolder(out IntPtr ppshf); } } diff --git a/NativeDllImport/SHGetFileInfo.cs b/NativeDllImport/SHGetFileInfo.cs index f12bc31..ea7fdbb 100644 --- a/NativeDllImport/SHGetFileInfo.cs +++ b/NativeDllImport/SHGetFileInfo.cs @@ -30,7 +30,7 @@ namespace SystemTrayMenu.DllImports } [DllImport("Shell32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern IntPtr SHGetFileInfo( string pszPath, uint dwFileAttributes, diff --git a/NativeDllImport/SHGetFolderPath.cs b/NativeDllImport/SHGetFolderPath.cs index 9d57e92..9875203 100644 --- a/NativeDllImport/SHGetFolderPath.cs +++ b/NativeDllImport/SHGetFolderPath.cs @@ -19,7 +19,7 @@ namespace SystemTrayMenu.DllImports } [DllImport("shfolder.dll", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern int SHGetFolderPath(IntPtr hwndOwner, int nFolder, IntPtr hToken, int dwFlags, StringBuilder lpszPath); } } diff --git a/NativeDllImport/ShowInactiveTopmost.cs b/NativeDllImport/ShowInactiveTopmost.cs index 0b631f8..a638ce1 100644 --- a/NativeDllImport/ShowInactiveTopmost.cs +++ b/NativeDllImport/ShowInactiveTopmost.cs @@ -33,7 +33,7 @@ namespace SystemTrayMenu.DllImports } [DllImport("user32.dll", EntryPoint = "SetWindowPos", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern bool SetWindowPos( int hWnd, // Window handle int hWndInsertAfter, // Placement-order handle diff --git a/NativeDllImport/ShowWindow.cs b/NativeDllImport/ShowWindow.cs index 478fcc1..02fc6b0 100644 --- a/NativeDllImport/ShowWindow.cs +++ b/NativeDllImport/ShowWindow.cs @@ -13,7 +13,7 @@ namespace SystemTrayMenu.DllImports public static partial class NativeMethods { [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); } } diff --git a/NativeDllImport/StrCmpLogicalW.cs b/NativeDllImport/StrCmpLogicalW.cs index d8437e4..b04b504 100644 --- a/NativeDllImport/StrCmpLogicalW.cs +++ b/NativeDllImport/StrCmpLogicalW.cs @@ -17,7 +17,7 @@ namespace SystemTrayMenu.DllImports } [DllImport("shlwapi.dll", ExactSpelling = true, SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern int StrCmpLogicalW(string x, string y); } } diff --git a/NativeDllImport/StrRetToBuf.cs b/NativeDllImport/StrRetToBuf.cs index 7fca0b0..ba412bb 100644 --- a/NativeDllImport/StrRetToBuf.cs +++ b/NativeDllImport/StrRetToBuf.cs @@ -20,7 +20,7 @@ namespace SystemTrayMenu.DllImports // Takes a STRRET structure returned by IShellFolder::GetDisplayNameOf, converts it to a string, and places the result in a buffer. [DllImport("shlwapi.dll", EntryPoint = "StrRetToBuf", ExactSpelling = false, SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern int StrRetToBuf(IntPtr pstr, IntPtr pidl, StringBuilder pszBuf, int cchBuf); } } diff --git a/NativeDllImport/TrackPopupMenuEx.cs b/NativeDllImport/TrackPopupMenuEx.cs index b8a9104..85ad99b 100644 --- a/NativeDllImport/TrackPopupMenuEx.cs +++ b/NativeDllImport/TrackPopupMenuEx.cs @@ -55,7 +55,7 @@ namespace SystemTrayMenu.DllImports // The TrackPopupMenuEx function displays a shortcut menu at the specified location and tracks the selection of items on the shortcut menu. The shortcut menu can appear anywhere on the screen. [DllImport("user32.dll", ExactSpelling = true, SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] private static extern uint TrackPopupMenuEx(IntPtr hmenu, TPM flags, int x, int y, IntPtr hwnd, IntPtr lptpm); } } diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 49b6715..3ac235c 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -39,5 +39,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.17.15")] -[assembly: AssemblyFileVersion("1.0.17.15")] +[assembly: AssemblyVersion("1.0.17.16")] +[assembly: AssemblyFileVersion("1.0.17.16")] diff --git a/SystemTrayMenu.csproj b/SystemTrayMenu.csproj index b4bfc13..6619114 100644 --- a/SystemTrayMenu.csproj +++ b/SystemTrayMenu.csproj @@ -223,11 +223,12 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/UserInterface/AboutBox.Designer.cs b/UserInterface/AboutBox.Designer.cs index 0a210d5..e470d78 100644 --- a/UserInterface/AboutBox.Designer.cs +++ b/UserInterface/AboutBox.Designer.cs @@ -1,6 +1,6 @@ namespace SystemTrayMenu.UserInterface { - partial class AboutBox + internal partial class AboutBox { /// /// Required designer variable. diff --git a/UserInterface/AboutBox.cs b/UserInterface/AboutBox.cs index b45339c..70d5664 100644 --- a/UserInterface/AboutBox.cs +++ b/UserInterface/AboutBox.cs @@ -26,9 +26,9 @@ namespace SystemTrayMenu.UserInterface /// http://www.forestmoon.com /// . /// - public partial class AboutBox : Form + internal partial class AboutBox : Form { - private bool isPainted = false; + private bool isPainted; private string entryAssemblyName; private string callingAssemblyName; private string executingAssemblyName; @@ -814,8 +814,7 @@ namespace SystemTrayMenu.UserInterface int intResult = string.Compare( ((ListViewItem)x).SubItems[intCol].Text, ((ListViewItem)y).SubItems[intCol].Text, - CultureInfo.InvariantCulture, - CompareOptions.None); + StringComparison.Ordinal); if (isAscending) { return intResult; diff --git a/UserInterface/AppNotifyIcon.cs b/UserInterface/AppNotifyIcon.cs index 07d093a..f7761a8 100644 --- a/UserInterface/AppNotifyIcon.cs +++ b/UserInterface/AppNotifyIcon.cs @@ -19,7 +19,7 @@ namespace SystemTrayMenu.UserInterface private const int Interval60FPS = 16; // 60fps=>1s/60fps=~16.6ms private readonly Timer load = new Timer(); private readonly NotifyIcon notifyIcon = new NotifyIcon(); - private readonly int indexLoad = 0; + private readonly int indexLoad; private readonly List bitmapsLoading = new List() { R.L010, R.L020, R.L030, @@ -28,8 +28,8 @@ namespace SystemTrayMenu.UserInterface }; private DateTime timeLoadingStart; - private bool threadsLoading = false; - private int loadCount = 0; + private bool threadsLoading; + private int loadCount; public AppNotifyIcon() { diff --git a/UserInterface/FolderBrowseDialog/NativeMethods.cs b/UserInterface/FolderBrowseDialog/NativeMethods.cs index 22ecedf..303d5a8 100644 --- a/UserInterface/FolderBrowseDialog/NativeMethods.cs +++ b/UserInterface/FolderBrowseDialog/NativeMethods.cs @@ -128,7 +128,7 @@ namespace SystemTrayMenu.UserInterface.FolderBrowseDialog } [DllImport("shell32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - + [DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)] internal static extern int SHCreateItemFromParsingName( [MarshalAs(UnmanagedType.LPWStr)] string pszPath, IntPtr pbc, diff --git a/UserInterface/Menu.cs b/UserInterface/Menu.cs index 253b920..deea082 100644 --- a/UserInterface/Menu.cs +++ b/UserInterface/Menu.cs @@ -18,8 +18,8 @@ namespace SystemTrayMenu.UserInterface internal partial class Menu : Form { private readonly Fading fading = new Fading(); - private bool isShowing = false; - private bool directionToRight = false; + private bool isShowing; + private bool directionToRight; internal Menu() { @@ -155,7 +155,7 @@ namespace SystemTrayMenu.UserInterface TopRight, } - internal int Level { get; set; } = 0; + internal int Level { get; set; } internal bool IsUsable => Visible && !fading.IsHiding && !IsDisposed && !Disposing; diff --git a/UserInterface/SettingsForm.cs b/UserInterface/SettingsForm.cs index 878a453..1e5e265 100644 --- a/UserInterface/SettingsForm.cs +++ b/UserInterface/SettingsForm.cs @@ -18,7 +18,7 @@ namespace SystemTrayMenu.UserInterface public partial class SettingsForm : Form { private readonly string newHotKey = string.Empty; - private bool inHotkey = false; + private bool inHotkey; public SettingsForm() { diff --git a/Utilities/FolderOptions.cs b/Utilities/FolderOptions.cs index a242124..ea21983 100644 --- a/Utilities/FolderOptions.cs +++ b/Utilities/FolderOptions.cs @@ -12,9 +12,9 @@ namespace SystemTrayMenu.Utilities internal static class FolderOptions { - private static bool hideHiddenEntries = false; - private static bool hideSystemEntries = false; - private static IShellDispatch4 iShellDispatch4 = null; + private static bool hideHiddenEntries; + private static bool hideSystemEntries; + private static IShellDispatch4 iShellDispatch4; internal static void Initialize() {