/// <summary> /// Check if a command exists in the alias dictionary. /// </summary> private static void CheckCommand(CommandExecuteEvent e) { if (aliases == null || !aliases.TryGetValue(e.Args[0], out Alias alias)) { return; } e.Cancelled = true; alias.RunCommand(e.Os, e.Args); }
private static void OnCommandExecute(CommandExecuteEvent args) { Action <OS, string[]> custom = null; foreach (var command in CustomCommands.AllItems) { if (string.Equals(command.Name, args.Args[0], command.CaseSensitive ? StringComparison.InvariantCulture : StringComparison.InvariantCultureIgnoreCase)) { custom = command.CommandAction; break; } } if (custom != null) { args.Found = true; args.Cancelled = true; custom(args.Os, args.Args); } }
private static void OnCommandExecute(CommandExecuteEvent args) { Action <OS, string[]> custom = null; foreach (var command in CustomCommands.AllItems) { if (command.Key == args.Args[0]) { custom = command.Value; break; } } if (custom != null) { args.Found = true; args.Cancelled = true; custom(args.Os, args.Args); } }