Inheritance: IXmlSerializable
Esempio n. 1
0
 public DevicePartSpeed CreateSpeed(DeviceSpeed speed)
 {
     DevicePartSpeed partSpeed = FindSpeed(speed);
     if (partSpeed == null)
     {
         partSpeed = new DevicePartSpeed(this, speed);
         Speeds.Add(partSpeed);
     }
     return partSpeed;
 }
Esempio n. 2
0
 public DevicePartSpeed FindSpeed(DeviceSpeed speed)
 {
     foreach (DevicePartSpeed partSpeed in Speeds)
     {
         if (partSpeed.Speed.Equals(speed))
         {
             return(partSpeed);
         }
     }
     return(null);
 }
Esempio n. 3
0
        public DevicePartSpeed CreateSpeed(DeviceSpeed speed)
        {
            DevicePartSpeed partSpeed = FindSpeed(speed);

            if (partSpeed == null)
            {
                partSpeed = new DevicePartSpeed(this, speed);
                Speeds.Add(partSpeed);
            }
            return(partSpeed);
        }
Esempio n. 4
0
        public DeviceSpeed CreateSpeed(string name)
        {
            DeviceSpeed speed = FindSpeed(name);

            if (speed == null)
            {
                speed = new DeviceSpeed(this, name);
                Speeds.Add(speed);
            }
            return(speed);
        }
Esempio n. 5
0
 public virtual void Deserialize(XElement element)
 {
     if (string.Compare(element.Name.ToString(), "devicepartspeed") == 0)
     {
         // Parse the package
         XAttribute speedAttr = element.Attribute("speed");
         if (speedAttr != null)
         {
             Speed = Part.Parent.Family.FindSpeed(speedAttr.Value);
         }
     }
 }
Esempio n. 6
0
        public virtual void Deserialize(XElement element)
        {
            if (string.Compare(element.Name.ToString(), "devicefamily") == 0)
            {
                XAttribute nameAttr = element.Attribute("name");
                if (nameAttr != null)
                {
                    Name = nameAttr.Value;
                }
                nameAttr = element.Attribute("shortname");
                if (nameAttr != null)
                {
                    ShortName = nameAttr.Value;
                }

                XElement packages = element.Element("packages");
                foreach (XElement packageElement in packages.Elements())
                {
                    DevicePackage package = new DevicePackage(this);
                    package.Deserialize(packageElement);
                    Packages.Add(package);
                }

                XElement speeds = element.Element("speeds");
                foreach (XElement speedElement in speeds.Elements())
                {
                    DeviceSpeed speed = new DeviceSpeed(this);
                    speed.Deserialize(speedElement);
                    Speeds.Add(speed);
                }

                XElement devices = element.Element("devices");
                foreach (XElement deviceElement in devices.Elements())
                {
                    Device device = new Device(this);
                    device.Deserialize(deviceElement);
                    Devices.Add(device);
                }
            }
        }
Esempio n. 7
0
        public virtual void Deserialize(XElement element)
        {
            if (string.Compare(element.Name.ToString(), "devicefamily") == 0)
            {
                XAttribute nameAttr = element.Attribute("name");
                if (nameAttr != null)
                {
                    Name = nameAttr.Value;
                }
                nameAttr = element.Attribute("shortname");
                if (nameAttr != null)
                {
                    ShortName = nameAttr.Value;
                }
                XAttribute typeAttr = element.Attribute("type");
                if (typeAttr != null)
                {
                    Type = (DeviceType)Enum.Parse(typeof(DeviceType), typeAttr.Value);
                }

                XElement packages = element.Element("packages");
                foreach (XElement packageElement in packages.Elements())
                {
                    DevicePackage package = new DevicePackage(this);
                    package.Deserialize(packageElement);
                    Packages.Add(package);
                }

                XElement speeds = element.Element("speeds");
                foreach (XElement speedElement in speeds.Elements())
                {
                    DeviceSpeed speed = new DeviceSpeed(this);
                    speed.Deserialize(speedElement);
                    Speeds.Add(speed);
                }

                XElement devices = element.Element("devices");
                foreach (XElement deviceElement in devices.Elements())
                {
                    Device device = new Device(this);
                    device.Deserialize(deviceElement);
                    Devices.Add(device);
                }
            }
        }
Esempio n. 8
0
 public DeviceSpeed CreateSpeed(string name)
 {
     DeviceSpeed speed = FindSpeed(name);
     if (speed == null)
     {
         speed = new DeviceSpeed(this, name);
         Speeds.Add(speed);
     }
     return speed;
 }
Esempio n. 9
0
 public DevicePartSpeed FindSpeed(DeviceSpeed speed)
 {
     foreach (DevicePartSpeed partSpeed in Speeds)
     {
         if (partSpeed.Speed.Equals(speed))
         {
             return partSpeed;
         }
     }
     return null;
 }
Esempio n. 10
0
 public DevicePartSpeed(DevicePart part, DeviceSpeed speed)
 {
     Part  = part;
     Speed = speed;
 }