Skip to content

Commit c52b70b

Browse files
committed
merged changes
2 parents 11a63c8 + f49d175 commit c52b70b

File tree

52 files changed

+10987
-22146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+10987
-22146
lines changed

RetailCoder.VBE/Common/RubberduckHooks.cs

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void Attach()
7777
{
7878
hook.Attach();
7979
hook.MessageReceived += hook_MessageReceived;
80-
}
80+
}
8181

8282
IsAttached = true;
8383
}
@@ -110,7 +110,7 @@ public void Detach()
110110
{
111111
hook.Detach();
112112
hook.MessageReceived -= hook_MessageReceived;
113-
}
113+
}
114114

115115
IsAttached = false;
116116
}
@@ -135,7 +135,7 @@ public void Dispose()
135135
Detach();
136136
}
137137

138-
private IntPtr WindowProc(IntPtr hWnd, int uMsg, int wParam, int lParam)
138+
private IntPtr WindowProc(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam)
139139
{
140140
try
141141
{
@@ -170,45 +170,40 @@ private IntPtr WindowProc(IntPtr hWnd, int uMsg, int wParam, int lParam)
170170
private bool HandleHotkeyMessage(int wParam)
171171
{
172172
var processed = false;
173-
if (GetWindowThread(User32.GetForegroundWindow()) == GetWindowThread(_mainWindowHandle))
174-
{
173+
if (GetWindowThread(User32.GetForegroundWindow()) == GetWindowThread(_mainWindowHandle))
174+
{
175175
var hook = Hooks.OfType<Hotkey>().SingleOrDefault(k => k.HotkeyInfo.HookId == (IntPtr) wParam);
176-
if (hook != null)
177-
{
176+
if (hook != null)
177+
{
178178
hook.OnMessageReceived();
179-
processed = true;
180-
}
179+
processed = true;
180+
}
181181
}
182182
return processed;
183-
}
183+
}
184184

185185
private void HandleActivateAppMessage(int wParam)
186186
{
187187
const int WA_INACTIVE = 0;
188188
const int WA_ACTIVE = 1;
189189
const int WA_CLICKACTIVE = 2;
190190

191-
switch (LoWord(wParam))
192-
{
193-
case WA_ACTIVE:
191+
switch (LoWord(wParam))
192+
{
193+
case WA_ACTIVE:
194194
case WA_CLICKACTIVE:
195-
Attach();
196-
break;
195+
Attach();
196+
break;
197197

198-
case WA_INACTIVE:
199-
Detach();
200-
break;
201-
}
198+
case WA_INACTIVE:
199+
Detach();
200+
break;
201+
}
202202
}
203203

204-
/// <summary>
205-
/// Gets the integer portion of a word
206-
/// </summary>
207-
private static int LoWord(int dw)
204+
private static int LoWord(IntPtr dw)
208205
{
209-
return (dw & 0x8000) != 0
210-
? 0x8000 | (dw & 0x7FFF)
211-
: dw & 0xFFFF;
206+
return unchecked((short)(uint)dw);
212207
}
213208

214209
private IntPtr GetWindowThread(IntPtr hWnd)

RetailCoder.VBE/Common/WinAPI/User32.cs

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -46,44 +46,9 @@ public static class User32
4646
[DllImport("user32.dll")]
4747
public static extern IntPtr SetWindowLong(IntPtr hWnd, int nIndex, WndProc dwNewLong);
4848

49-
/// <summary>
50-
/// Changes an attribute of the specified window.
51-
/// The function also sets the 32-bit (long) value at the specified offset into the extra window memory.
52-
/// </summary>
53-
/// <param name="hWnd">A handle to the window and, indirectly, the class to which the window belongs.</param>
54-
/// <param name="nIndex">The zero-based offset to the value to be set.
55-
/// Valid values are in the range zero through the number of bytes of extra window memory, minus the size of an integer.
56-
/// <see cref="WindowLongFlags"/>.</param>
57-
/// <param name="dwNewLong">The replacement value.</param>
58-
/// <returns>The return value specifies the result of the message processing and depends on the message sent.</returns>
59-
//public static IntPtr SetWindowLongPtr(IntPtr hWnd, WindowLongFlags nIndex, WndProc dwNewLong)
60-
//{
61-
// return IntPtr.Size == 8
62-
// ? SetWindowLongPtr64(hWnd, nIndex, dwNewLong)
63-
// : new IntPtr(SetWindowLong32(hWnd, nIndex, dwNewLong.ToInt32()));
64-
//}
65-
66-
//[DllImport("user32.dll", EntryPoint = "SetWindowLong")]
67-
//private static extern int SetWindowLong32(IntPtr hWnd, WindowLongFlags nIndex, int dwNewLong);
68-
69-
//[DllImport("user32.dll", EntryPoint = "SetWindowLongPtr")]
70-
//private static extern IntPtr SetWindowLongPtr64(IntPtr hWnd, WindowLongFlags nIndex, IntPtr dwNewLong);
71-
72-
73-
/// <summary>
74-
/// Passes message information to the specified window procedure.
75-
/// </summary>
76-
/// <param name="lpPrevWndFunc">The previous window procedure.
77-
/// If this value is obtained by calling the GetWindowLong function with the nIndex parameter set to GWL_WNDPROC or DWL_DLGPROC,
78-
/// it is actually either the address of a window or dialog box procedure, or a special internal value meaningful only to CallWindowProc.</param>
79-
/// <param name="hWnd">A handle to the window procedure to receive the message.</param>
80-
/// <param name="Msg">The message.</param>
81-
/// <param name="wParam">Additional message-specific information. The contents of this parameter depend on the value of the Msg parameter.</param>
82-
/// <param name="lParam">Additional message-specific information. The contents of this parameter depend on the value of the Msg parameter.</param>
83-
/// <returns></returns>
8449
[DllImport("user32.dll")]
85-
public static extern IntPtr CallWindowProc(WndProc lpPrevWndFunc, IntPtr hWnd, int Msg, int wParam, int lParam);
86-
public delegate IntPtr WndProc(IntPtr hWnd, int uMsg, int wParam, int lParam);
50+
public static extern IntPtr CallWindowProc(WndProc lpPrevWndFunc, IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
51+
public delegate IntPtr WndProc(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam);
8752

8853
/// <summary>
8954
/// A pointer to the hook procedure.

RetailCoder.VBE/Inspections/UseMeaningfulNameInspection.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23
using System.Linq;
34
using Rubberduck.Parsing.Symbols;
45
using Rubberduck.Parsing.VBA;
@@ -25,10 +26,11 @@ public UseMeaningfulNameInspection(IMessageBox messageBox, RubberduckParserState
2526
public override IEnumerable<InspectionResultBase> GetInspectionResults()
2627
{
2728
var issues = UserDeclarations
28-
.Where(declaration => declaration.DeclarationType != DeclarationType.ModuleOption &&
29+
.Where(declaration => declaration.DeclarationType != DeclarationType.ModuleOption &&
2930
(declaration.IdentifierName.Length < 3 ||
3031
char.IsDigit(declaration.IdentifierName.Last()) ||
31-
!declaration.IdentifierName.Any(c => new[] {'a', 'e', 'i', 'o', 'u', 'y'}.Contains(c))))
32+
!declaration.IdentifierName.Any(c =>
33+
"aeiouy".Any(a => string.Compare(a.ToString(), c.ToString(), StringComparison.OrdinalIgnoreCase) == 0))))
3234
.Select(issue => new UseMeaningfulNameInspectionResult(this, issue, State, _wrapperFactory, _messageBox))
3335
.ToList();
3436

0 commit comments

Comments
 (0)