/// <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.PatchCategory = 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.PatchCategory = this.ResolvePatchCategoryStringforPowerShell(aps.PatchCategory); } catch (JsonReaderException jre) { WriteVerboseWithTimestamp("Category:" + category); WriteVerboseWithTimestamp("Message:" + input); WriteVerboseWithTimestamp(jre.ToString()); } } return(aps); }
private AutoPatchingSettings DeSerializeAutoPatchingSettings(string category, string input) { AutoPatchingSettings aps = new AutoPatchingSettings(); if (!string.IsNullOrEmpty(input)) { try { aps = JsonConvert.DeserializeObject<AutoPatchingSettings>(input); aps.PatchCategory = this.ResolvePatchCategoryStringforPowerShell(aps.PatchCategory); } catch (JsonReaderException jre) { WriteVerboseWithTimestamp("Category:" + category); WriteVerboseWithTimestamp("Message:" + input); WriteVerboseWithTimestamp(jre.ToString()); } } return aps; }