/// <summary> /// Serialize all field with ManagementObject /// </summary> /// <param name="mj"></param> /// <returns></returns> public _SubDevice Serialize(WprManagementObject mj) { foreach (FieldInfo field in this.GetType().GetFields()) { field.SetValue(this, mj.GetProperty(field.Name)); } return(this); }
/// <summary> /// Serialize all field with ManagementObject only for the specified fields using a custom field destination /// </summary> /// <param name="mj"></param> /// <param name="ConvertAs"></param> /// <returns></returns> public _SubDevice Serialize(WprManagementObject mj, Dictionary <string, string> ConvertAs) { foreach (FieldInfo field in this.GetType().GetFields()) { if (ConvertAs.ContainsKey(field.Name)) { field.SetValue(this, mj.GetProperty(ConvertAs[field.Name])); } } return(this); }
/// <summary> /// Serialize all field with ManagementObject only for the specified fields /// </summary> /// <param name="mj"></param> /// <param name="Fields"></param> /// <returns></returns> public _SubDevice Serialize(WprManagementObject mj, List <String> Fields) { foreach (FieldInfo field in this.GetType().GetFields()) { if (Fields.Contains(field.Name)) { field.SetValue(this, mj.GetProperty(field.Name)); } } return(this); }
public override _SubDevice Extend(dynamic wprObj) { List <WprManagementObject> obj = wprObj as List <WprManagementObject>; WprManagementObject current = obj.Where(d => d.GetProperty("DeviceID").AsSubString(3, 1).Equals(Name.AsSubString(0, 1))).FirstOrDefault(); MaxSpeed = current == null ? null : current.GetProperty("MaxClockSpeed"); if (MaxSpeed == null || PercentProcessorPerformance == null) // use base frequency for tboost { Frequency = ProcessorFrequency; } else { Frequency = new MobProperty((MaxSpeed.AsInt() / 100) * PercentProcessorPerformance.AsInt()); } return(this); }