/// <summary> /// Creates and returns <see cref="AutoPatchingSettings"/> object. /// </summary> protected override void ProcessRecord() { AutoPatchingSettings autoPatchingSettings = new AutoPatchingSettings(); autoPatchingSettings.Enable = (Enable.IsPresent) ? Enable.ToBool() : false; autoPatchingSettings.DayOfWeek = DayOfWeek; autoPatchingSettings.MaintenanceWindowStartingHour = MaintenanceWindowStartingHour; autoPatchingSettings.MaintenanceWindowDuration = MaintenanceWindowDuration; autoPatchingSettings.UpdatePatchingCategory(PatchCategory); WriteObject(autoPatchingSettings); }
private AutoPatchingSettings DeSerializeAutoPatchingSettings(string category, string input) { AutoPatchingSettings aps = new AutoPatchingSettings(); if (!string.IsNullOrEmpty(input)) { try { aps = JsonConvert.DeserializeObject <AutoPatchingSettings>(input); aps.UpdatePatchingCategory(this.ResolvePatchCategoryStringforPowerShell(aps.PatchCategory)); } catch (JsonReaderException jre) { WriteVerboseWithTimestamp("Category:" + category); WriteVerboseWithTimestamp("Message:" + input); WriteVerboseWithTimestamp(jre.ToString()); } } return(aps); }
/// <summary> /// Creates and returns <see cref="AutoPatchingSettings"/> object. /// </summary> protected override void ProcessRecord() { AutoPatchingSettings autoPatchingSettings = new AutoPatchingSettings(); autoPatchingSettings.Enable = (Enable.IsPresent) ? Enable.ToBool() : false; autoPatchingSettings.DayOfWeek = DayOfWeek; autoPatchingSettings.MaintenanceWindowStartingHour = MaintenanceWindowStartingHour; autoPatchingSettings.MaintenanceWindowDuration = MaintenanceWindowDuration; autoPatchingSettings.UpdatePatchingCategory(PatchCategory); WriteObject(autoPatchingSettings); }