/// <summary>
        /// Formats installation operation result.
        /// </summary>
        /// <param name="operationResultCode">Operation result code</param>
        /// <param name="updateCollectionWrapper">Collection from which the formatted result will be created.</param>
        /// <returns></returns>

        public WindowsUpdateOperationResult FormatInstallationResult(OperationResultCode operationResultCode, WUCollectionWrapper updateCollectionWrapper, DateTime operationStartTime)
        {
            return(FormatOperationResult(operationResultCode, updateCollectionWrapper, WindowsUpdateOperationType.Installation, this._serviceSettings.WUQuery, this._serviceSettings.WUFrequency, operationStartTime));
        }
        private WindowsUpdateOperationResult FormatOperationResult(OperationResultCode operationResultCode, WUCollectionWrapper updateCollectionWrapper, WindowsUpdateOperationType operationType, string wuQuery, string wuFrequency, DateTime operationStartTime)
        {
            bool rebootRequired = false;
            IList <WindowsUpdateDetail> details = new List <WindowsUpdateDetail>();

            if (updateCollectionWrapper != null && updateCollectionWrapper.Collection != null)
            {
                foreach (WUUpdateWrapper item in updateCollectionWrapper.Collection.Values)
                {
                    WindowsUpdateDetail updateDetail = new WindowsUpdateDetail();
                    updateDetail.UpdateId    = item.Update.Identity.UpdateID;
                    updateDetail.Title       = item.Update.Title;
                    updateDetail.Description = item.Update.Description;
                    bool operation = operationType.Equals(WindowsUpdateOperationType.Installation)
                        ? item.IsInstalled
                        : item.IsDownloaded;

                    updateDetail.ResultCode = MatchOperationResult(operation);
                    updateDetail.HResult    = item.HResult;

                    details.Add(updateDetail);

                    rebootRequired = !rebootRequired ? item.Update.RebootRequired : rebootRequired;
                }
            }
            return(new WindowsUpdateOperationResult(this._nodeName, operationStartTime, DateTime.UtcNow, MatchOperationResult(operationResultCode), details, operationType, wuQuery, wuFrequency, rebootRequired));
        }
Пример #3
0
 /// <summary>
 /// Formats search and download operation result.
 /// </summary>
 /// <param name="operationResultCode">Operation result code</param>
 /// <param name="updateCollectionWrapper">Collection from which the formatted result will be created.</param>
 /// <returns></returns>
 public WindowsUpdateOperationResult FormatSearchAndDownloadResult(OperationResultCode operationResultCode, WUCollectionWrapper updateCollectionWrapper)
 {
     return(FormatOperationResult(operationResultCode, updateCollectionWrapper, WindowsUpdateOperationType.SearchAndDownload, this._serviceSettings.WUQuery, this._serviceSettings.WUFrequency));
 }