public static bool IsCommandArgument(string arg, AppCommand command) { var commandName = command.ToString().ToLower(); var argName = arg.ToLower().TrimStart('-', '/', '\\').Trim(); return(argName == commandName); }
protected override void WndProc(ref Message m) { switch (m.Msg) { case WM_KEYDOWN: case WM_SYSKEYDOWN: case WM_SYSDEADCHAR: Keys keyCode = (Keys)m.WParam; if (keyCode != Keys.ControlKey && keyCode != Keys.ShiftKey && keyCode != Keys.Menu) { SetKey(keyCode | Control.ModifierKeys); } m.Result = IntPtr.Zero; return; case WM_MBUTTONDOWN: switch (m.WParam.ToInt32()) { case MK_MBUTTON: SetKey(Keys.MButton | Control.ModifierKeys); break; case MK_XBUTTON1: SetKey(Keys.XButton1 | Control.ModifierKeys); break; case MK_XBUTTON2: SetKey(Keys.XButton2 | Control.ModifierKeys); break; } m.Result = IntPtr.Zero; return; case WM_MOUSEWHEEL: int delta = m.WParam.ToInt32() >> 16; string k; if (delta > 0) { k = "WheelUp"; } else { k = "WheelDown"; } Keys mods = Control.ModifierKeys; if (mods != Keys.None) { k += ", " + mods.ToString(); } Key = k; m.Result = IntPtr.Zero; return; case WM_APPCOMMAND: AppCommand cmd = Helper.GET_APPCOMMAND_LPARAM(m.LParam.ToInt32()); if (cmd != AppCommand.None && new List <AppCommand>((AppCommand[])Enum.GetValues(typeof(AppCommand))).Contains(cmd)) { Key = cmd.ToString(); } m.Result = IntPtr.Zero; return; default: base.WndProc(ref m); return; } }