Пример #1
0
 // Token: 0x060010A3 RID: 4259 RVA: 0x00061984 File Offset: 0x0005FB84
 public void DeleteCookie(string path)
 {
     using (MailboxSession mailboxSession = this.TryGetMailboxSession())
     {
         if (mailboxSession == null)
         {
             GroupMetricsMailboxFileStore.Tracer.TraceDebug((long)this.GetHashCode(), "GroupMetricsMailboxFileStore.DeleteCookie - skipping due to null session");
         }
         else
         {
             try
             {
                 base.DeleteFileFromMailbox(path, mailboxSession);
             }
             catch (Exception ex)
             {
                 UmGlobals.ExEvent.LogEvent(InfoWorkerEventLogConstants.Tuple_DeleteGroupMetricsCookieFailed, null, new object[]
                 {
                     base.OrgId,
                     path,
                     CommonUtil.ToEventLogString(ex)
                 });
                 if (!GroupMetricsMailboxFileStore.IsExpectedException(ex))
                 {
                     throw;
                 }
             }
         }
     }
 }
Пример #2
0
        // Token: 0x060010A2 RID: 4258 RVA: 0x00061814 File Offset: 0x0005FA14
        public bool DownloadCookies(ICollection <string> pathCollection)
        {
            ValidateArgument.NotNull(pathCollection, "pathCollection");
            if (pathCollection.Count == 0)
            {
                GroupMetricsMailboxFileStore.Tracer.TraceDebug((long)this.GetHashCode(), "GroupMetricsMailboxFileStore.DownloadCookies - skipping download due to empty cookie path collection");
                return(false);
            }
            bool result = true;

            using (MailboxSession mailboxSession = this.TryGetMailboxSession())
            {
                if (mailboxSession == null)
                {
                    GroupMetricsMailboxFileStore.Tracer.TraceDebug((long)this.GetHashCode(), "GroupMetricsMailboxFileStore.DownloadCookies - skipping download due to null session");
                    return(false);
                }
                foreach (string text in pathCollection)
                {
                    try
                    {
                        string text2 = base.DownloadLatestFile(text, DateTime.MinValue, mailboxSession);
                        if (text2 != null)
                        {
                            GroupMetricsMailboxFileStore.Tracer.TraceDebug <string, string>((long)this.GetHashCode(), "GroupMetricsMailboxFileStore.DownloadCookie - Copying downloaded cookie '{0}' to '{1}'", text2, text);
                            string directoryName = Path.GetDirectoryName(text);
                            Directory.CreateDirectory(directoryName);
                            try
                            {
                                File.Copy(text2, text, true);
                                continue;
                            }
                            finally
                            {
                                base.DeleteFolder(Path.GetDirectoryName(text2));
                            }
                        }
                        result = false;
                    }
                    catch (Exception ex)
                    {
                        UmGlobals.ExEvent.LogEvent(InfoWorkerEventLogConstants.Tuple_DownloadGroupMetricsCookieFailed, null, new object[]
                        {
                            base.OrgId,
                            text,
                            CommonUtil.ToEventLogString(ex)
                        });
                        if (!GroupMetricsMailboxFileStore.IsExpectedException(ex))
                        {
                            throw;
                        }
                    }
                }
            }
            return(result);
        }
        // Token: 0x0600108C RID: 4236 RVA: 0x00060A94 File Offset: 0x0005EC94
        private string ReadCookieString(string path, string domain)
        {
            if (!File.Exists(path) && !this.hasDownloadedCookiesFromMailbox)
            {
                GroupMetricsMailboxFileStore groupMetricsMailboxFileStore = GroupMetricsMailboxFileStore.FromMailboxGuid(base.OrgId, base.MailboxGuid);
                if (groupMetricsMailboxFileStore != null)
                {
                    this.hasDownloadedCookiesFromMailbox = groupMetricsMailboxFileStore.DownloadCookies(this.currentCookiePathCollection);
                }
            }
            string    result = null;
            Exception ex     = null;

            try
            {
                using (StreamReader streamReader = new StreamReader(path))
                {
                    result = streamReader.ReadLine();
                }
            }
            catch (FileNotFoundException ex2)
            {
                ex = ex2;
            }
            catch (IOException ex3)
            {
                ex = ex3;
            }
            catch (UnauthorizedAccessException ex4)
            {
                ex = ex4;
            }
            catch (SecurityException ex5)
            {
                ex = ex5;
            }
            if (ex != null && base.OrgId == OrganizationId.ForestWideOrgId)
            {
                GroupMetricsGenerator.EventLogger.LogEvent(InfoWorkerEventLogConstants.Tuple_UnableToReadGroupMetricsCookie, null, new object[]
                {
                    this.GetOrganizationIdString(),
                    path,
                    domain,
                    ex.GetType().FullName,
                    ex.Message
                });
                return(string.Empty);
            }
            return(result);
        }
        // Token: 0x06001087 RID: 4231 RVA: 0x000604D8 File Offset: 0x0005E6D8
        internal void SaveCookies(IList <GroupMetricsCookie> cookies)
        {
            base.Logger.TraceDebug(null, "Calling SaveCookies", new object[0]);
            string[] array = new string[cookies.Count];
            int      num   = 0;

            foreach (GroupMetricsCookie groupMetricsCookie in cookies)
            {
                string domain     = groupMetricsCookie.Domain;
                string cookiePath = this.GetCookiePath(domain);
                array[num++] = cookiePath;
                this.SaveCookie(cookiePath, domain, groupMetricsCookie);
            }
            GroupMetricsMailboxFileStore groupMetricsMailboxFileStore = GroupMetricsMailboxFileStore.FromMailboxGuid(base.OrgId, base.MailboxGuid);

            if (groupMetricsMailboxFileStore != null)
            {
                groupMetricsMailboxFileStore.UploadCookies(array);
            }
        }
        // Token: 0x0600108E RID: 4238 RVA: 0x00060C78 File Offset: 0x0005EE78
        private void DeleteCookieFile(string path, string domain)
        {
            Exception ex = null;

            try
            {
                File.Delete(path);
            }
            catch (FileNotFoundException)
            {
            }
            catch (IOException ex2)
            {
                ex = ex2;
            }
            catch (UnauthorizedAccessException ex3)
            {
                ex = ex3;
            }
            catch (SecurityException ex4)
            {
                ex = ex4;
            }
            if (ex != null)
            {
                GroupMetricsGenerator.EventLogger.LogEvent(InfoWorkerEventLogConstants.Tuple_UnableToRemoveCorruptGroupMetricsCookie, null, new object[]
                {
                    this.GetOrganizationIdString(),
                    path,
                    domain,
                    ex.GetType().FullName,
                    ex.Message
                });
            }
            GroupMetricsMailboxFileStore groupMetricsMailboxFileStore = GroupMetricsMailboxFileStore.FromMailboxGuid(base.OrgId, base.MailboxGuid);

            if (groupMetricsMailboxFileStore != null)
            {
                groupMetricsMailboxFileStore.DeleteCookie(path);
            }
        }
Пример #6
0
 // Token: 0x060010A1 RID: 4257 RVA: 0x000616E4 File Offset: 0x0005F8E4
 public void UploadCookies(IList <string> filePathList)
 {
     ValidateArgument.NotNull(filePathList, "filePathList");
     if (filePathList.Count == 0)
     {
         GroupMetricsMailboxFileStore.Tracer.TraceDebug((long)this.GetHashCode(), "GroupMetricsMailboxFileStore.UploadCookie - skipping upload due to empty cookie path list");
         return;
     }
     GroupMetricsMailboxFileStore.Tracer.TraceDebug <int>((long)this.GetHashCode(), "GroupMetricsMailboxFileStore.UploadCookie - {0} cookies to be uploaded", filePathList.Count);
     using (MailboxSession mailboxSession = this.TryGetMailboxSession())
     {
         if (mailboxSession == null)
         {
             GroupMetricsMailboxFileStore.Tracer.TraceDebug((long)this.GetHashCode(), "GroupMetricsMailboxFileStore.UploadCookie - skipping upload due to null session");
         }
         foreach (string text in filePathList)
         {
             try
             {
                 GroupMetricsMailboxFileStore.Tracer.TraceDebug <string>((long)this.GetHashCode(), "GroupMetricsMailboxFileStore.UploadCookie - uploading cookie {0}", text);
                 base.UploadFile(text, text, mailboxSession);
             }
             catch (Exception ex)
             {
                 UmGlobals.ExEvent.LogEvent(InfoWorkerEventLogConstants.Tuple_UploadGroupMetricsCookieFailed, null, new object[]
                 {
                     base.OrgId,
                     text,
                     CommonUtil.ToEventLogString(ex)
                 });
                 if (!GroupMetricsMailboxFileStore.IsExpectedException(ex))
                 {
                     throw;
                 }
             }
         }
     }
 }
Пример #7
0
        // Token: 0x060010A0 RID: 4256 RVA: 0x0006167C File Offset: 0x0005F87C
        public static GroupMetricsMailboxFileStore FromMailboxGuid(OrganizationId orgId, Guid mbxGuid)
        {
            GroupMetricsMailboxFileStore result = null;

            try
            {
                result = new GroupMetricsMailboxFileStore(orgId, mbxGuid);
            }
            catch (Exception ex)
            {
                UmGlobals.ExEvent.LogEvent(InfoWorkerEventLogConstants.Tuple_UnableToAccessOrganizationMailbox, null, new object[]
                {
                    orgId,
                    mbxGuid,
                    CommonUtil.ToEventLogString(ex)
                });
                if (!GroupMetricsMailboxFileStore.IsExpectedException(ex))
                {
                    throw;
                }
            }
            return(result);
        }
Пример #8
0
        // Token: 0x060010A5 RID: 4261 RVA: 0x00061A44 File Offset: 0x0005FC44
        private MailboxSession TryGetMailboxSession()
        {
            MailboxSession result = null;

            try
            {
                result = DirectoryMailboxFileStore.GetMailboxSession(base.OrgId, base.MailboxGuid);
            }
            catch (Exception ex)
            {
                UmGlobals.ExEvent.LogEvent(InfoWorkerEventLogConstants.Tuple_UnableToAccessOrganizationMailbox, null, new object[]
                {
                    base.OrgId,
                    base.MailboxGuid,
                    CommonUtil.ToEventLogString(ex)
                });
                if (!GroupMetricsMailboxFileStore.IsExpectedException(ex))
                {
                    throw;
                }
            }
            return(result);
        }