Пример #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;
 }