/// <summary> /// Creates the disk. /// </summary> /// <param name="model"> /// The model. /// </param> /// <returns> /// The <see cref="MPObject"/>. /// </returns> private MPObject CreateDisk(HWDisk model) { var propertys = this.PhysicalDiskClass.PropertyCollection; // 获取到class的属性 var obj = new MPObject(MGroup.Instance, this.PhysicalDiskClass); // 实例化一个class obj[propertys["UUID"]].Value = model.UUID; obj[propertys["Status"]].Value = model.HealthState; obj[propertys["Locator"]].Value = model.Location; obj[propertys["PresentState"]].Value = model.PresentState; obj[propertys["Diskcapacity"]].Value = string.Empty; obj[propertys["IndterfaceType"]].Value = string.Empty; obj[this.DisplayNameField].Value = model.Name; return(obj); }
/// <summary> /// Updates the disk. /// </summary> /// <param name="model">The model.</param> /// <param name="oldObject">The old object.</param> /// <returns>The <see cref="MonitoringObject" />.</returns> private void UpdateDisk(HWDisk model, MonitoringObject oldObject) { var propertys = this.PhysicalDiskClass.PropertyCollection; // 获取到class的属性 // oldObject[propertys["UUID"]].Value = model.UUID; if (model.HealthState != "-3") { oldObject[propertys["Status"]].Value = model.HealthStateTxt; } oldObject[propertys["Locator"]].Value = model.Location; oldObject[propertys["PresentState"]].Value = model.PresentState; oldObject[propertys["Diskcapacity"]].Value = string.Empty; oldObject[propertys["IndterfaceType"]].Value = string.Empty; oldObject[this.DisplayNameField].Value = model.Name; }
/// <summary> /// Updates the disk. /// </summary> /// <param name="model"> /// The model. /// </param> /// <returns> /// The <see cref="MonitoringObject"/>. /// </returns> private MonitoringObject UpdateDisk(HWDisk model) { var oldObject = this.GetObject($"UUID = '{model.UUID}'", this.PhysicalDiskClass); if (oldObject == null) { return(null); } var propertys = this.PhysicalDiskClass.PropertyCollection; // 获取到class的属性 // oldObject[propertys["UUID"]].Value = model.UUID; oldObject[propertys["Status"]].Value = model.HealthState; oldObject[propertys["Locator"]].Value = model.Location; oldObject[propertys["PresentState"]].Value = model.PresentState; oldObject[propertys["Diskcapacity"]].Value = string.Empty; oldObject[propertys["IndterfaceType"]].Value = string.Empty; oldObject[this.DisplayNameField].Value = model.Name; return(oldObject); }