internal bool IsEmailAddressCollision(IEnumerable emailAddresses) { if (this.contactEmailData == null) { this.contactEmailData = new Hashtable(); using (ContactIterator localContactIterator = new ContactIterator(this.flatStoreModelList)) { while (localContactIterator.MoveToNextContact()) { IContact iterContact = localContactIterator.CurrentContact; foreach (EmailContact emailContact in iterContact.EmailAddresses) { string emailId = emailContact.EmailAddress.ToLower(); if (this.contactEmailData.ContainsKey(emailId)) { int count = (int)this.contactEmailData[emailId]; count++; this.contactEmailData[emailId] = count; } else { this.contactEmailData[emailId] = 1; } } } } } foreach (EmailContact emailContact in emailAddresses) { string emailId = emailContact.EmailAddress.ToLower(); if (this.contactEmailData.ContainsKey(emailId)) { int number = (int)this.contactEmailData[emailId]; if (number > 1) { return true; } } } return false; }
void TransitionToUploadingState() { Debug.Assert(this.modelState == ModelState.SignedIn); this.lkgStatePersistor.SaveLKGState(this); this.ComputeEmailContactCounts(); this.contactIterator = new ContactIterator( this.flatStoreModelList); this.mailIterator = new MailIterator( this.flatFolderModelList, new VoidDelegate(this.IncrementFailedMailCount)); this.useCurrent = false; this.pauseTime = GoogleEmailUploaderConfig.MinimumPauseTime; this.modelState = ModelState.Uploading; }
/// <summary> /// Cleans up the model for disposing /// </summary> public void Dispose() { try { GoogleEmailUploaderTrace.EnteringMethod( "GoogleEmailUploaderModel.Dispose"); if (this.modelState == ModelState.Initialized) { this.gaiaAuthenticator = null; } else if (this.modelState == ModelState.SignedIn) { this.emailId = null; this.password = null; this.lkgStatePersistor.SaveLKGState(this); this.lkgStatePersistor = null; this.flatStoreModelList = null; this.flatFolderModelList = null; this.DisposeClientModels(); } else if (this.modelState == ModelState.Uploading || this.modelState == ModelState.UploadingPause) { this.emailId = null; this.password = null; this.lkgStatePersistor = null; this.flatStoreModelList = null; this.flatFolderModelList = null; this.mailUploader = null; this.contactIterator.Dispose(); this.mailIterator.Dispose(); this.contactIterator = null; this.mailIterator = null; if (this.pauseTimer != null) { this.pauseTimer.Dispose(); this.pauseTimer = null; } this.DisposeClientModels(); } } finally { GoogleEmailUploaderTrace.ExitingMethod( "GoogleEmailUploaderModel.Dispose"); } }
void TransitionToInitializedState() { this.gaiaAuthenticator = new GoogleAuthenticator(this.HttpFactory, AccountType.GoogleOrHosted, this.ApplicationName); this.emailId = null; this.password = null; this.lkgStatePersistor = null; this.flatStoreModelList = null; this.flatFolderModelList = null; this.mailUploader = null; this.contactIterator = null; this.mailIterator = null; this.pauseTimer = null; this.modelState = ModelState.Initialized; }