예제 #1
0
            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);
            }
예제 #2
0
        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);
        }