/// <summary>
 /// Constructs a new instance of ClientCapability.
 /// See http://51degrees.mobi/Products/DeviceData/PropertyDictionary.aspx
 /// for a full list of available properties.
 /// All the properties used are non-lists and therefore the first
 /// item contained in the values list contains the only available value.
 /// </summary>
 public FiftyOneClientCapability(Device device)
 {
     Initialise(device.GetPropertyValuesAsStrings().ToDictionary(kvp => kvp.Key, kvp => kvp.Value.ToArray()));
     UserAgent = device.UserAgent;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Returns a list of the hardware devices for the vendor requested.
 /// </summary>
 /// <param name="vendor"></param>
 /// <returns></returns>
 private static List<Device> GetVendorDevices(Value vendor)
 {
     var list = new List<Device>();
     foreach (var signature in vendor.Signatures)
     {
         var device = new Device(signature);
         if (list.FirstOrDefault(i =>
             i.HardwareModel == device.HardwareModel) == null)
             list.Add(device);
     }
     return list.OrderBy(i => i.HardwareModel).ToList();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Determines if the two devices are identical.
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <returns></returns>
 private static bool CompareRelatedDevices(Device x, Device y)
 {
     return x.HardwareVendor == y.HardwareVendor &&
         x.IsUnknown == false &&
         String.IsNullOrEmpty(x.SoftwareBrowserCaption) == false &&
         x.DeviceID != y.DeviceID;
 }
Exemplo n.º 4
0
 public static int CompareDeviceNames(Device x, Device y)
 {
     return x.SoftwareBrowserCaption.CompareTo(y.SoftwareBrowserCaption);
 }
Exemplo n.º 5
0
 public static List<Device> GetRelatedInfo(Device device)
 {
     List<Device> list = null;
     if (device.HardwareModel != null)
     {
         var profile = Provider.DataSet.Hardware.Profiles.FirstOrDefault(i =>
             i["HardwareModel"] != null && i["HardwareModel"].Equals(device.HardwareModel));
         if (profile != null)
         {
             list = profile.Signatures.Select(i => new Device(i)).ToList();
         }
     }
     list.Sort(CompareDeviceNames);
     return list;
 }