示例#1
0
 public static void DisplayDevicePartSpeed(DevicePartSpeed partSpeed, bool forward, bool backward)
 {
     if (backward)
     {
         DisplayDevicePart(partSpeed.Part, false, true);
     }
     Logger.Instance.WriteInfo("        + {0} ({1})", partSpeed.Name, partSpeed.Speed.Name);
 }
示例#2
0
 public DevicePartSpeed CreateSpeed(DeviceSpeed speed)
 {
     DevicePartSpeed partSpeed = FindSpeed(speed);
     if (partSpeed == null)
     {
         partSpeed = new DevicePartSpeed(this, speed);
         Speeds.Add(partSpeed);
     }
     return partSpeed;
 }
 public static void DisplayDevicePartSpeed(DevicePartSpeed partSpeed, bool forward, bool backward)
 {
     if (backward)
     {
         DisplayDevicePart(partSpeed.Part, false, true);
     }
     Logger.Instance.WriteInfo("        + {0} ({1})", partSpeed.Name, partSpeed.Speed.Name);
     foreach (ToolchainReference reference in partSpeed.Toolchains)
     {
         Logger.Instance.WriteInfo("          + Supported by: '{0}'", reference.Id);
     }
 }
示例#4
0
 private static void ParseSpeedDetails(DeviceFamily family, DevicePart part, string speedDetails)
 {
     if (!string.IsNullOrEmpty(speedDetails))
     {
         string[] splitUpSpeeds = speedDetails.Split(new string[] { "    " }, StringSplitOptions.RemoveEmptyEntries);
         foreach (string speed in splitUpSpeeds)
         {
             // Shouldn't start with "("
             if (!speed.StartsWith("("))
             {
                 DeviceSpeed     familySpeed = family.CreateSpeed(speed);
                 DevicePartSpeed partSpeed   = part.CreateSpeed(familySpeed);
             }
         }
     }
 }
示例#5
0
        public static object FindDevice(DeviceManager manager, string query)
        {
            IEnumerable <object> parts = manager.FindPart(query);

            Logger.Instance.WriteDebug("Found {0} matching parts", parts.Count());

            Device          topDevice          = null;
            DevicePart      topDevicePart      = null;
            DevicePartSpeed topDevicePartSpeed = null;

            foreach (object o in parts)
            {
                if (o is Device)
                {
                    topDevice = o as Device;
                }
                else if (o is DevicePart)
                {
                    topDevicePart = o as DevicePart;
                }
                else if (o is DevicePartSpeed)
                {
                    topDevicePartSpeed = o as DevicePartSpeed;
                    // pick the first one of these
                    break;
                }
            }

            if (topDevicePartSpeed != null)
            {
                return(topDevicePartSpeed);
            }
            if (topDevicePart != null)
            {
                return(topDevicePart);
            }
            if (topDevice != null)
            {
                return(topDevice);
            }
            return(null);
        }
示例#6
0
 public virtual void Deserialize(XElement element)
 {
     if (string.Compare(element.Name.ToString(), "devicepart") == 0)
     {
         // Parse the package
         XAttribute packageAttr = element.Attribute("package");
         if (packageAttr != null)
         {
             Package = Parent.Family.FindPackage(packageAttr.Value);
         }
         // Parse the speeds
         XElement speeds = element.Element("speeds");
         if (speeds != null)
         {
             foreach (XElement speedElement in speeds.Elements())
             {
                 DevicePartSpeed speed = new DevicePartSpeed(this);
                 speed.Deserialize(speedElement);
                 Speeds.Add(speed);
             }
         }
     }
 }