private static IEnumerable <AdvCommandInfo> GatherCommands() { var largestValue = Enum.GetValues(typeof(Command)).Cast <int>().Max(); for (var i = 1; ; i++) { var value = (Command)i; // Try CommandGet first range check later, in order to support custom commands var aboveLargest = i > largestValue; #if KK var command = CommandList.CommandGet(value); #elif KKS var command = CommandGenerator.Create(value); #endif if (command != null) { yield return(new AdvCommandInfo(value, command, aboveLargest)); } else if (aboveLargest) { break; } else { AdvEditorPlugin.Logger.LogWarning("Unsupported ADV.Command: " + value); } } }
private static IEnumerable <AdvCommandInfo> GatherCommands() { int largestValue = Enum.GetValues(typeof(Command)).Cast <Command>().Select(value => (int)value).Max(); for (int i = 1; ; i++) { var value = (Command)i; var command = CommandList.CommandGet(value); if (command != null) { yield return(new AdvCommandInfo(value, command)); } else if (i > largestValue) { break; } else { AdvEditorPlugin.Logger.LogWarning("Unsupported ADV.Command: " + value); } } }