private void PerformLiveIdAuthenticationTest(ref LiveIdAuthenticationOutcome result) { bool flag = false; string empty = string.Empty; StringBuilder stringBuilder = new StringBuilder(); LiveIdAuthenticationError liveIdAuthenticationError = LiveIdAuthenticationError.None; TimeSpan latency = new TimeSpan(0, 0, 0); for (int i = 0; i < 3; i++) { this.InternalPerformLiveIdAuthentication(out flag, out liveIdAuthenticationError, out empty, out latency); if (liveIdAuthenticationError == LiveIdAuthenticationError.LoginFailure || liveIdAuthenticationError == LiveIdAuthenticationError.None) { break; } stringBuilder.AppendLine(" Retrying: " + empty); base.WriteVerbose(new LocalizedString(string.Format("Failed with Error {0}. Trying to Kill and Restart.", empty))); this.KillAndStartService(); } stringBuilder.AppendLine(empty); result.Update(flag ? LiveIdAuthenticationResultEnum.Success : LiveIdAuthenticationResultEnum.Failure, latency, stringBuilder.ToString()); liveIdAuthenticationError = (flag ? LiveIdAuthenticationError.None : LiveIdAuthenticationError.LoginFailure); if (this.MonitoringContext) { this.monitoringData.Events.Add(new MonitoringEvent(TestLiveIdAuthenticationTask.CmdletMonitoringEventSource, (int)((flag ? 1000 : 2000) + this.UserType + (int)liveIdAuthenticationError), flag ? EventTypeEnumeration.Success : EventTypeEnumeration.Error, flag ? Strings.LiveIdAuthenticationSuccess(this.UserType.ToString()) : Strings.LiveIdAuthenticationFailed(this.UserType.ToString(), stringBuilder.ToString()))); } }
protected override void InternalProcessRecord() { base.InternalBeginProcessing(); TaskLogger.LogEnter(); try { this.VerifyServiceIsRunning(); LiveIdAuthenticationOutcome sendToPipeline = new LiveIdAuthenticationOutcome(this.Server.ToString(), this.MailboxCredential.UserName); this.PerformLiveIdAuthenticationTest(ref sendToPipeline); base.WriteObject(sendToPipeline); } catch (LocalizedException e) { this.HandleException(e); } finally { if (this.MonitoringContext) { base.WriteObject(this.monitoringData); } TaskLogger.LogExit(); } }