From f20f38fd4d9502a27445b6ce43fa7c98958a1827 Mon Sep 17 00:00:00 2001 From: Chanple Date: Sat, 25 Aug 2018 23:36:03 +0800 Subject: [PATCH] Clean Up --- SmartTaskbar/MenuStyle.cs | 4 ++-- SmartTaskbar/Program.cs | 4 ++-- SmartTaskbar/ResourceCulture.cs | 2 +- SmartTaskbar/Switcher/NotifierLauncher.cs | 2 +- SmartTaskbar/Switcher/SafeNativeMethods.cs | 28 +++++++++++----------- SmartTaskbar/SystemTray.cs | 9 ++++--- 6 files changed, 24 insertions(+), 25 deletions(-) diff --git a/SmartTaskbar/MenuStyle.cs b/SmartTaskbar/MenuStyle.cs index a184b8a..7166a8c 100644 --- a/SmartTaskbar/MenuStyle.cs +++ b/SmartTaskbar/MenuStyle.cs @@ -5,7 +5,7 @@ namespace SmartTaskbar { //https://stackoverflow.com/questions/32786250/windows-10-styled-contextmenustrip - class Win10ColorTable : ProfessionalColorTable + internal class Win10ColorTable : ProfessionalColorTable { public override Color MenuItemBorder => Color.WhiteSmoke; @@ -18,7 +18,7 @@ class Win10ColorTable : ProfessionalColorTable public override Color ImageMarginGradientEnd => Color.White; } - class Win10Renderer : ToolStripProfessionalRenderer + internal class Win10Renderer : ToolStripProfessionalRenderer { public Win10Renderer() : base(new Win10ColorTable()) { } diff --git a/SmartTaskbar/Program.cs b/SmartTaskbar/Program.cs index 4a01df6..a393e94 100644 --- a/SmartTaskbar/Program.cs +++ b/SmartTaskbar/Program.cs @@ -4,10 +4,10 @@ namespace SmartTaskbar { - static class Program + internal static class Program { [STAThread] - static void Main() + private static void Main() { //Use a mutex to ensure single instance using (new Mutex(true, "{959d3545-aa5c-42a8-a327-6e2c079daa94}", out bool createNew)) diff --git a/SmartTaskbar/ResourceCulture.cs b/SmartTaskbar/ResourceCulture.cs index 4e2b6f7..703a42e 100644 --- a/SmartTaskbar/ResourceCulture.cs +++ b/SmartTaskbar/ResourceCulture.cs @@ -5,7 +5,7 @@ namespace SmartTaskbar { - class ResourceCulture + internal class ResourceCulture { private readonly ResourceManager resourceManager = new ResourceManager("SmartTaskbar.Languages.Resource", Assembly.GetExecutingAssembly()); diff --git a/SmartTaskbar/Switcher/NotifierLauncher.cs b/SmartTaskbar/Switcher/NotifierLauncher.cs index 0d54a87..2becc32 100644 --- a/SmartTaskbar/Switcher/NotifierLauncher.cs +++ b/SmartTaskbar/Switcher/NotifierLauncher.cs @@ -6,7 +6,7 @@ namespace SmartTaskbar { - class NotifierLauncher + internal class NotifierLauncher { private readonly Process notifier = new Process(); /// diff --git a/SmartTaskbar/Switcher/SafeNativeMethods.cs b/SmartTaskbar/Switcher/SafeNativeMethods.cs index 59c06ee..42c0a31 100644 --- a/SmartTaskbar/Switcher/SafeNativeMethods.cs +++ b/SmartTaskbar/Switcher/SafeNativeMethods.cs @@ -6,7 +6,7 @@ namespace SmartTaskbar { [SuppressUnmanagedCodeSecurity] - static class SafeNativeMethods + internal static class SafeNativeMethods { public const int MSG_MAX = 0x501; @@ -159,26 +159,26 @@ public static void AddProcess(IntPtr handle) [StructLayout(LayoutKind.Sequential)] private struct JOBOBJECT_BASIC_LIMIT_INFORMATION { - public Int64 PerProcessUserTimeLimit; - public Int64 PerJobUserTimeLimit; - public UInt32 LimitFlags; + public long PerProcessUserTimeLimit; + public long PerJobUserTimeLimit; + public uint LimitFlags; public UIntPtr MinimumWorkingSetSize; public UIntPtr MaximumWorkingSetSize; - public UInt32 ActiveProcessLimit; - public Int64 Affinity; - public UInt32 PriorityClass; - public UInt32 SchedulingClass; + public uint ActiveProcessLimit; + public long Affinity; + public uint PriorityClass; + public uint SchedulingClass; } [StructLayout(LayoutKind.Sequential)] private struct IO_COUNTERS { - public UInt64 ReadOperationCount; - public UInt64 WriteOperationCount; - public UInt64 OtherOperationCount; - public UInt64 ReadTransferCount; - public UInt64 WriteTransferCount; - public UInt64 OtherTransferCount; + public ulong ReadOperationCount; + public ulong WriteOperationCount; + public ulong OtherOperationCount; + public ulong ReadTransferCount; + public ulong WriteTransferCount; + public ulong OtherTransferCount; } [StructLayout(LayoutKind.Sequential)] diff --git a/SmartTaskbar/SystemTray.cs b/SmartTaskbar/SystemTray.cs index bba77cc..827b05d 100644 --- a/SmartTaskbar/SystemTray.cs +++ b/SmartTaskbar/SystemTray.cs @@ -140,11 +140,10 @@ public SystemTray() animation.Checked = GetTaskbarAnimation(); - if (smallIcon.Enabled) - { - SetIconSize(Settings.Default.IconSize); - smallIcon.Checked = GetIconSize() == SmallIcon; - } + if (!smallIcon.Enabled) return; + + SetIconSize(Settings.Default.IconSize); + smallIcon.Checked = GetIconSize() == SmallIcon; }; notifyIcon.MouseDoubleClick += (s, e) =>