예제 #1
0
        // -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -



        // -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
        public void addCommandItem(CommandItemVO civo)
        {
            t.log("FormCommandEditorCommandManager.addCommand(CommandItemVO)");

            cvo.addCommandItem(civo);

            fce.fceListController.updateCommandListView();
        }
예제 #2
0
        // -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -



        // -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
        public void getCommandsFromLoadedProfile()
        {
            t.log("CommandManager.getCommandsFromLoadedProfile()");

            fm.setStatus("Parsing profile commands...");

            commands = new List <CommandVO>();

            XmlNodeList xmlCommandsList = fm.profileManager.xmlDoc.SelectNodes("//command");

            //t.log("\t" + "xmlCommandsList.Count = " + xmlCommandsList.Count);
            //t.log("\t" + "xmlCommandsList.GetType = " + xmlCommandsList.GetType());


            t.log("------------------------------------------------------------");
            foreach (XmlNode commandRootNode in xmlCommandsList)
            {
                //t.log("\t" + commandRootNode.ChildNodes[0].InnerText.ToString());

                // Parse the outer VO (ID = String speech)
                CommandVO cvo = new CommandVO();
                cvo.speech = commandRootNode.ChildNodes[0].InnerText.ToString();

                // Parse the inner VO (list)
                XmlNodeList xmlCommandItems = commandRootNode.SelectNodes("command_sequence/item");
                //t.log("\t\t" + "CommandItem: " + xmlCommandItems.ToString());

                t.log("\n");
                t.log("\t\t" + "command = " + cvo.speech);


                //Console.WriteLine("###### " + commandRootNode.ChildNodes[1].OuterXml.ToString());
                foreach (XmlNode commandItemNode in xmlCommandItems)
                {
                    //t.log("\t\t" + "CommandItem: " + commandItemNode.OuterXml.ToString());
                    //t.log("\t\t\t" + "XML = " + commandItemNode.OuterXml.ToString());

                    String commandItemType = commandItemNode.Attributes[0].Value.ToString();

                    CommandItemVO civo = new CommandItemVO();
                    civo.type = commandItemType;


                    int index = -1;

                    t.log("\t\t" + "commandItemType = " + commandItemType);
                    switch (commandItemType)
                    {
                    case "run application":
                        t.log("\t\t\t" + commandItemNode.ChildNodes[0].InnerXml.ToString());
                        civo.applicationPath = commandItemNode.ChildNodes[0].InnerXml.ToString();

                        t.log("\t\t\t" + commandItemNode.ChildNodes[1].InnerXml.ToString());
                        civo.applicationParams = commandItemNode.ChildNodes[1].InnerXml.ToString();
                        break;

                    case "clipboard":
                        t.log("\t\t\t" + "commandItemNode.InnerText = " + commandItemNode.InnerText.ToString());
                        t.log("\t\t\t" + "commandItemNode.Attributes[1].Value = " + commandItemNode.Attributes[1].Value.ToString());

                        civo.clipboard          = commandItemNode.InnerText.ToString();
                        civo.clipboardAutoPaste = DTools.intStringToBoolean(commandItemNode.Attributes[1].Value.ToString());


                        break;

                    case "clipboard to var":
                        index               = int.Parse(commandItemNode.Attributes[1].Value.ToString());
                        civo.appVarIndex    = index;
                        civo.appVars[index] = Clipboard.GetText();
                        //t.log("\t\t\t" + "index = " + index.ToString());
                        //t.log("\t\t\t" + "civo.appVars[index] = " + civo.appVars[index].ToString());
                        break;

                    case "var to clipboard":
                        //index = int.Parse(commandItemNode.Attributes[1].Value.ToString());
                        //Clipboard.SetText(civo.appVars[index]);
                        break;

                    case "output var":
                        //index = int.Parse(commandItemNode.Attributes[1].Value.ToString());
                        break;

                    case "key":
                        civo.key          = commandItemNode.ChildNodes[0].InnerText.ToString();
                        civo.ctrlPressed  = DTools.intStringToBoolean(commandItemNode.Attributes[1].Value.ToString());
                        civo.altPressed   = DTools.intStringToBoolean(commandItemNode.Attributes[2].Value.ToString());
                        civo.shiftPressed = DTools.intStringToBoolean(commandItemNode.Attributes[3].Value.ToString());
                        break;

                    case "focus on application":
                        break;

                    case "delay":
                        t.log("\t\t\t" + "commandItemNode.Attributes[1].Value = " + commandItemNode.Attributes[1].Value.ToString());
                        civo.delayTime = float.Parse(commandItemNode.Attributes[1].Value);
                        break;
                    }


                    cvo.addCommandItem(civo);
                } // commandItemNode for loop end


                //t.log("\t----------------------------------");

                commands.Add(cvo);
            } // rootCommandNode for loop end
            t.log("------------------------------------------------------------");

            //Console.WriteLine(commands.ToString());

            fm.setStatus("Profile commands parsed...");

            fm.fmCommandListController.updateCommandListView();
        }