Ejemplo n.º 1
0
        // Token: 0x06000193 RID: 403 RVA: 0x000083D0 File Offset: 0x000065D0
        protected override AnchorMailboxCacheEntry LoadCacheEntryFromIncomingCookie()
        {
            BackEndDatabaseCookieEntry backEndDatabaseCookieEntry = base.IncomingCookieEntry as BackEndDatabaseCookieEntry;

            if (backEndDatabaseCookieEntry != null)
            {
                if (ExTraceGlobals.VerboseTracer.IsTraceEnabled(1))
                {
                    ExTraceGlobals.VerboseTracer.TraceDebug <UserBasedAnchorMailbox, BackEndDatabaseCookieEntry>((long)this.GetHashCode(), "[UserBasedAnchorMailbox::LoadCacheEntryFromIncomingCookie]: Anchor mailbox {0} using cookie entry {1} as cache entry.", this, backEndDatabaseCookieEntry);
                }
                BackEndDatabaseResourceForestCookieEntry    backEndDatabaseResourceForestCookieEntry    = base.IncomingCookieEntry as BackEndDatabaseResourceForestCookieEntry;
                BackEndDatabaseOrganizationAwareCookieEntry backEndDatabaseOrganizationAwareCookieEntry = base.IncomingCookieEntry as BackEndDatabaseOrganizationAwareCookieEntry;
                return(new AnchorMailboxCacheEntry
                {
                    Database = new ADObjectId(backEndDatabaseCookieEntry.Database, (backEndDatabaseResourceForestCookieEntry == null) ? null : backEndDatabaseResourceForestCookieEntry.ResourceForest),
                    DomainName = backEndDatabaseCookieEntry.Domain,
                    IsOrganizationMailboxDatabase = (backEndDatabaseOrganizationAwareCookieEntry != null && backEndDatabaseOrganizationAwareCookieEntry.IsOrganizationMailboxDatabase)
                });
            }
            if (ExTraceGlobals.VerboseTracer.IsTraceEnabled(1))
            {
                ExTraceGlobals.VerboseTracer.TraceDebug <UserBasedAnchorMailbox>((long)this.GetHashCode(), "[UserBasedAnchorMailbox::LoadCacheEntryFromCookie]: Anchor mailbox {0} had no BackEndDatabaseCookie.", this);
            }
            return(null);
        }
        protected override AnchorMailboxCacheEntry LoadCacheEntryFromIncomingCookie()
        {
            BackEndDatabaseCookieEntry backEndDatabaseCookieEntry = base.IncomingCookieEntry as BackEndDatabaseCookieEntry;

            if (backEndDatabaseCookieEntry != null)
            {
                ExTraceGlobals.VerboseTracer.TraceDebug <DatabaseNameAnchorMailbox, BackEndDatabaseCookieEntry>((long)this.GetHashCode(), "[DatabaseNameAnchorMailbox::LoadCacheEntryFromCookie]: Anchor mailbox {0} using cookie entry {1} as cache entry.", this, backEndDatabaseCookieEntry);
                BackEndDatabaseResourceForestCookieEntry backEndDatabaseResourceForestCookieEntry = base.IncomingCookieEntry as BackEndDatabaseResourceForestCookieEntry;
                return(new AnchorMailboxCacheEntry
                {
                    Database = new ADObjectId(backEndDatabaseCookieEntry.Database, (backEndDatabaseResourceForestCookieEntry == null) ? null : backEndDatabaseResourceForestCookieEntry.ResourceForest)
                });
            }
            ExTraceGlobals.VerboseTracer.TraceDebug <DatabaseNameAnchorMailbox>((long)this.GetHashCode(), "[DatabaseNameAnchorMailbox::LoadCacheEntryFromCookie]: Anchor mailbox {0} had no BackEndDatabaseCookie.", this);
            return(null);
        }
        // Token: 0x06000282 RID: 642 RVA: 0x0000CE20 File Offset: 0x0000B020
        public static bool TryParse(string entryValue, out BackEndCookieEntryBase cookieEntry, out string clearCookie)
        {
            cookieEntry = null;
            clearCookie = null;
            if (string.IsNullOrEmpty(entryValue))
            {
                return(false);
            }
            bool result;

            try
            {
                string text = BackEndCookieEntryParser.UnObscurify(entryValue);
                clearCookie = text;
                string[] array = StringExtensions.SplitFast(text, '~', int.MaxValue, StringSplitOptions.None);
                if (array.Length < 4)
                {
                    result = false;
                }
                else
                {
                    BackEndCookieEntryType backEndCookieEntryType;
                    if (!BackEndCookieEntryBase.TryGetBackEndCookieEntryTypeFromString(array[0], out backEndCookieEntryType))
                    {
                        backEndCookieEntryType = (BackEndCookieEntryType)Enum.Parse(typeof(BackEndCookieEntryType), array[0], true);
                    }
                    ExDateTime expiryTime;
                    if (!BackEndCookieEntryParser.TryParseDateTime(array[3], out expiryTime))
                    {
                        result = false;
                    }
                    else if (backEndCookieEntryType != BackEndCookieEntryType.Server)
                    {
                        if (backEndCookieEntryType == BackEndCookieEntryType.Database)
                        {
                            Guid   database       = new Guid(array[1]);
                            string text2          = string.IsNullOrEmpty(array[2]) ? null : array[2];
                            string resourceForest = (array.Length < 5 || string.IsNullOrEmpty(array[4])) ? null : array[4];
                            if (array.Length >= 6)
                            {
                                bool isOrganizationMailboxDatabase = string.Equals(array[5], 1.ToString(), StringComparison.OrdinalIgnoreCase);
                                cookieEntry = new BackEndDatabaseOrganizationAwareCookieEntry(database, text2, resourceForest, expiryTime, isOrganizationMailboxDatabase);
                            }
                            else if (array.Length == 5)
                            {
                                cookieEntry = new BackEndDatabaseResourceForestCookieEntry(database, text2, resourceForest, expiryTime);
                            }
                            else
                            {
                                cookieEntry = new BackEndDatabaseCookieEntry(database, text2, expiryTime);
                            }
                            result = true;
                        }
                        else
                        {
                            result = false;
                        }
                    }
                    else
                    {
                        cookieEntry = new BackEndServerCookieEntry(array[1], int.Parse(array[2]), expiryTime);
                        result      = true;
                    }
                }
            }
            catch (ArgumentException)
            {
                result = false;
            }
            catch (FormatException)
            {
                result = false;
            }
            return(result);
        }
        public static bool TryParse(string entryValue, out BackEndCookieEntryBase cookieEntry, out string clearCookie)
        {
            cookieEntry = null;
            clearCookie = null;
            if (string.IsNullOrEmpty(entryValue))
            {
                return(false);
            }
            bool result;

            try
            {
                string text = BackEndCookieEntryParser.UnObscurify(entryValue);
                clearCookie = text;
                string[] array = text.Split(BackEndCookieEntryParser.CookieSeparators);
                if (array.Length < 4)
                {
                    result = false;
                }
                else
                {
                    BackEndCookieEntryType backEndCookieEntryType;
                    if (!BackEndCookieEntryBase.TryGetBackEndCookieEntryTypeFromString(array[0], out backEndCookieEntryType))
                    {
                        backEndCookieEntryType = (BackEndCookieEntryType)Enum.Parse(typeof(BackEndCookieEntryType), array[0], true);
                    }
                    ExDateTime expiryTime;
                    if (!BackEndCookieEntryParser.TryParseDateTime(array[3], out expiryTime))
                    {
                        result = false;
                    }
                    else
                    {
                        switch (backEndCookieEntryType)
                        {
                        case BackEndCookieEntryType.Server:
                            cookieEntry = new BackEndServerCookieEntry(array[1], int.Parse(array[2]), expiryTime);
                            result      = true;
                            break;

                        case BackEndCookieEntryType.Database:
                        {
                            Guid   database = new Guid(array[1]);
                            string text2    = string.IsNullOrEmpty(array[2]) ? null : array[2];
                            if (array.Length == 5)
                            {
                                string resourceForest = string.IsNullOrEmpty(array[4]) ? null : array[4];
                                cookieEntry = new BackEndDatabaseResourceForestCookieEntry(database, text2, resourceForest, expiryTime);
                            }
                            else
                            {
                                cookieEntry = new BackEndDatabaseCookieEntry(database, text2, expiryTime);
                            }
                            result = true;
                            break;
                        }

                        default:
                            result = false;
                            break;
                        }
                    }
                }
            }
            catch (ArgumentException)
            {
                result = false;
            }
            catch (FormatException)
            {
                result = false;
            }
            return(result);
        }