public void Update(CancellationToken cancellationToken) { Assert.MethodCalledOnlyOnce(ref _updateHasBeenCalled, "Update"); DebugLogger.Log("Updating."); var strategy = _strategyResolver.Resolve(Context); strategy.Update(cancellationToken); }
public void Update(PatchKit.Unity.Patcher.Cancellation.CancellationToken cancellationToken) { Assert.MethodCalledOnlyOnce(ref _updateHasBeenCalled, "Update"); if (Context.App.IsInstallationBroken() || Context.App.IsFullyInstalled()) { PreUpdate(cancellationToken); } DebugLogger.Log("Updating."); StrategyType type = _strategyResolver.Resolve(Context, cancellationToken); _strategy = _strategyResolver.Create(type, Context); try { _strategy.Update(cancellationToken); } catch (Exception ex) { if (ex is OperationCanceledException || ex is UnauthorizedAccessException || ex is NotEnoughtDiskSpaceException || ex is ThreadInterruptedException || ex is ThreadAbortException) { DebugLogger.LogWarning("Strategy caused exception, to be handled further"); throw; } else { DebugLogger.LogWarningFormat("Strategy caused exception, being handled by fallback: {0}, Trace: {1}", ex, ex.StackTrace); if (!TryHandleFallback(cancellationToken)) { throw; } } } }