Override Configuration class
예제 #1
0
        public OverrideItem Copy()
        {
            var ovr = new Override();

            ovr.Name = Name;
            ovr.Link = Link;
            ovr.Type = Type;

            var result = new OverrideItem(ovr);

            result.Value     = Value;
            result.Timestamp = Timestamp;
            result.Sequence  = Sequence;
            return(result);
        }
예제 #2
0
        public static Configuration Read(XmlDocument xml)
        {
            var result = new Configuration();

            var         root  = xml.DocumentElement;
            XmlNodeList nodes = xml.SelectNodes("/" + root.Name + "/Overrides");

            if (nodes != null)
            {
                if (nodes.Count > 0)
                {
                    XmlNode node = nodes[0];

                    foreach (XmlNode child in node.ChildNodes)
                    {
                        if (child.NodeType == XmlNodeType.Element)
                        {
                            if (child.Name.ToLower() == "override")
                            {
                                var o = new Override();
                                o.Name = Attributes.Get(child, "name");
                                o.Link = Attributes.Get(child, "link");

                                string type = Attributes.Get(child, "type");
                                if (!string.IsNullOrEmpty(type))
                                {
                                    switch (type)
                                    {
                                    case "feedrate_override": o.Type = OverrideType.FEEDRATE_OVERRIDE; break;

                                    case "spindle_override": o.Type = OverrideType.SPINDLE_OVERRIDE; break;

                                    case "rapid_override": o.Type = OverrideType.RAPID_OVERRIDE; break;
                                    }
                                }

                                result.Overrides.Add(o);
                            }
                        }
                    }
                }
            }

            return(result);
        }
        public static Configuration Read(XmlDocument xml)
        {
            var result = new Configuration();

            var root = xml.DocumentElement;
            XmlNodeList nodes = xml.SelectNodes("/" + root.Name + "/Overrides");

            if (nodes != null)
            {
                if (nodes.Count > 0)
                {
                    XmlNode node = nodes[0];

                    foreach (XmlNode child in node.ChildNodes)
                    {
                        if (child.NodeType == XmlNodeType.Element)
                        {
                            if (child.Name.ToLower() == "override")
                            {
                                var o = new Override();
                                o.Name = Attributes.Get(child, "name");
                                o.Link = Attributes.Get(child, "link");

                                string type = Attributes.Get(child, "type");
                                if (!string.IsNullOrEmpty(type))
                                {
                                    switch (type)
                                    {
                                        case "feedrate_override": o.Type = OverrideType.FEEDRATE_OVERRIDE; break;
                                        case "spindle_override": o.Type = OverrideType.SPINDLE_OVERRIDE; break;
                                        case "rapid_override": o.Type = OverrideType.RAPID_OVERRIDE; break;
                                    }
                                }

                                result.Overrides.Add(o);
                            }
                        }
                    }
                }
            }

            return result;
        }
예제 #4
0
 public OverrideItem(Override o)
 {
     Name = o.Name;
     Link = o.Link;
     Type = o.Type;
 }
예제 #5
0
        public OverrideItem Copy()
        {
            var ovr = new Override();
            ovr.Name = Name;
            ovr.Link = Link;
            ovr.Type = Type;

            var result = new OverrideItem(ovr);
            result.Value = Value;
            result.Timestamp = Timestamp;
            result.Sequence = Sequence;
            return result;
        }
예제 #6
0
 public OverrideItem(Override o)
 {
     Name = o.Name;
     Link = o.Link;
     Type = o.Type;
 }