示例#1
0
        private static async Task OnContactPanelActivated(ContactPanelActivatedEventArgs task)
        {
            Analytics.TrackEvent("Unicord_LaunchForMyPeople");

            if (!(Window.Current.Content is Frame rootFrame))
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                try
                {
                    var id = await ContactListManager.TryGetChannelIdAsync(task.Contact);

                    if (id != 0)
                    {
                        rootFrame.Navigate(typeof(MainPage), new MainPageArgs()
                        {
                            UserId = id, FullFrame = true, IsUriActivation = false
                        });
                    }
                }
                catch
                {
                    Analytics.TrackEvent("Unicord_MyPeopleFailedToFindPerson");
                    var dialog = new MessageDialog("Something went wrong trying to find this person, sorry!", "Whoops!");
                    await dialog.ShowAsync();
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            Window.Current.Activate();
        }
示例#2
0
        /// <summary>
        /// 查询好友和群聊
        /// </summary>
        /// <param name="searchText"></param>
        /// <returns></returns>
        private List <WeChatUser> Search(string searchText)
        {
            List <WeChatUser> list = new List <WeChatUser>();

            list.AddRange(ContactListManager.SearchContact(searchText));
            list.AddRange(ChatListManager.SearchRoomChat(searchText));
            return(list);
        }
 public ContactsViewModel(AppRepository appRepository, IMessageBoxService messageBoxService, IFileService fileService, ChatWorker chatWorker, ProfileViewModel profileViewModel, ContactListManager contactListManager)
 {
     this.repo = appRepository;
     this.messageBoxService  = messageBoxService;
     this.fileService        = fileService;
     this.chatWorker         = chatWorker;
     this.profileViewModel   = profileViewModel;
     this.contactListManager = contactListManager;
 }
示例#4
0
        public ContactsView(Window mainWindow) : base(mainWindow)
        {
            this.window = mainWindow;

            this.contactListManager = App.ServiceProvider.Get <ContactListManager>();

            this.messageBoxService   = App.ServiceProvider.Get <IMessageBoxService>();
            this.photonWalletManager = App.ServiceProvider.Get <PhotonWalletManager>();
            this.profileViewModel    = App.ServiceProvider.Get <ProfileViewModel>();
            this.contactsViewModel   = App.ServiceProvider.Get <ContactsViewModel>();
        }
示例#5
0
        /// <summary>
        /// 加载所有通讯录
        /// </summary>
        /// <returns></returns>
        private async Task LoadAllContact()
        {
            var list = await Task.Run(() =>
            {
                //取到通讯录,过滤公众号,然后分组
                JObject contact_result = wcs.GetContact();
                return(contact_result["MemberList"]
                       .Select(contact => JObjectToUser(contact)).OrderBy(p => p.StartChar).ToArray());
            });

            //将数据传输到通讯录组件
            ContactListManager.AddContact(list);
        }
示例#6
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                App.Discord.MessageCreated += Notification_MessageCreated;

                UpdateTitleBar();
                CheckSettingsPane();

                _loaded = true;

                this.FindParent <MainPage>().HideConnectingOverlay();

                var service = DiscordNavigationService.GetForCurrentView();

                if (_args != null && _args.ChannelId != 0)
                {
                    var channel = await App.Discord.GetChannelAsync(_args.ChannelId);

                    await service.NavigateAsync(channel);
                }
                else
                {
                    Model.IsFriendsSelected = true;
                    SidebarFrame.Navigate(typeof(DMChannelsPage));
                    MainFrame.Navigate(typeof(FriendsPage));
                }

                if (_args?.ThemeLoadException != null)
                {
                    var message = App.Discord.CreateMockMessage(
                        $"We had some trouble loading your selected themes, so we disabled them for this launch. For more information, see settings.",
                        App.Discord.CreateMockUser("Unicord", "CORD"));
                    ShowNotification(message);
                }

                var possibleConnection = await VoiceConnectionModel.FindExistingConnectionAsync();

                if (possibleConnection != null)
                {
                    (DataContext as DiscordPageModel).VoiceModel = possibleConnection;
                }

                await ContactListManager.UpdateContactsListAsync();
            }
            catch (Exception ex)
            {
                await UIUtilities.ShowErrorDialogAsync("An error has occured.", ex.Message);
            }
        }
示例#7
0
        public ChatView(Window mainWindow) : base(mainWindow)
        {
            this.mainWindow         = mainWindow;
            this.contactListManager = App.ServiceProvider.Get <ContactListManager>();
            this.profileViewModel   = App.ServiceProvider.Get <ProfileViewModel>();
            this.messageBoxService  = App.ServiceProvider.Get <IMessageBoxService>();
            this.clipboard          = App.ServiceProvider.Get <IClipboard>();

            this.messageThreadView     = new MessageThreadView(this.profileViewModel.Name, this.profileViewModel.ChatId, this.contactListManager.CurrentContact.Name, this.contactListManager.CurrentContact.ChatId);
            this.messagesViewModel     = new MessagesViewModel(App.ServiceProvider, this.contactListManager.CurrentContact.Id, this.messageThreadView);
            this.tcpConnection         = App.ServiceProvider.Get <ITcpConnection>();
            this.connectionListEntries = new List <string>();
            this.connectionListEntries.Add("Connecting...");
        }
示例#8
0
        private static async Task ClearJumpListAsync()
        {
            if (JumpList.IsSupported())
            {
                var list = await JumpList.LoadCurrentAsync();

                list.Items.Clear();
                await list.SaveAsync();
            }

            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5))
            {
                await ContactListManager.ClearContactsAsync();
            }
        }
示例#9
0
 public ChatWorker(ILoggerFactory loggerFactory, ICancellation cancellation, AppState appState, AppRepository appRepository, ITcpConnection tcpConnection, IUdpConnection udpConnection, IChatClient chatClient, IXDSSecService ixdsCryptoService, IChatEncryptionService chatEncryptionService, E2ERatchet e2eRatchet, ContactListManager contactListManager)
 {
     this.logger                = loggerFactory.CreateLogger <ChatWorker>();
     this.appState              = appState;
     this.repo                  = appRepository;
     this.tcp                   = tcpConnection;
     this.udp                   = udpConnection;
     this.chatClient            = chatClient;
     this.ixdsCryptoService     = ixdsCryptoService;
     this.chatEncryptionService = chatEncryptionService;
     this.e2eRatchet            = e2eRatchet;
     this.contactListManager    = contactListManager;
     this.cancellation          = cancellation;
     cancellation.RegisterWorker(this);
 }
        public MessagesViewModel(IServiceProvider provider, string contactGuid, IChatView messageThreadView)
        {
            this._contactId         = contactGuid;
            this.logger             = provider.Get <ILoggerFactory>().CreateLogger <MessagesViewModel>();
            this._repo              = provider.Get <AppRepository>();
            this._messagesLoader    = new MessagesLoader(this._repo, contactGuid);
            this._messageThreadView = messageThreadView;

            this._encryptionService  = provider.Get <IChatEncryptionService>();
            this._unreadManager      = provider.Get <UnreadManager>();
            this._contactListManager = provider.Get <ContactListManager>();

            this._chatClient = provider.Get <IChatClient>();
            this._chatWorker = provider.Get <ChatWorker>();
            this._chatWorker.SendMessageStateUpdated  += (sender, message) => this._messageThreadView.UpdateSendMessageStateFromBackgroundThread(message);
            this._chatWorker.IncomingMessageDecrypted += async(sender, message) => await AddIncomingDecryptedMessageFromChatworker(message);
        }
示例#11
0
        private async void SyncContactsSwitch_Toggled(object sender, RoutedEventArgs e)
        {
            syncContactsSwitch.IsEnabled       = false;
            syncingProgressBar.Visibility      = Visibility.Visible;
            syncingProgressBar.IsIndeterminate = true;

            var isEnabled = App.RoamingSettings.Read(SYNC_CONTACTS, true);

            if (isEnabled)
            {
                await ContactListManager.ClearContactsAsync();
            }
            else
            {
                await ContactListManager.UpdateContactsListAsync();
            }

            App.RoamingSettings.Save(SYNC_CONTACTS, !isEnabled);

            syncContactsSwitch.IsEnabled       = true;
            syncingProgressBar.Visibility      = Visibility.Collapsed;
            syncingProgressBar.IsIndeterminate = false;
        }
示例#12
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                // BUGBUG: this is messy
                var items = new List <object> {
                    new { Name = "Direct Messages" }
                };
                items.AddRange(App.Discord.Guilds.Values.OrderBy(g => g.Name));
                guildBox.ItemsSource = items;

                channelsBox.ItemTemplateSelector = new ChannelTemplateSelector()
                {
                    ServerChannelTemplate = (DataTemplate)App.Current.Resources["NoIndicatorChannelListTemplate"],
                    DirectMessageTemplate = (DataTemplate)App.Current.Resources["NoIndicatorDMChannelTemplate"]
                };

                if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5))
                {
                    var contact = _shareOperation.Contacts.FirstOrDefault();
                    if (contact != null)
                    {
                        var id = await ContactListManager.TryGetChannelIdAsync(contact);

                        if (id != 0)
                        {
                            guildBox.SelectedIndex   = 0;
                            channelsBox.SelectedItem = await App.Discord.CreateDmChannelAsync(id);

                            target.Text = contact.DisplayName;
                            destinationGrid.Visibility = Visibility.Collapsed;
                        }
                    }
                }

                _shareOperation.ReportStarted();

                var data = _shareOperation.Data;
                if (data.AvailableFormats.Contains(StandardDataFormats.StorageItems))
                {
                    _file = (await data.GetStorageItemsAsync()).FirstOrDefault() as StorageFile;

                    var img = new BitmapImage();
                    thumbnailImage.Source = img;
                    await img.SetSourceAsync(await _file.GetThumbnailAsync(ThumbnailMode.SingleItem));

                    return;
                }
                else if (data.AvailableFormats.Contains(StandardDataFormats.Bitmap))
                {
                    // do shit

                    _file = await Tools.GetImageFileFromDataPackage(data);

                    var img = new BitmapImage();
                    thumbnailImage.Source = img;
                    await img.SetSourceAsync(await _file.GetThumbnailAsync(ThumbnailMode.PicturesView));

                    return;
                }
                else
                {
                    thumbnailImage.Visibility   = Visibility.Collapsed;
                    captionText.PlaceholderText = "Type a message!";
                }

                if (data.AvailableFormats.Contains(StandardDataFormats.Text))
                {
                    var text = await data.GetTextAsync();

                    captionText.Text += text;
                }

                if (data.AvailableFormats.Contains(StandardDataFormats.WebLink))
                {
                    var text = await data.GetWebLinkAsync();

                    captionText.Text += text;
                }
            }
            finally
            {
                _shareOperation.ReportDataRetrieved();
                this.FindParent <MainPage>().HideConnectingOverlay();

                if (_file != null)
                {
                    var maxSize = (ulong)(App.Discord.CurrentUser.UploadLimit());
                    var props   = await _file.GetBasicPropertiesAsync();

                    if (props.Size >= maxSize)
                    {
                        await UIUtilities.ShowErrorDialogAsync("This file is too big!", $"We're gonna need something under {(Files.SizeSuffix((long)maxSize, 0))} please!");

                        Window.Current.Close();
                    }
                }
            }
        }
示例#13
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                var navigation = SystemNavigationManager.GetForCurrentView();
                navigation.BackRequested += Navigation_BackRequested;

                App.Discord.MessageCreated      += Notification_MessageCreated;
                App.Discord.UserSettingsUpdated += Discord_UserSettingsUpdated;
                App.Discord.GuildCreated        += Discord_GuildCreated;
                App.Discord.GuildDeleted        += Discord_GuildDeleted;
                App.Discord.DmChannelCreated    += Discord_DmChannelCreated;
                App.Discord.DmChannelDeleted    += Discord_DmChannelDeleted;

                UpdateTitleBar();
                CheckSettingsPane();

                _loaded = true;

                var guildPositions = App.Discord.UserSettings?.GuildPositions;
                foreach (var guild in App.Discord.Guilds.Values.OrderBy(g => guildPositions?.IndexOf(g.Id) ?? 0))
                {
                    _guilds.Add(guild);
                }

                _unreadDms.CollectionChanged += (o, ev) =>
                {
                    if (_unreadDms.Count > 0)
                    {
                        unreadDms.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        unreadDms.Visibility = Visibility.Collapsed;
                    }
                };

                foreach (var dm in App.Discord.PrivateChannels.Values)
                {
                    if (dm.ReadState.MentionCount > 0)
                    {
                        _unreadDms.Add(dm);
                    }

                    dm.PropertyChanged += Dm_PropertyChanged;
                }

                unreadDms.ItemsSource = _unreadDms;
                unreadDms.Visibility  = _unreadDms.Count > 0 ? Visibility.Visible : Visibility.Collapsed;

                this.FindParent <MainPage>().HideConnectingOverlay();

                //if (App.ThemeLoadException != null)
                //{
                //    await UIUtilities.ShowErrorDialogAsync("Theme failed to load!", $"Your selected theme failed to load. {App.ThemeLoadException.Message}");
                //}

                if (_args != null)
                {
                    var channel = await App.Discord.GetChannelAsync(_args.ChannelId);

                    Navigate(channel, new DrillInNavigationTransitionInfo());
                }
                else
                {
                    friendsItem.IsSelected = true;
                    friendsItem_Tapped(null, null);
                }

                await ContactListManager.UpdateContactsListAsync();
            }
            catch (Exception ex)
            {
                await UIUtilities.ShowErrorDialogAsync("An error has occured.", ex.Message);
            }
        }
示例#14
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            if (App.Discord == null)
            {
                return; // im not 100% sure why this gets called on logout but it does so
            }
            Analytics.TrackEvent("DiscordPage_Loaded");

            try
            {
                App.Discord.MessageCreated += Notification_MessageCreated;

                UpdateTitleBar();
                CheckSettingsPane();

                _loaded = true;

                this.FindParent <MainPage>().HideConnectingOverlay();

                var service = DiscordNavigationService.GetForCurrentView();

                if (_args != null && _args.ChannelId != 0 && App.Discord.TryGetCachedChannel(_args.ChannelId, out var channel))
                {
                    Analytics.TrackEvent("DiscordPage_NavigateToSpecifiedChannel");
                    await service.NavigateAsync(channel);
                }
                else
                {
                    Analytics.TrackEvent("DiscordPage_NavigateToFriendsPage");
                    Model.IsFriendsSelected = true;
                    SidebarFrame.Navigate(typeof(DMChannelsPage));
                    MainFrame.Navigate(typeof(FriendsPage));
                }

                if (_args?.ThemeLoadException != null)
                {
                    Analytics.TrackEvent("DiscordPage_ThemeErrorMessageShown");

                    var message = App.Discord.CreateMockMessage(
                        $"We had some trouble loading your selected themes, so we disabled them for this launch. For more information, see settings.",
                        App.Discord.CreateMockUser("Unicord", "CORD"));
                    ShowNotification(message);
                }

                //var helper = SwipeOpenService.GetForCurrentView();
                //helper.AddAdditionalElement(SwipeHelper);

                var notificationService = BackgroundNotificationService.GetForCurrentView();
                await notificationService.StartupAsync();

                var possibleConnection = await VoiceConnectionModel.FindExistingConnectionAsync();

                if (possibleConnection != null)
                {
                    (DataContext as DiscordPageModel).VoiceModel = possibleConnection;
                }

                await ContactListManager.UpdateContactsListAsync();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
                await UIUtilities.ShowErrorDialogAsync("An error has occured.", ex.Message);
            }
        }
示例#15
0
 public ActionResult Index(SubscribeModel subscribe)
 {
     if (ModelState.IsValid)
     {
         using (new SecurityDisabler())
         {
             try
             {
                 string            emailAddress      = subscribe.Email;
                 EmailHelper       emailhelper       = new EmailHelper();
                 ContactRepository contactRepository = Sitecore.Configuration.Factory.CreateObject("tracking/contactRepository", true) as ContactRepository;
                 var            contact        = contactRepository.LoadContactReadOnly(emailAddress);
                 ContactManager contactManager = Sitecore.Configuration.Factory.CreateObject("tracking/contactManager", true) as ContactManager;
                 LockAttemptResult <Contact> lockResult;
                 if (contact == null)
                 {
                     lockResult = new LockAttemptResult <Contact>(LockAttemptStatus.NotFound, null, null);
                     contact    = contactRepository.CreateContact(Sitecore.Data.ID.NewID);
                     contact.Identifiers.AuthenticationLevel = Sitecore.Analytics.Model.AuthenticationLevel.None;
                     contact.Identifiers.Identifier          = emailAddress;
                     contact.Identifiers.IdentificationLevel = ContactIdentificationLevel.Known;
                     contact.System.Value      = 0;
                     contact.System.VisitCount = 0;
                     contact.ContactSaveMode   = ContactSaveMode.AlwaysSave;
                     contactManager.FlushContactToXdb(contact);
                 }
                 else
                 {
                     lockResult = contactManager.TryLoadContact(contact.ContactId);
                     contact    = lockResult.Object;
                 }
                 var personal = contact.GetFacet <Sitecore.Analytics.Model.Entities.IContactPersonalInfo>("Personal");
                 personal.FirstName = subscribe.FullName;
                 var emailAddresses = contact.GetFacet <Sitecore.Analytics.Model.Entities.IContactEmailAddresses>("Emails");
                 if (!emailAddresses.Entries.Contains("Email"))
                 {
                     emailAddresses.Entries.Create("Email");
                 }
                 var email = emailAddresses.Entries["Email"];
                 email.SmtpAddress        = emailAddress;
                 emailAddresses.Preferred = "Email";
                 var contactEmailAddresses = contact.GetFacet <IVisitorSubscribtionFacet>("Contact Details");
                 if (!contactEmailAddresses.SubscriptionDetails.Contains("Subscriber Details"))
                 {
                     contactEmailAddresses.SubscriptionDetails.Create("Subscriber");
                     contactEmailAddresses.SubscriptionDetails["Subscriber"].FullName      = subscribe.FullName;
                     contactEmailAddresses.SubscriptionDetails["Subscriber"].ContactNumber = subscribe.ContactNumber;
                     contactEmailAddresses.SubscriptionDetails["Subscriber"].Email         = subscribe.Email;
                     contactEmailAddresses.SubscriptionDetails["Subscriber"].Comments      = subscribe.Comments;
                 }
                 ContactListManager listManager = Sitecore.Configuration.Factory.CreateObject("contactListManager", false) as ContactListManager;
                 contactManager.SaveAndReleaseContactToXdb(contact);
                 Tracker.Current.Session.Identify(subscribe.Email);
                 //Getting the Email Campaign ManagerRoot
                 Item        managerRoot = Sitecore.Data.Database.GetDatabase(SitecoreHelper.GetSitecoreDB().ToString()).GetItem(GlobalProperties.EmailCampaignMangerRoot);
                 RecipientId recipient   = RecipientRepository.GetDefaultInstance().ResolveRecipientId("xdb:" + contact.ContactId);
                 var         recipientId = new Sitecore.Modules.EmailCampaign.Xdb.XdbContactId(contact.ContactId);
                 Sitecore.Modules.EmailCampaign.ClientApi.UpdateSubscriptions(recipientId, new[] { GlobalGuids.ContactList }, new string[] { }, managerRoot.ID.ToString(), false);
                 emailhelper.SendEmail(subscribe);
                 subscribe.IsFormEnabled = false;
             }
             catch (Exception ex)
             {
                 subscribe.IsError       = true;
                 subscribe.IsFormEnabled = false;
                 Sitecore.Diagnostics.Log.Error(ex.Message, this);
             }
         }
         return(View("~/Views/Pages/Subscribe.cshtml", subscribe));
     }
     subscribe.IsError       = false;
     subscribe.IsFormEnabled = true;
     return(View("~/Views/Pages/Subscribe.cshtml", subscribe));
 }
示例#16
0
        /// <summary>
        /// 开启微信同步任务
        /// </summary>
        private void StartWeChatSyncTask()
        {
            Task.Run(() =>
            {
                while (true)
                {
                    //同步检查
                    string sync_flag = wcs.WeChatSyncCheck();
                    if (sync_flag == null)
                    {
                        Thread.Sleep(100);
                        continue;
                    }
                    //这里应该判断sync_flag中Selector的值
                    else
                    {
                        JObject sync_result = wcs.WeChatSync();//进行同步
                        if (sync_result != null)
                        {
                            if (sync_result["DelContactCount"] != null && sync_result["DelContactCount"].ToString() != "0")  //删除联系人
                            {
                                var delContacts = sync_result["DelContactList"].Select(p => p.Value <string>("UserName")).ToArray();
                                Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                                {
                                    //同时删除聊天和联系人
                                    ChatListManager.DelChat(delContacts);
                                    ContactListManager.DelContact(delContacts);
                                }));
                            }
                            if (sync_result["ModContactCount"] != null && sync_result["ModContactCount"].ToString() != "0")  //添加或者修改联系人
                            {
                                var modContactList = sync_result["ModContactList"].Select(p => JObjectToUser(p)).ToArray();
                                Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                                {
                                    ChatListManager.ModChat(modContactList);
                                    ContactListManager.ModContact(modContactList);
                                }));
                            }
                            if (sync_result["AddMsgCount"] != null && sync_result["AddMsgCount"].ToString() != "0")  //新消息
                            {
                                var messageList = sync_result["AddMsgList"].Select(p => JObjectToMessage(p));

                                var loadMore = messageList.FirstOrDefault(p => p.IsLoadMoreChats);
                                if (loadMore != null)
                                {
                                    //加载更多聊天列表
                                    string[] userNames = loadMore.StatusNotifyUserName.Split(',').Where(p => !ChatListManager.Contains(p)).ToArray();
                                    LoadMoreChats(userNames);
                                }
                                Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                                {
                                    //同步消息
                                    ChatListManager.SyncMessage(messageList.ToArray());
                                }));
                            }
                        }
                    }
                    Thread.Sleep(100);
                }
            });
        }
示例#17
0
        public void ProcessContacts(string usersFile, string contactsFile, string contactsGroup, bool deletionMode)
        {
            List <string>      usersList    = new List <string>();
            List <ContactItem> contactsList = new List <ContactItem>();

            try
            {
                usersList = FileAccess.GetUsersFileData(usersFile);
            }
            catch (Exception ex)
            {
                Log.WriteLogEntry("ERROR", String.Format("Error while reading Users file: {0}", ex.Message), "Error while reading Users file.");
                CleanupEnvironment();
                Program.CloseApplicationOnError();
            }

            try
            {
                contactsList = FileAccess.GetContactsFileData(contactsFile);
            }
            catch (Exception ex)
            {
                Log.WriteLogEntry("ERROR", String.Format("Error while reading Contacts file: {0}", ex.Message), "Error while reading Contacts file.");
                CleanupEnvironment();
                Program.CloseApplicationOnError();
            }

            if ((contactsList.Count > 0) && (usersList.Count > 0))
            {
                ucmaPlatform.StartupPlatform();
                ucmaEndpoint = new Endpoint(ucmaPlatform.CollabPlatform);
                ContactListManager contactListManager = new ContactListManager(ucmaEndpoint);

                foreach (string user in usersList)
                {
                    Log.WriteLogEntry("INFO", String.Format("Processing user {0}...", user.ToLowerInvariant()), String.Format("Processing user {0}...", user.ToLowerInvariant()));

                    try
                    {
                        if (!deletionMode)
                        {
                            contactListManager.AddContacts(user, contactsList, contactsGroup);
                        }
                        else
                        {
                            contactListManager.RemoveContacts(user, contactsList);
                        }
                    }
                    catch (RegisterException rex)
                    {
                        Log.WriteLogEntry("ERROR", String.Format("Error while processing user {0}: {1}. Inner Exception: {2}. Diag Info: {3}.", user.ToLowerInvariant(), rex.Message, (rex.InnerException == null ? "N/A" : rex.InnerException.Message), (String.IsNullOrEmpty(rex.DiagnosticInformation.ToString()) ? "N/A" : rex.DiagnosticInformation.ToString())), String.Format("Error while processing user {0}", user.ToLowerInvariant()));
                    }
                    catch (PublishSubscribeException pex)
                    {
                        // If contact list provide is UCS (Exchange Server 2013)
                        if (pex.DiagnosticInformation.ErrorCode == 2164)
                        {
                            Log.WriteLogEntry("WARNING", String.Format("Error while processing user {0}: User's contact list is stored in Unified Contact Store. It can't be managed by {1}", user.ToLowerInvariant(), LumtGlobals.ApplicationShortName), String.Format("Error while processing user {0}", user.ToLowerInvariant()));
                        }
                        else
                        {
                            Log.WriteLogEntry("ERROR", String.Format("Error while processing user {0}: {1}. Inner Exception: {2}. Diag Info: {3}.", user.ToLowerInvariant(), pex.Message, (pex.InnerException == null ? "N/A" : pex.InnerException.Message), (String.IsNullOrEmpty(pex.DiagnosticInformation.ToString()) ? "N/A" : pex.DiagnosticInformation.ToString())), String.Format("Error while processing user {0}", user.ToLowerInvariant()));
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.WriteLogEntry("ERROR", String.Format("Error while processing user {0}: {1}. Inner Exception: {2}", user.ToLowerInvariant(), ex.Message, (ex.InnerException == null ? "N/A" : ex.InnerException.Message)), String.Format("Error while processing user {0}", user.ToLowerInvariant()));
                    }
                }
            }
            else
            {
                Log.WriteLogEntry("WARNING", "Users or Contacts file is empty or invalid. No action will be performed.");
            }
        }