From 709d3ffec7f6d6d62544a3d6694ac30d65ce57f8 Mon Sep 17 00:00:00 2001 From: Christian Rondeau Date: Sat, 29 Apr 2017 14:34:11 -0400 Subject: [PATCH] Use MSBuild 15, make private explicit --- Build.ps1 | 7 +------ GoToWindow.Api/KeyboardHook.cs | 2 +- GoToWindow.Api/WindowEntryFactory.cs | 8 ++++---- GoToWindow.Api/WindowToForeground.cs | 2 +- GoToWindow.Api/WindowsListFactory.cs | 21 ++++++++++----------- GoToWindow/Squirrel/SquirrelUpdater.cs | 2 +- GoToWindow/Windows/FirstRunWindow.xaml.cs | 2 +- Releases/RELEASES | 4 +++- 8 files changed, 22 insertions(+), 26 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index f1e6d98..e2896ec 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -6,12 +6,7 @@ Write-Host "Building Go To Window..." -ForegroundColor Green # ==================================== Functions Function GetMSBuildExe { - [CmdletBinding()] - $DotNetVersion = "14.0" - $RegKey = "HKLM:\software\Microsoft\MSBuild\ToolsVersions\$DotNetVersion" - $RegProperty = "MSBuildToolsPath" - $MSBuildExe = Join-Path -Path (Get-ItemProperty $RegKey).$RegProperty -ChildPath "msbuild.exe" - Return $MSBuildExe + Return "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" } Function ZipFiles($Filename, $Source) diff --git a/GoToWindow.Api/KeyboardHook.cs b/GoToWindow.Api/KeyboardHook.cs index c56e38a..fd6b5aa 100644 --- a/GoToWindow.Api/KeyboardHook.cs +++ b/GoToWindow.Api/KeyboardHook.cs @@ -37,7 +37,7 @@ public struct Kbdllhookstruct private static extern IntPtr GetModuleHandle(string lpModuleName); [DllImport("user32.dll")] - static extern short GetAsyncKeyState(int vKey); + private static extern short GetAsyncKeyState(int vKey); // ReSharper disable InconsistentNaming // ReSharper disable UnusedMember.Local diff --git a/GoToWindow.Api/WindowEntryFactory.cs b/GoToWindow.Api/WindowEntryFactory.cs index 885520f..32ac2ce 100644 --- a/GoToWindow.Api/WindowEntryFactory.cs +++ b/GoToWindow.Api/WindowEntryFactory.cs @@ -7,17 +7,17 @@ namespace GoToWindow.Api public static class WindowEntryFactory { [DllImport("user32.dll")] - static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount); + private static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount); [DllImport("user32.dll")] - static extern int GetWindowTextLength(IntPtr hWnd); + private static extern int GetWindowTextLength(IntPtr hWnd); [DllImport("user32.dll", SetLastError = true)] - static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint processId); + private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint processId); [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] - static extern bool IsIconic(IntPtr hWnd); + private static extern bool IsIconic(IntPtr hWnd); public static WindowEntry Create(IntPtr hWnd) { diff --git a/GoToWindow.Api/WindowToForeground.cs b/GoToWindow.Api/WindowToForeground.cs index 0037bc4..ffe073a 100644 --- a/GoToWindow.Api/WindowToForeground.cs +++ b/GoToWindow.Api/WindowToForeground.cs @@ -67,7 +67,7 @@ public struct RECT public static extern IntPtr GetForegroundWindow(); [DllImport("user32.dll")] - static extern bool SetForegroundWindow(IntPtr hWnd); + private static extern bool SetForegroundWindow(IntPtr hWnd); [DllImport("user32.dll")] public static extern bool AttachThreadInput(uint idAttach, uint idAttachTo, bool fAttach); diff --git a/GoToWindow.Api/WindowsListFactory.cs b/GoToWindow.Api/WindowsListFactory.cs index 7deab20..811908c 100644 --- a/GoToWindow.Api/WindowsListFactory.cs +++ b/GoToWindow.Api/WindowsListFactory.cs @@ -17,7 +17,7 @@ public static class WindowsListFactory private static readonly ILog Log = LogManager.GetLogger(typeof(WindowsListFactory).Assembly, "GoToWindow"); private const int MaxLastActivePopupIterations = 50; - delegate bool EnumWindowsProc(IntPtr hWnd, int lParam); + private delegate bool EnumWindowsProc(IntPtr hWnd, int lParam); public enum GetAncestorFlags { @@ -27,29 +27,29 @@ public enum GetAncestorFlags } [DllImport("user32.dll")] - static extern bool EnumWindows(EnumWindowsProc enumFunc, int lParam); + private static extern bool EnumWindows(EnumWindowsProc enumFunc, int lParam); [DllImport("user32.dll")] - static extern bool IsWindowVisible(IntPtr hWnd); + private static extern bool IsWindowVisible(IntPtr hWnd); [DllImport("user32.dll")] - static extern IntPtr GetShellWindow(); + private static extern IntPtr GetShellWindow(); [DllImport("user32.dll", ExactSpelling = true)] - static extern IntPtr GetAncestor(IntPtr hwnd, GetAncestorFlags flags); + private static extern IntPtr GetAncestor(IntPtr hwnd, GetAncestorFlags flags); [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount); + private static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount); [DllImport("user32.dll")] - static extern IntPtr GetLastActivePopup(IntPtr hWnd); + private static extern IntPtr GetLastActivePopup(IntPtr hWnd); [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] - static extern bool EnumChildWindows(IntPtr hwndParent, EnumWindowsProc lpEnumFunc, IntPtr lParam); + private static extern bool EnumChildWindows(IntPtr hwndParent, EnumWindowsProc lpEnumFunc, IntPtr lParam); [DllImport("user32.dll", SetLastError = true)] - static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId); + private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId); public static WindowsList Load() { @@ -258,8 +258,7 @@ private static IntPtr GetLastVisibleActivePopUpOfWindow(IntPtr window) currentWindow = lastPopUp; } - Log.Warn( - $"Could not find last active popup for window {window} after {MaxLastActivePopupIterations} iterations"); + Log.Warn( $"Could not find last active popup for window {window} after {MaxLastActivePopupIterations} iterations"); return IntPtr.Zero; } } diff --git a/GoToWindow/Squirrel/SquirrelUpdater.cs b/GoToWindow/Squirrel/SquirrelUpdater.cs index c7dce50..c0b4e9a 100644 --- a/GoToWindow/Squirrel/SquirrelUpdater.cs +++ b/GoToWindow/Squirrel/SquirrelUpdater.cs @@ -35,7 +35,7 @@ public static void Dispose() Updater.Dispose(); } - static string GetUpdateUrl() + private static string GetUpdateUrl() { var args = Environment.GetCommandLineArgs(); var updateUrlArgumentIndex = Array.IndexOf(args, "-updateUrl"); diff --git a/GoToWindow/Windows/FirstRunWindow.xaml.cs b/GoToWindow/Windows/FirstRunWindow.xaml.cs index ce1fdd5..4b9af42 100644 --- a/GoToWindow/Windows/FirstRunWindow.xaml.cs +++ b/GoToWindow/Windows/FirstRunWindow.xaml.cs @@ -16,7 +16,7 @@ public FirstRunWindow(IGoToWindowContext context) context.Showing += context_Showing; } - void context_Showing(object sender, EventArgs e) + private void context_Showing(object sender, EventArgs e) { Close(); } diff --git a/Releases/RELEASES b/Releases/RELEASES index 070454e..43a545d 100644 --- a/Releases/RELEASES +++ b/Releases/RELEASES @@ -9,4 +9,6 @@ EB4643E5BB697604318F7F164EC3AA9C6D386B9E https://github.com/christianrondeau/GoT 422CA8187828DB797877DF269A0F46FA1188DCF6 https://github.com/christianrondeau/GoToWindow/releases/download/v0.5.0/GoToWindow-0.5.0-full.nupkg 729945 75DCCAF719F4E44061C00EEEB65E34F89FE94272 https://github.com/christianrondeau/GoToWindow/releases/download/v0.5.1/GoToWindow-0.5.1-delta.nupkg 814219 AFD4F1BF5569DC0C61EEBD58B51DA1DF0EB76331 https://github.com/christianrondeau/GoToWindow/releases/download/v0.5.1/GoToWindow-0.5.1-full.nupkg 818603 -137896C8168805F682C41E7134EF0B78768DDCC4 https://github.com/christianrondeau/GoToWindow/releases/download/v0.5.2/GoToWindow-0.5.2-full.nupkg 818711 \ No newline at end of file +137896C8168805F682C41E7134EF0B78768DDCC4 https://github.com/christianrondeau/GoToWindow/releases/download/v0.5.2/GoToWindow-0.5.2-full.nupkg 818711 +0B73C88C6BD5EF170F2E69005771ADFCCB416D15 https://github.com/christianrondeau/GoToWindow/releases/download/v0.6.1/GoToWindow-0.6.1-delta.nupkg 275980 +65A2746CA01D744D2E8E7578BBB9C948F398972F https://github.com/christianrondeau/GoToWindow/releases/download/v0.6.1/GoToWindow-0.6.1-full.nupkg 811105