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

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

            if (speed == null)
            {
                speed = new DeviceSpeed(this, name);
                Speeds.Add(speed);
            }
            return(speed);
        }
Beispiel #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);
         }
     }
 }
Beispiel #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);
                }
            }
        }
        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);
                }
            }
        }
 public DeviceSpeed CreateSpeed(string name)
 {
     DeviceSpeed speed = FindSpeed(name);
     if (speed == null)
     {
         speed = new DeviceSpeed(this, name);
         Speeds.Add(speed);
     }
     return speed;
 }
Beispiel #9
0
 public DevicePartSpeed FindSpeed(DeviceSpeed speed)
 {
     foreach (DevicePartSpeed partSpeed in Speeds)
     {
         if (partSpeed.Speed.Equals(speed))
         {
             return partSpeed;
         }
     }
     return null;
 }
Beispiel #10
0
 public DevicePartSpeed(DevicePart part, DeviceSpeed speed)
 {
     Part  = part;
     Speed = speed;
 }