public void Unregister(IUpdate update) { mUpdates.Remove(update); if (mUpdates.Count + mControls.Count == 0) mTimer.Stop(); }
public void Register(IUpdate update) { if (mUpdates.Count + mControls.Count == 0) mTimer.Start(); mUpdates.Add(update); }
public void UpdateApplication() { if (ApplicationList != null) { AppUpdate = new ExternalUpdate(); AppUpdate.UpdateApplication(ApplicationList); } }
/// <summary> /// Check to see if each external application in the list of applications /// is up to date /// </summary> public void CheckForUpdates() { if (ApplicationList != null) { AppUpdate = new ExternalUpdate(); VersionList = AppUpdate.GetVersion(ApplicationList); } }
public RDP() { handle = freerdp_new(); iUpdate = null; iPrimaryUpdate = null; iSecondaryUpdate = null; iAltSecUpdate = null; hContextNew = new pContextNew(ContextNew); hContextFree = new pContextFree(ContextFree); handle->ContextNew = Marshal.GetFunctionPointerForDelegate(hContextNew); handle->ContextFree = Marshal.GetFunctionPointerForDelegate(hContextFree); freerdp_context_new(handle); }
void AddUpdate(int layerUpdate, IUpdate newUpdate) { if(layerUpdate >= m_LayerUpdateList.Count) { int addCount = (layerUpdate - m_LayerUpdateList.Count )+ 1; for(int i = 0; i < addCount; ++i) { m_LayerUpdateList.Add(null); } } if(m_LayerUpdateList[layerUpdate] == null) { m_LayerUpdateList[layerUpdate] = new LayerUpdate(); } m_LayerUpdateList[layerUpdate].m_UpdateMgr.Add(newUpdate); }
public void OnNewTwitterUpdate(IUpdate update) { lock (_stopLock) { if (_stopped) return; lock (_updateLock) { _aggregatedUpdates.Add(update); } lock (_consumerLock) { foreach (var client in _clients) client.OnNewUpdate(update); } } }
public RDP() { handle = freerdp_new(); iUpdate = null; iPrimaryUpdate = null; iSecondaryUpdate = null; iAltSecUpdate = null; hContextNew = new pContextNew(ContextNew); hContextFree = new pContextFree(ContextFree); handle->ContextNew = Marshal.GetFunctionPointerForDelegate(hContextNew); handle->ContextFree = Marshal.GetFunctionPointerForDelegate(hContextFree); hAuthenticate = new pAuthenticate(Authenticate); hVerifyCertificate = new pVerifyCertificate(VerifyCertificate); handle->Authenticate = Marshal.GetFunctionPointerForDelegate(hAuthenticate); handle->VerifyCertificate = Marshal.GetFunctionPointerForDelegate(hVerifyCertificate); freerdp_context_new(handle); }
/// <summary> /// Approves and update and checks for child target groups /// </summary> /// <param name="update"> /// An update /// </param> /// <param name="targetGroup"> /// A target group /// </param> /// <param name="isTest"> /// Whether we are in test mode /// </param> /// <param name="alreadyProcessed"> /// List of target groups that have already been processed /// </param> public static void ApproveUpdateForTargetGroup( IUpdate update, IComputerTargetGroup targetGroup, bool isTest, List<IComputerTargetGroup> alreadyProcessed) { if (isTest) { Console.Out.WriteLine(" (TEST)" + targetGroup.Name + "."); } else { // 1.0.0.2 issue with Adobe Flash not having an installable update if (update.InstallationBehavior.IsSupported) { if (update.IsDeclined) { Console.Out.WriteLine(" " + update.Title + ": is declined."); } else { update.Approve(UpdateApprovalAction.Install, targetGroup); Console.Out.WriteLine(" " + update.Title + ": approved for install."); } } else { Console.Out.WriteLine(" " + update.Title + ": doesn't support install approval."); } } ComputerTargetGroupCollection children = targetGroup.GetChildTargetGroups(); if (children != null && children.Count > 0) { ApproveUpdate(update, children, isTest, alreadyProcessed); } }
public CommandService(ISearch search, IUpdate update, ILogger logger) { this.search = search; this.update = update; this.logger = logger; }
public void SetUpdateInterface(IUpdate iUpdate) { this.iUpdate = iUpdate; }
/// <summary> /// Checks a superseded update /// </summary> /// <param name="update"> /// The update that is marked as superseded /// </param> /// <param name="approveLicenseAgreement"> /// Whether to approve any license agreement /// </param> /// <param name="isTest"> /// Whether we are in test mode /// </param> /// <param name="recentlyApproved"> /// List of recently approved updates /// </param> /// <param name="shouldApproveUninstalledSupersededUpdate"> /// The should Approve Uninstalled Superseded Update. /// </param> private static void CheckSupersededUpdate( IUpdate update, bool approveLicenseAgreement, bool isTest, List<Guid> recentlyApproved, bool shouldApproveUninstalledSupersededUpdate) { UpdateCollection superseding = update.GetRelatedUpdates(UpdateRelationship.UpdatesThatSupersedeThisUpdate); foreach (IUpdate newUpdate in superseding) { if (newUpdate.IsSuperseded) { continue; } // check if we've already approved this update // this can happen if there has been more than 1 superseded update // and we've come across it during this run // we do it with a list as /test mode doesn't affect the .IsApproved state of an update if (!recentlyApproved.Contains(newUpdate.Id.UpdateId) && !newUpdate.IsApproved) { if (newUpdate.RequiresLicenseAgreementAcceptance) { if (!approveLicenseAgreement) { Console.Out.WriteLine( "Warning: Unable to approve '" + newUpdate.Title + "' as it requires a license agreement and the current settings prevent this."); continue; } newUpdate.AcceptLicenseAgreement(); } ApproveSupersededUpdate( newUpdate, update, isTest, recentlyApproved, shouldApproveUninstalledSupersededUpdate); } return; } }
public void AutomaticFire() { ShootEnd(); _controller = new ShipController(this, true); _shootBehaviour = new AutomaticShoot(_bulletSpawner, spawnerFrontRight, spawnerFrontLeft, new AutomaticBullet(), _sprAuto); }
public UpdateOnInterval(TimeSpan interval, IUpdate updaterToCall) { _interval = interval; _updaterToCall = updaterToCall; }
/// <summary> /// The is update marked for uninstall. /// </summary> /// <param name="update"> /// The update. /// </param> /// <param name="targetGroup"> /// The target group. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> private static bool IsUpdateMarkedForUninstall(IUpdate update, IComputerTargetGroup targetGroup) { UpdateApprovalCollection approvals = update.GetUpdateApprovals(targetGroup); foreach (IUpdateApproval approval in approvals) { if (approval.Action == UpdateApprovalAction.Uninstall) { return true; } } return false; }
/// <summary> /// Initializes a new instance of the <see cref="UpdateAddedEventArgs"/> class. /// </summary> /// <param name="update">The update.</param> public UpdateAddedEventArgs(IUpdate update) { Update = update; }
public void AddObserver(IUpdate observer) { observers.Add(observer); }
public void RegisterInterface(IUpdate iUpdate) { BeginPaint = new BeginPaintDelegate(iUpdate.BeginPaint); EndPaint = new EndPaintDelegate(iUpdate.EndPaint); SetBounds = new SetBoundsDelegate(iUpdate.SetBounds); Synchronize = new SynchronizeDelegate(iUpdate.Synchronize); DesktopResize = new DesktopResizeDelegate(iUpdate.DesktopResize); BitmapUpdate = new BitmapUpdateDelegate(iUpdate.BitmapUpdate); Palette = new PaletteDelegate(iUpdate.Palette); PlaySound = new PlaySoundDelegate(iUpdate.PlaySound); SurfaceBits = new SurfaceBitsDelegate(iUpdate.SurfaceBits); update->BeginPaint = Marshal.GetFunctionPointerForDelegate(BeginPaint); update->EndPaint = Marshal.GetFunctionPointerForDelegate(EndPaint); update->SetBounds = Marshal.GetFunctionPointerForDelegate(SetBounds); update->Synchronize = Marshal.GetFunctionPointerForDelegate(Synchronize); update->DesktopResize = Marshal.GetFunctionPointerForDelegate(DesktopResize); update->BitmapUpdate = Marshal.GetFunctionPointerForDelegate(BitmapUpdate); update->Palette = Marshal.GetFunctionPointerForDelegate(Palette); update->PlaySound = Marshal.GetFunctionPointerForDelegate(PlaySound); update->SurfaceBits = Marshal.GetFunctionPointerForDelegate(SurfaceBits); }
public NewProducts(IUpdate ud) { this.SetUpdateOperation(ud); }
public void _registerUpdate(IUpdate nUpdate) { mUpdates.Add(nUpdate); }
public void OnNewUpdate(IUpdate newData) { Console.WriteLine(newData.Content); }
/// <summary> /// Convert an IUpdate (MS Update model) object to an Update (TopPatch model). /// </summary> /// <param name="iUpdate"></param> /// <returns></returns> private Update ConvertToUpdate(IUpdate iUpdate, IUpdateHistoryEntryCollection history = null) { Update tpUpdate = new Update { Name = iUpdate.Title, VendorId = iUpdate.Identity.UpdateID, FileSize = iUpdate.MaxDownloadSize.ToString(), Description = iUpdate.Description, SupportURL = (iUpdate.MoreInfoUrls.Count <= 0) ? String.Empty : iUpdate.MoreInfoUrls[0], Severity = GetTopPatchSeverity(iUpdate.MsrcSeverity), KB = GetKbString(iUpdate.Title), // Get the KB from the title string. // Getting the date installed of an update is tricky. // Have to go through leaps and bounds. Thank you Microsoft!! DateInstalled = GetDateInstalled(history, iUpdate.Identity.UpdateID), DatePublished = iUpdate.LastDeploymentChangeTime.ToShortDateString(), IsHidden = iUpdate.IsHidden, IsInstalled = iUpdate.IsInstalled }; tpUpdate.TopPatchId = Utils.TopPatch.GenerateTopPatchId(tpUpdate); return tpUpdate; }
public void Add(IUpdate update) { Updated += update.Updated; FixedUpdated += update.FixedUpdated; }
/// <summary> /// 更新操作实例添加主键查询条件 /// </summary> /// <typeparam name="TEntity"></typeparam> /// <param name="update">更新操作实例</param> /// <param name="entity">实体类</param> /// <returns></returns> public static IUpdate <TEntity> WhereByPrimaryKeyFromEntity <TEntity>(this IUpdate <TEntity> update, TEntity entity) where TEntity : class { PrimaryKeyOperator <TEntity> .UpdateWhere(update, entity); return(update); }
public async Task Query() { IQuery <string> query = _database.Products.Query().Join(e => e.Owner).Where(e => e.IsAvailable).OrderBy(e => e.Name).Offset(10).Limit(20).Select(e => e.Name); IDelete batchDelete = _database.Products.Delete().Where(e => e.IsAvailable); IInsert batchInsert = _database.Products.Insert(new Product(), new Product()); IUpdate batchUpdate = _database.Products.Update().Where(e => e.IsAvailable).Set(e => new Product { IsAvailable = false }); IUpdate singleUpdate = _database.Products.Update().Set(e => e.NetPrice, e => e.NetPrice * 1.1m).Set(e => e.DateAdded, DateTime.UtcNow); var(queryResult, deleteAffected, updateAffected, insertAffected) = _database.Execute(query, batchDelete, batchUpdate, batchInsert); (queryResult, deleteAffected, updateAffected, insertAffected) = await _database.ExecuteAsync(query, batchDelete, batchUpdate, batchInsert); string querySql = query.ToSqlString(); string deleteSql = batchDelete.ToSqlString(); string updateSql = batchUpdate.ToSqlString(); string insertSql = batchInsert.ToSqlString(); var product1 = await _database.Products.Query().Where(e => e.Id == 1).Single().ExecuteAsync(); var product2 = await _database.Products.Query().Where(e => e.Id == 2).Single().ExecuteAsync(); var updatedExplicitly = await _database.Products.Update(product1, product2).ExecuteAsync(); var product3 = await _database.Products.Query().Where(e => e.Id == 3).Single().ExecuteAsync(); var product4 = await _database.Products.Query().Where(e => e.Id == 4).Single().ExecuteAsync(); var deletedExplicitly = await _database.Products.Delete(product3, product4).ExecuteAsync(); var copyInsert = _database.ArchivedProducts.InsertFrom(_database.Products.Query().Where(p => !p.IsAvailable && p.DateAdded < DateTime.UtcNow.AddYears(-1)).Select(e => new ArchivedProduct { /* ... */ })); var copiedRows = await copyInsert.ExecuteAsync(); queryResult = _database.ExecuteSql <List <string> >(querySql, new { x = 1 }); queryResult = await _database.ExecuteSqlAsync <List <string> >(querySql, new { x = 1 }); IStoredProcedure <List <ProductDto> > searchedProductsProcedure = _database.SearchProducts("name"); var searchedProducts = searchedProductsProcedure.Execute(); searchedProducts = await searchedProductsProcedure.ExecuteAsync(); searchedProducts = _database.Execute(searchedProductsProcedure); searchedProducts = await _database.ExecuteAsync(searchedProductsProcedure); IFunction <decimal> priceFunction = _database.CalculatePrice(123); var price = priceFunction.Execute(); price = await priceFunction.ExecuteAsync(); price = _database.Execute(priceFunction); price = await _database.ExecuteAsync(priceFunction); _database.Insert(new Product()).Execute(); var product5 = _database.Query <Product>().Where(e => e.Id == 5).Execute(); _database.Update(product5).Execute(); _database.Delete(product5).Execute(); var q1 = _database.Products.Query().Where(e => e.OwnerId == 5); var q2 = _database.Products.Query().Where(e => e.OwnerId == 6); var q3 = _database.Products.Query().Where(e => e.OwnerId == 7); List <Product> unionList123 = q1.Union(q2).UnionAll(q3).Execute(); List <Product> unionList = _database.Products .Query().Where(e => e.OwnerId == 5) .UnionAll() .Query().Where(e => e.OwnerId == 6) .Execute(); var product7 = _database.Query <Product>(options => options.AsEditable().WithComment("my query tag").WithHint("NOLOCK")) .Where(e => e.Id == 7).Execute(); // WITH CTE explicit var cte1 = _database.Query <Product>(); var cte2 = _database.Query(cte1).Where(e => e.IsAvailable); var withQuery = _database.Query(cte2).Where(e => e.NetPrice > 0); // Recursive CTE var managerQuery = _database.Query <Employee>().Where(e => e.ManagerId == null) .Select(e => new EmployeeDto { Id = e.Id, Name = e.Name, ManagerId = e.ManagerId, Level = 1 }); var employeeQuery = _database.Query <Employee>().Join(managerQuery, (l, r) => l.ManagerId == r.Id) .Where((e, mq) => e.Id == 234) .Select((e, mq) => new EmployeeDto { Id = e.Id, Name = e.Name, ManagerId = e.ManagerId, Level = mq.Level + 1 }); var hierarchyUnion = managerQuery.UnionAll(employeeQuery); var employeeHierarchy = _database.Query(hierarchyUnion) .OrderBy(e => e.Level) .ThenOrderByDescending(e => e.ManagerId) .Select(e => new EmployeeHierarchy { Employee = e.Name, Level = e.Level, Manager = _database.Query <Employee>().Where(m => m.Id == e.ManagerId).Select(m => m.Name).First().Execute() }) .Distinct() .Execute(); // Subquery _database.Products.Query().Select(e => new ProductDto()).OrderBy(e => e.Price).Execute(); // Multiquery _database.Query <Product, Owner, Employee>(); _database.Query(_database.Products, _database.AvailableProducts, hierarchyUnion) .Join(managerQuery, (p, _, _, m) => p.Id == m.Id); // Group by var groupedProducts = _database.Query <Product>() .GroupBy(p => new { p.Id, p.Name }) .Having(p => p.Key.Id > 4 && p.Count() > 5 && p.Max(e => e.NetPrice) > 50) .Select(p => new { p.Key.Id, p.Key.Name, Count = p.Count(), Max = p.Max(e => e.NetPrice), CountAvailable = p.Where(e => e.IsAvailable).Count(), MaxAvailable = p.Where(e => e.IsAvailable).Max(e => e.NetPrice), AllAvailable = p.Where(e => e.IsAvailable).Select(e => new { e.Name, e.NetPrice }).AsList() }) .Execute(); // Mapping Product[] productArray = _database.Query <Product>().AsArray().Execute(); Dictionary <int, Product> productByOwnerDict = _database.Query <Product>().AsDictionary(e => e.OwnerId).Execute(); }
/// <summary> /// 更新操作实例添加主键查询条件 /// </summary> /// <typeparam name="TEntity"></typeparam> /// <typeparam name="TPrimary"></typeparam> /// <param name="update">更新操作实例</param> /// <param name="primaryKey">主键</param> /// <returns></returns> public static IUpdate <TEntity> WhereByPrimaryKey <TEntity, TPrimary>(this IUpdate <TEntity> update, TPrimary primaryKey) where TEntity : class { PrimaryKeyOperator <TEntity, TPrimary> .UpdateWhere(update, primaryKey); return(update); }
private static void Update( string topic, IUpdate update, ITopicUpdaterUpdateCallback callback ) { if ( _pagedUpdater == null ) { throw new InvalidOperationException( "The paged updater has not been initialised." ); } _pagedUpdater.Update( topic, update, callback ); }
private void runUpdateProcedure() { lock (mSyncObject) { try { Logger.Debug("START runUpdateProcedure"); mInactivated = false; mStopServiceEvent.Reset(); logSystemInfo(); readLocalConfiguration(); readCentralConfiguration(); getExcludedUpdates(); if (mCentralConfiguration == null) { Logger.DebugFormat("Going idle - Customer name '{0}' was not found in the CustomerConfigurations section.", LocalConfig.CustomerName); inactivate(); return; } if (isServerInExclusionList()) { Logger.Debug("Going idle - Server is present in exclusion list."); inactivate(); return; } if (!isWithinMaintenanceTimeFrame()) { Logger.Debug("Going idle - Not within maintenance timeframe."); inactivate(); return; } trySendSavedReports(); Logger.Debug("Fetching available updates."); IUpdateCollection updates = WindowsUpdateClient.GetAvailableUpdates(); if (updates == null || updates.Count == 0) { Logger.Debug("Going idle - No updates retrieved from WUA."); inactivate(); return; } var updatesToInstall = new UpdateCollectionClass(); var excludedUpdates = new UpdateCollectionClass(); for (int i = 0; i < updates.Count; i++) { IUpdate update = updates[i]; if (!isUpdateExcluded(update)) { updatesToInstall.Add(update); } else { excludedUpdates.Add(update); } } if (updatesToInstall.Count == 0) { if (excludedUpdates.Count > 0) { var entries = UpdateInstallationLog.CreateExcludedLogEntries(excludedUpdates); var log = UpdateInstallationLog.Create(entries); reportUpdateInstallationStatus(log, true); } Logger.Debug("Going idle - No new updates found."); inactivate(); return; } Logger.Debug("Writing event log and monitoring API call."); WindowsTaskHandler.WriteEventLog(Constants.CEventLogId, Constants.CEventLogDescription); WindowsTaskHandler.CallMonitoringApi(); Logger.Debug("Installing updates."); Result result = WindowsUpdateClient.InstallUpdates(updatesToInstall); // add excluded updates to result var excludedEntries = UpdateInstallationLog.CreateExcludedLogEntries(excludedUpdates); result.UpdateInstallationLog.AddRange(excludedEntries); reportStatus(result); if (result.InstallationResult.RebootRequired) { Logger.Debug("Rebooting system."); WindowsTaskHandler.RebootSystem(); } } catch (Exception ex) { Logger.Error(ex); } finally { if (!mInactivated) { inactivate(); } Logger.Debug("FINISH runUpdateProcedure"); mStopServiceEvent.Set(); } } }
internal SupersedesUpdate(IUpdate update) { this._update = update; }
// リストに追加 public static void AddUpdateList(IUpdate update) { updates.Add(update); }
/// <summary> /// Iterates through a collection of updates to approve /// </summary> /// <param name="update"> /// An update /// </param> /// <param name="targetGroups"> /// A collection of target groups /// </param> /// <param name="isTest"> /// Whether we are in test mode /// </param> /// <param name="alreadyProcessed"> /// List of target groups that have already been processed /// </param> private static void ApproveUpdate( IUpdate update, ComputerTargetGroupCollection targetGroups, bool isTest, List<IComputerTargetGroup> alreadyProcessed) { foreach (IComputerTargetGroup group in targetGroups) { if (alreadyProcessed != null) { if (!alreadyProcessed.Contains(@group)) { ApproveUpdateForTargetGroup(update, @group, isTest, alreadyProcessed); alreadyProcessed.Add(@group); } } else { ApproveUpdateForTargetGroup(update, @group, isTest, null); } } }
// リストから削除 public static void RemoveUpdateList(IUpdate update) { updates.Remove(update); }
private void ReportInstallResult(IUpdate update, string reportKey) { try { var request = EndpointManager.GetContract<AbstractReportingContract>(EndPointFunctions.UploadAsyncReport); request.Name = reportKey; request.Value = update.Title; request.MakeRequest<NoContentWrapper>(); } catch (Exception e) { Log.WarnFormat("An exception occurred while reporting update results: {0}", e.Message); } }
public void SimulateOnProgressNow(IUpdate update, int currentIndex, int count, int percent) { OnProgress(update, currentIndex, count, percent); }
public void BaseFire() { ShootEnd(); _controller = new ShipController(this, false); _shootBehaviour = new BaseShoot(_bulletSpawner, spawnerFront, new BaseBullet(), _spr); }
// for monobehavior systems, use this. public void RegisterPerFrameUpdate(IUpdate system) { systems.Add(system); }
public ApiController(IUpdate updateStatusContent, IHubContext <DataHub> dataHubContext) { _updateStatusContent = updateStatusContent; _dataHubContext = dataHubContext; }
// normally not useful. public void UnregisterPerFrameUpdate(IUpdate system) { systems.Remove(system); }
Task <TReturn2> IWriteContext.PerformUpdate <TState, TReturn2>(IUpdate <TState, TReturn2> update) { return(PerformLocal <TState, TReturn2>(update)); }
public void Register(IUpdate updater) { Context.Debug(() => $"Registering {updater.GetType().Name}."); Updater = updater; }
public void Delet(IUpdate update) { Updated -= update.Updated; FixedUpdated -= update.FixedUpdated; }
public static void AddUpdate(IUpdate updater) => sm_Updater?.m_Updates.Add(updater);
public static void RemoveUpdate(IUpdate updater) => sm_Updater?.m_Updates.Remove(updater);
public WindowsUpdate(IUpdate update) { this.BaseIUpdate = update; }
private static UpdateCollection BundleRecursion(IUpdate bundle, Operations.SavedOpData updateData) { var collection = new UpdateCollection(); var index = 0; var updateFolder = Path.Combine(UpdateDirectory, updateData.filedata_app_id); if (!Directory.Exists(updateFolder)) return collection; IList<string> updateFiles = Directory.GetFiles(updateFolder); foreach (IUpdate insideBundle in bundle.BundledUpdates) { //Recursive Call if there are more bundles inside this bundle. if (insideBundle.BundledUpdates.Count > 0) { Logger.Log(" Found bundles inside {0}", LogLevel.Debug, insideBundle.Title); var totalBundles = BundleRecursion(insideBundle, updateData); Logger.Log(" - Loading {0} bundles for {1}", LogLevel.Debug, totalBundles.Count, insideBundle.Title); foreach (IUpdate item in totalBundles) { Logger.Log("Adding {0}", LogLevel.Info, item.Title); collection.Add(item); } } if (insideBundle.IsInstalled != true) { var finalFileCollection = new StringCollection(); List<DownloadUri> nodes = GrabLocalUpdateBundle(bundle.Identity.UpdateID, insideBundle.Title); foreach (var iteration in nodes) { var fileCollection = new StringCollection(); foreach (var item in updateFiles) { var strip = item.Split(new[] {'\\'}); var localFilename = strip[strip.Length - 1]; if (Operations.StringToFileName(localFilename).ToLower() == Operations.StringToFileName(iteration.FileName).ToLower()) { fileCollection.Add(item); finalFileCollection = fileCollection; break; } } } ((IUpdate2)bundle.BundledUpdates[index]).CopyToCache(finalFileCollection); collection.Add(bundle); } index++; } return collection; }
TReturn IUpdateContext <TState> .PerformUpdate <TReturn>(IUpdate <TState, TReturn> update) { return(update.Execute(this)); }
public void Register(IUpdate updater) { _pipeline.Register(updater); }
public updateBusiness(IUpdate Update) { _dataUpdate = Update; }
public MyUpdate(IUpdate upd) { update = upd; }
internal Prerequisite(IUpdate update) { this._update = update; }
public void OnNewFacebookUpdate(IUpdate update) { _repositoryActor.Tell(update); }
/// <summary> /// Approves a superseded update /// Using previous approval settings /// </summary> /// <param name="newUpdate"> /// The new update /// </param> /// <param name="previousUpdate"> /// The previously approved update /// </param> /// <param name="isTest"> /// Whether we are in test mode /// </param> /// <param name="recentlyApproved"> /// List of recently approved updates /// </param> /// <param name="shouldApproveUninstalledSupersededUpdate"> /// Whether an update that has been uninstalled should be approved if superseded. /// </param> private static void ApproveSupersededUpdate( IUpdate newUpdate, IUpdate previousUpdate, bool isTest, List<Guid> recentlyApproved, bool shouldApproveUninstalledSupersededUpdate) { if (isTest) { Console.Out.Write("(TEST) "); } Console.Out.WriteLine(newUpdate.Title); recentlyApproved.Add(newUpdate.Id.UpdateId); if (isTest) { return; } UpdateApprovalCollection approvals = previousUpdate.GetUpdateApprovals(); foreach (IUpdateApproval approval in approvals) { IComputerTargetGroup ctg = approval.GetComputerTargetGroup(); if (approval.Action == UpdateApprovalAction.Uninstall && !shouldApproveUninstalledSupersededUpdate) { // this update has been marked for removal Console.WriteLine( " WARNING: Superseded update is marked for uninstall and settings don't allow it to be automatically approved. Target group: " + ctg.Name); continue; } newUpdate.Approve(UpdateApprovalAction.Install, ctg); Console.Out.WriteLine(" " + ctg.Name); } }
public void OnNewTwitterUpdate(IUpdate update) { _repositoryActor.Tell(update); }
/// <summary> /// Checks a stale update to see if current rules allow it to be approved /// </summary> /// <param name="update"> /// the update /// </param> /// <param name="isTest"> /// whether we are in test most /// </param> /// <param name="approveLicenseAgreement"> /// whether we auto accept license agreements /// </param> private static void CheckStaleUpdate(IUpdate update, bool isTest, bool approveLicenseAgreement) { if (update.RequiresLicenseAgreementAcceptance) { if (!approveLicenseAgreement) { Console.Out.WriteLine( "Warning: Unable to approve '" + update.Title + "' as it requires a license agreement and the current settings prevent this."); return; } if (!isTest) { update.AcceptLicenseAgreement(); } } if (isTest) { Console.Out.Write("(TEST) "); } else { update.RefreshUpdateApprovals(); } Console.Out.WriteLine(update.Title); }
public UpdateComponent(IUpdate <Component> update, IComponentReadOnlyRepository read) { this.update = update; this.read = read; }
private static Application ConvertToApplication(IUpdate iUpdate, IEnumerable history = null, bool isWsusEnabled = false) { var tpUpdate = new Application(); string vendorId; // If a vendor Id is not provided, we create one for it. if ((iUpdate.Identity.UpdateID == null) || (iUpdate.Identity.UpdateID.Equals(String.Empty))) vendorId = Guid.NewGuid().ToString(); else vendorId = iUpdate.Identity.UpdateID; tpUpdate.Name = iUpdate.Title; tpUpdate.VendorName = "Microsoft"; tpUpdate.VendorId = vendorId; tpUpdate.Description = iUpdate.Description; tpUpdate.SupportUrl = (iUpdate.MoreInfoUrls.Count <= 0) ? Settings.EmptyValue : iUpdate.MoreInfoUrls[0]; tpUpdate.VendorSeverity = iUpdate.MsrcSeverity ?? Settings.EmptyValue; tpUpdate.KB = GetKbString(iUpdate.Title); tpUpdate.InstallDate = GetDateInstalled(history, iUpdate.Identity.UpdateID); tpUpdate.ReleaseDate = Tools.ConvertDateToEpoch(iUpdate.LastDeploymentChangeTime.ToString("yyyyMMdd")); tpUpdate.Status = iUpdate.IsInstalled ? "Installed" : "Available"; switch (iUpdate.InstallationBehavior.RebootBehavior) { case InstallationRebootBehavior.irbAlwaysRequiresReboot: tpUpdate.RebootRequired = "yes"; break; case InstallationRebootBehavior.irbCanRequestReboot: tpUpdate.RebootRequired = "possible"; break; case InstallationRebootBehavior.irbNeverReboots: tpUpdate.RebootRequired = "no"; break; } var bundlesForUpdate = GetAllUpdates(iUpdate, isWsusEnabled); if (!iUpdate.IsInstalled) Operations.SaveAvailableUpdateToDisk(iUpdate.Identity.UpdateID, bundlesForUpdate); foreach (var item in bundlesForUpdate) { tpUpdate.FileData.AddRange(item.Value); } return tpUpdate; }
public void Register(IUpdate updater) { Updater = updater; }
public void AddUpdateObject(IUpdate updateObject) { this.updateObjects.Add(updateObject); }
private static Dictionary<string, List<DownloadUri>> GetAllUpdates(IUpdate iUpdate, bool wsusEnabled = false) { var bundleDict = new Dictionary<string, List<DownloadUri>>(); foreach (IUpdate bundle in iUpdate.BundledUpdates) { foreach (IUpdateDownloadContent udc in bundle.DownloadContents) { var downloadContents = new List<DownloadUri>(); if (String.IsNullOrEmpty(udc.DownloadUrl)) continue; var downloadUri = new DownloadUri(); string[] sha1Hash; if (wsusEnabled) { //This uses WSUS Server var sha1Tmp = udc.DownloadUrl.Split('/'); sha1Hash = sha1Tmp[sha1Tmp.Length - 1].Split('.'); } else { //Not a WSUS Server var sha1Tmp = udc.DownloadUrl.Split('_'); sha1Hash = sha1Tmp[sha1Tmp.Length - 1].Split('.'); } downloadUri.Hash = (sha1Hash[0] ?? (sha1Hash[0] = "")); downloadUri.Uri = udc.DownloadUrl; var tempHold = downloadUri.Uri.Split(new[] { '/' }); downloadUri.FileName = tempHold[tempHold.Length - 1]; downloadUri.FileSize = GetUriFileSize(downloadUri.Uri); downloadContents.Add(downloadUri); if (!bundleDict.ContainsKey(bundle.Title)) bundleDict.Add(bundle.Title, downloadContents); } if (bundle.BundledUpdates.Count > 0) { var valuesReturned = GetAllUpdates(bundle); foreach (var data in valuesReturned) { if(!bundleDict.ContainsKey(data.Key)) bundleDict.Add(data.Key, data.Value); } } } return bundleDict; }