protected static List <KeyValuePair <System.Type, CommandInfoAttribute> > GetFilteredSupportedCommands(Flowchart flowchart) { List <KeyValuePair <System.Type, CommandInfoAttribute> > filteredAttributes = BlockEditor.GetFilteredCommandInfoAttribute(commandTypes); filteredAttributes.Sort(BlockEditor.CompareCommandAttributes); filteredAttributes = filteredAttributes.Where(x => flowchart.IsCommandSupported(x.Value)).ToList(); return(filteredAttributes); }
private static void ExportCommandInfo() { // Dump command info List <System.Type> menuTypes = EditorExtensions.FindDerivedTypes(typeof(Command)).ToList(); List <KeyValuePair <System.Type, CommandInfoAttribute> > filteredAttributes = BlockEditor.GetFilteredCommandInfoAttribute(menuTypes); filteredAttributes.Sort(BlockEditor.CompareCommandAttributes); // Build list of command categories List <string> commandCategories = new List <string>(); foreach (var keyPair in filteredAttributes) { CommandInfoAttribute info = keyPair.Value; if (info.Category != "" && !commandCategories.Contains(info.Category)) { commandCategories.Add(info.Category); } } commandCategories.Sort(); var sb = new System.Text.StringBuilder(@"# Command Reference This is the reference documentation for all Fungus commands. "); // Output the commands in each category foreach (string category in commandCategories) { string markdown = "# " + category + " commands # {#" + category.ToLower() + "_commands}\n\n"; markdown += "[TOC]\n"; foreach (var keyPair in filteredAttributes) { CommandInfoAttribute info = keyPair.Value; if (info.Category == category || info.Category == "" && category == "Scripting") { markdown += "# " + info.CommandName + " # {#" + info.CommandName.Replace(" ", "") + "}\n"; markdown += info.HelpText + "\n\n"; markdown += "Defined in " + keyPair.Key.FullName + "\n"; markdown += GetPropertyInfo(keyPair.Key); } } WriteFile(markdown, CommandRefDocPath, category.ToLower(), "_commands.md"); sb.Append("* [").Append(category).Append("](").Append(category.ToLower()).AppendLine("_commands)"); } sb.AppendLine(); WriteFile(sb.ToString(), BaseDocPath, "", "command_reference.md"); }