public static Instruction FromScriptCommand(ScriptCommand scriptCommand) { var item = new Instruction(); item.mnemonic = scriptCommand.ToString(); item.description = ProgrammableChip.GetCommandDescription(scriptCommand); item.example = ProgrammableChip.GetCommandExample(scriptCommand); return(item); }
private static void AddScriptCommand(ScriptCommand scriptCommand, XmlDocument xmlDocument, XmlNode root) { var element = xmlDocument.CreateElement("Instruction"); var example = ProgrammableChip.GetCommandExample(scriptCommand); var instructionAttribute = xmlDocument.CreateAttribute("instruction"); instructionAttribute.Value = scriptCommand.ToString(); element.Attributes.Append(instructionAttribute); var exampleAttribute = xmlDocument.CreateAttribute("example"); exampleAttribute.Value = example; element.Attributes.Append(exampleAttribute); var description = ProgrammableChip.GetCommandDescription(scriptCommand); var textNode = xmlDocument.CreateTextNode(description); element.AppendChild(textNode); root.AppendChild(element); }