FindPart() public method

public FindPart ( string query ) : IEnumerable
query string
return IEnumerable
Ejemplo n.º 1
0
        public static DevicePartSpeed FindDeviceByName(DeviceManager manager, string query)
        {
            DevicePartSpeed device = null;
            IEnumerable<object> parts = manager.FindPart(query);
            object firstPart = parts.FirstOrDefault();
            Logger.Instance.WriteVerbose("Found {0} matching device(s)", parts.Count());

            if (firstPart == null || !(firstPart is DevicePartSpeed))
            {
                return null;
            }
            device = firstPart as DevicePartSpeed;

            return device;
        }
Ejemplo n.º 2
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;
        }
        public override void Execute()
        {
            base.Execute();

            DeviceManager manager = new DeviceManager();
            manager.Load();
            XilinxHelper.GetCurrentXilinxToolchain().LoadDevices(manager);

            // Search the entire tree to get information on the device/part/package/family/etc.
            // currently supporting search by device name, and full device name
            // e.g. xc3s100e
            // e.g. xc3s100evq100
            // e.g. xc3s100evq100-5 or xc3s100e-5vq100

            IEnumerable<object> parts = manager.FindPart(Query);
            Logger.Instance.WriteVerbose("Found {0} matching object(s)", parts.Count());

            foreach (object o in parts)
            {
                if (o is Device)
                {
                    DisplayDevice(o as Device, true, true);
                }
                else if (o is DevicePart)
                {
                    DisplayDevicePart(o as DevicePart, true, true);
                }
                else if (o is DevicePartSpeed)
                {
                    DisplayDevicePartSpeed(o as DevicePartSpeed, true, true);
                }
            }

            //DisplayManufacture(manager.Manufacturers.FirstOrDefault(), true, true);
        }