Esempio n. 1
0
        private void AddProject(CONF.XmlLoad X)
        {
            Project P = new Project(ProjectPath);

            string File = X.GetAttribute("path");
            if (P.Load(ProjectPath + "\\" + File))
            {
                ProjectList.Add(P);
            }
            else
            {
                Log.WriteLine(String.Format("Could not load project file: {0:s}", File));
            }
        }
Esempio n. 2
0
        private Options.OptionText LoadText(string Name, CONF.XmlLoad X)
        {
            var O = new Options.OptionText(Name);

            var Def = X.GetAttribute("default");
            if (Def != null) O.Default = Def;

            var N = X.GetAttribute("name");
            if (N != null) O.ParamName = N;

            return O;
        }
Esempio n. 3
0
        private void LoadSupportedTypes(CONF.XmlLoad X)
        {
            while (X.Read())
             {
                 switch (X.ElementName)
                 {
                     case "type": ControllerTypes.Add(X.GetAttribute("value")); break;
                 }
             }

             X.Close();
        }
Esempio n. 4
0
        private void LoadOptions(CONF.XmlLoad X)
        {
            while (X.Read())
            {
                switch (X.ElementName)
                {
                    case "list": Ops.Add(LoadList(X.GetAttribute("label"), X.GetSubtree())); break;
                    case "text": Ops.Add(LoadText(X.GetAttribute("label"), X)); break;
                }
            }

            X.Close();
        }
Esempio n. 5
0
        private void LoadOption(Options.OptionList O, CONF.XmlLoad Base, CONF.XmlLoad X)
        {
            var I = new Options.OptionListItem(Base.GetAttribute("label"));
            I.Default = (Base.GetAttribute("default") != null);

            while (X.Read())
            {
                switch (X.ElementName)
                {
                    case "value":
                        string N = X.GetAttribute("name");
                        string V = X.GetAttribute("val");

                        if(N != null) I.setString(N, V);
                        break;
                }
            }

            X.Close();
            O.AddItem(I);
        }
Esempio n. 6
0
        private ToolAction LoadAction(CONF.XmlLoad X)
        {
            ToolAction A = new ToolAction();

            while (X.Read())
            {
                switch (X.ElementName)
                {
                    case "command": A.Command = X.GetAttribute("value"); break;
                    case "toolpath": A.CustomToolPath = X.GetAttribute("value"); break;
                    case "params":
                        {
                            CONF.XmlLoad Subtree = X.GetSubtree();
                            while (Subtree.Read())
                            {
                                var Name = Subtree.ElementName;
                                var Def = Subtree.GetAttribute("default") ?? "";

                                A.Defaults.setString(Name, Def);
                            }
                            Subtree.Close();
                        }
                        break;
                    case "error":
                        {
                            CONF.XmlLoad Subtree = X.GetSubtree();
                            while (Subtree.Read())
                            {
                                switch (Subtree.ElementName)
                                {
                                    case "string": A.ErrorMask.Add(Subtree.GetAttribute("value")); break;
                                }
                            }
                            Subtree.Close();
                        }
                        break;
                    case "internal":
                        {
                            CONF.XmlLoad Subtree = X.GetSubtree();
                            while (Subtree.Read())
                            {
                                switch (Subtree.ElementName)
                                {
                                    case "string": A.Write.Add(Subtree.GetAttribute("value")); break;
                                }
                            }
                            Subtree.Close();
                        }
                        break;
                }
            }

            return A;
        }
Esempio n. 7
0
        private void LoadActions(Script S, CONF.XmlLoad X)
        {
            while (X.Read())
            {
                string Value = X.GetAttribute("value");
                string Comment = X.GetAttribute("comment");
                Tool.Options.OptionListItem Params = new Tool.Options.OptionListItem("values");

                string[] Args = X.GetAttributeNames();
                for (int i = 0; i < Args.Length; i++)
                {
                    var N = Args[i];
                    if ((N.CompareTo("value") == 0) || (N.CompareTo("comment") == 0)) continue;

                    Params.setString(N, X.GetAttribute(N));
                }

                switch (X.ElementName)
                {
                    case "erase": S.Actions.Add(new ScriptAction("erase", Value, Comment, Params)); break;
                    case "option": S.Actions.Add(new ScriptAction("option", Value, Comment, Params)); break;
                    case "wflash": S.Actions.Add(new ScriptAction("wflash", Value, Comment, Params)); break;
                    case "wdata": S.Actions.Add(new ScriptAction("wdata", Value, Comment, Params)); break;
                    case "vflash": S.Actions.Add(new ScriptAction("vflash", Value, Comment, Params)); break;
                    case "vdata": S.Actions.Add(new ScriptAction("vdata", Value, Comment, Params)); break;
                    case "external": S.Actions.Add(new ScriptAction("external", Value, Comment, Params)); break;
                    case "lock": S.Actions.Add(new ScriptAction("lock", Value, Comment, Params)); break;
                    case "launch": S.Actions.Add(new ScriptAction("launch", Value, Comment, Params)); break;
                    case "copy": S.Actions.Add(new ScriptAction("copy", Value, Comment, Params)); break;
                    case "copyto": S.Actions.Add(new ScriptAction("copyto", Value, Comment, Params)); break;
                    case "convert": S.Actions.Add(new ScriptAction("convert", Value, Comment, Params)); break;

                    default: S.Actions.Add(new ScriptAction(X.ElementName, Value, Comment, Params)); break;
                }
            }

            X.Close();
        }
Esempio n. 8
0
        private void LoadScript(CONF.XmlLoad X)
        {
            Script S = new Script();
            Scripts.Add(S);

            if (X.HasAttribute("version"))
                S.Version = X.GetAttribute("version");

            while (X.Read())
            {
                switch (X.ElementName)
                {
                    case "name": S.Name = X.GetAttribute("value"); break;
                    case "device": S.Device = X.GetAttribute("value"); break;
                    case "cathegory": S.Cathegory = X.GetIntAttribute("value"); break;
                    case "input":
                        S.Input = X.GetAttribute("value");
                        S.Default = X.GetAttribute("default");
                        break;
                    case "steps": LoadActions(S, X.GetSubtree()); break;
                    case "default": S.DefaultScript = true; break;
                    case "autorun": S.Autorun = true; break;
                    case "old": S.Old = true; break;
                }
            }

            X.Close();
        }