예제 #1
0
        // Token: 0x060001FB RID: 507 RVA: 0x00013060 File Offset: 0x00011260
        public void Render(TextWriter output)
        {
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }
            if (this.messages.Count == 0)
            {
                return;
            }
            Infobar.InfobarMessageComparer comparer = new Infobar.InfobarMessageComparer();
            this.messages.Sort(comparer);
            output.Write("<div id=\"divIB\">");
            int num;

            for (int i = 0; i < this.messages.Count; i = num)
            {
                num = i + 1;
                while (num < this.messages.Count && ((InfobarMessage)this.messages[num]).Type == ((InfobarMessage)this.messages[i]).Type)
                {
                    num++;
                }
                InfobarMessage infobarMessage = (InfobarMessage)this.messages[i];
                output.Write("<div id=");
                switch (infobarMessage.Type)
                {
                case InfobarMessageType.Expanding:
                case InfobarMessageType.Informational:
                case InfobarMessageType.Prompt:
                case InfobarMessageType.Warning:
                    output.Write("dvInf");
                    break;

                case InfobarMessageType.Error:
                    output.Write("dvErr");
                    break;

                case InfobarMessageType.JunkEmail:
                    output.Write("dvJnkMl");
                    break;

                case InfobarMessageType.Phishing:
                    output.Write("dvPhsh");
                    break;
                }
                output.Write(">");
                bool flag = false;
                if (infobarMessage.Type == InfobarMessageType.Error || infobarMessage.Type == InfobarMessageType.JunkEmail || infobarMessage.Type == InfobarMessageType.Phishing || infobarMessage.Type == InfobarMessageType.Prompt || infobarMessage.Type == InfobarMessageType.Warning)
                {
                    flag = true;
                    output.Write("<table cellpadding=\"0\" cellspacing=\"0\">");
                    output.Write("<tr><td valign=\"top\" rowspan=\"");
                    output.Write(num - i);
                    output.Write("\"><img src=\"");
                    switch (infobarMessage.Type)
                    {
                    case InfobarMessageType.Prompt:
                        this.userContext.RenderThemeFileUrl(output, ThemeFileId.Exclaim);
                        break;

                    case InfobarMessageType.Error:
                        this.userContext.RenderThemeFileUrl(output, ThemeFileId.Error);
                        break;

                    case InfobarMessageType.JunkEmail:
                    case InfobarMessageType.Phishing:
                        this.userContext.RenderThemeFileUrl(output, ThemeFileId.YellowShield);
                        break;

                    case InfobarMessageType.Warning:
                        this.userContext.RenderThemeFileUrl(output, ThemeFileId.Warning);
                        break;
                    }
                    output.Write("\" alt=\"\"></td>");
                    output.Write("<td class=\"w100\">");
                    if (infobarMessage.Type == InfobarMessageType.Prompt)
                    {
                        Infobar.RenderPromptMessage(output, infobarMessage);
                    }
                    else
                    {
                        Infobar.RenderInfoMessage(output, infobarMessage);
                    }
                    output.Write("</td></tr>");
                    i++;
                }
                if (flag && i < num)
                {
                    output.Write("<tr><td class=\"w100\">");
                }
                for (int j = i; j < num; j++)
                {
                    infobarMessage = (InfobarMessage)this.messages[j];
                    if (infobarMessage.Type == InfobarMessageType.Expanding)
                    {
                        Infobar.RenderExpandingMessage(output, infobarMessage, j > 0);
                    }
                    else if (infobarMessage.Type == InfobarMessageType.Prompt)
                    {
                        Infobar.RenderPromptMessage(output, infobarMessage);
                    }
                    else
                    {
                        Infobar.RenderInfoMessage(output, infobarMessage);
                    }
                }
                if (flag && i < num)
                {
                    output.Write("</td></tr>");
                }
                if (flag)
                {
                    output.Write("</table>");
                }
                output.Write("</div>");
            }
            output.Write("</div>");
        }
예제 #2
0
 // Token: 0x060001F9 RID: 505 RVA: 0x00013036 File Offset: 0x00011236
 internal void AddMessageHtml(SanitizedHtmlString messageHtml, InfobarMessageType type)
 {
     this.messages.Add(InfobarMessage.CreateHtml(messageHtml, type));
 }
예제 #3
0
 // Token: 0x060001FA RID: 506 RVA: 0x0001304B File Offset: 0x0001124B
 internal void AddMessageLocalized(Strings.IDs stringId, InfobarMessageType type)
 {
     this.messages.Add(InfobarMessage.CreateLocalized(stringId, type));
 }
예제 #4
0
 // Token: 0x060001F8 RID: 504 RVA: 0x00013021 File Offset: 0x00011221
 internal void AddMessageText(string messageText, InfobarMessageType type)
 {
     this.messages.Add(InfobarMessage.CreateText(messageText, type));
 }
예제 #5
0
 // Token: 0x060001F7 RID: 503 RVA: 0x00013012 File Offset: 0x00011212
 internal void AddMessage(InfobarMessage message)
 {
     this.messages.Add(message);
 }
        // Token: 0x060001E8 RID: 488 RVA: 0x00012708 File Offset: 0x00010908
        public bool Delete(StoreObjectId folderId, bool isPermanentDelete)
        {
            OperationResult          operationResult = OperationResult.Succeeded;
            AggregateOperationResult aggregateOperationResult;

            try
            {
                aggregateOperationResult = this.owaContext.UserContext.MailboxSession.Delete(isPermanentDelete ? DeleteItemFlags.HardDelete : DeleteItemFlags.MoveToDeletedItems, new StoreId[]
                {
                    folderId
                });
                operationResult = aggregateOperationResult.OperationResult;
            }
            catch (ObjectNotFoundException)
            {
                this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateLocalized(2106120183, InfobarMessageType.Error);
                return(false);
            }
            catch (InvalidOperationException)
            {
                this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateLocalized(1752827486, InfobarMessageType.Error);
                return(false);
            }
            catch (StoragePermanentException e)
            {
                InfobarMessage.PutExceptionInfoIntoContextInfobarMessage(e, this.owaContext);
                return(false);
            }
            catch (StorageTransientException e2)
            {
                InfobarMessage.PutExceptionInfoIntoContextInfobarMessage(e2, this.owaContext);
                return(false);
            }
            if (operationResult != OperationResult.Succeeded)
            {
                int i = 0;
                while (i < aggregateOperationResult.GroupOperationResults.Length)
                {
                    GroupOperationResult groupOperationResult = aggregateOperationResult.GroupOperationResults[i];
                    if (groupOperationResult.OperationResult != OperationResult.Succeeded)
                    {
                        if (groupOperationResult.Exception is ObjectNotFoundException)
                        {
                            this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateLocalized(2106120183, InfobarMessageType.Error);
                            return(false);
                        }
                        if (groupOperationResult.Exception is ObjectExistedException)
                        {
                            this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateLocalized(1041829989, InfobarMessageType.Error);
                            return(false);
                        }
                        if (groupOperationResult.Exception is CannotMoveDefaultFolderException)
                        {
                            this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateLocalized(1752827486, InfobarMessageType.Error);
                            return(false);
                        }
                        if (groupOperationResult.Exception is PartialCompletionException)
                        {
                            this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateLocalized(1752827486, InfobarMessageType.Error);
                            return(false);
                        }
                        InfobarMessage.PutExceptionInfoIntoContextInfobarMessage(aggregateOperationResult.GroupOperationResults[i].Exception, this.owaContext);
                        return(false);
                    }
                    else
                    {
                        i++;
                    }
                }
            }
            this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateLocalized(-572096464, InfobarMessageType.Informational);
            return(true);
        }
        // Token: 0x060001E5 RID: 485 RVA: 0x00012168 File Offset: 0x00010368
        public bool Move(StoreObjectId sourceId, StoreObjectId destinationId)
        {
            OperationResult          operationResult = OperationResult.Succeeded;
            string                   arg             = string.Empty;
            AggregateOperationResult aggregateOperationResult;

            try
            {
                using (Folder folder = Folder.Bind(this.owaContext.UserContext.MailboxSession, sourceId, new PropertyDefinition[]
                {
                    FolderSchema.DisplayName
                }))
                {
                    arg = folder.DisplayName;
                }
                aggregateOperationResult = this.owaContext.UserContext.MailboxSession.Move(destinationId, new StoreId[]
                {
                    sourceId
                });
                operationResult = aggregateOperationResult.OperationResult;
            }
            catch (ObjectNotFoundException)
            {
                this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateLocalized(2106120183, InfobarMessageType.Error);
                return(false);
            }
            catch (InvalidOperationException)
            {
                this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateLocalized(442250020, InfobarMessageType.Error);
                return(false);
            }
            catch (StoragePermanentException e)
            {
                InfobarMessage.PutExceptionInfoIntoContextInfobarMessage(e, this.owaContext);
                return(false);
            }
            catch (StorageTransientException e2)
            {
                InfobarMessage.PutExceptionInfoIntoContextInfobarMessage(e2, this.owaContext);
                return(false);
            }
            if (operationResult == OperationResult.Failed)
            {
                int i = 0;
                while (i < aggregateOperationResult.GroupOperationResults.Length)
                {
                    GroupOperationResult groupOperationResult = aggregateOperationResult.GroupOperationResults[i];
                    if (groupOperationResult.OperationResult != OperationResult.Succeeded)
                    {
                        if (groupOperationResult.Exception is CannotMoveDefaultFolderException)
                        {
                            this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateLocalized(442250020, InfobarMessageType.Error);
                            return(false);
                        }
                        if (groupOperationResult.Exception is ObjectExistedException)
                        {
                            this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateLocalized(896702607, InfobarMessageType.Error);
                            return(false);
                        }
                        InfobarMessage.PutExceptionInfoIntoContextInfobarMessage(aggregateOperationResult.GroupOperationResults[i].Exception, this.owaContext);
                        return(false);
                    }
                    else
                    {
                        i++;
                    }
                }
            }
            else if (operationResult == OperationResult.PartiallySucceeded)
            {
                this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateLocalized(-1093060331, InfobarMessageType.Error);
                return(false);
            }
            this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateText(string.Format(LocalizedStrings.GetNonEncoded(2053728082), arg), InfobarMessageType.Informational);
            return(true);
        }
        // Token: 0x060001E7 RID: 487 RVA: 0x000124D0 File Offset: 0x000106D0
        public bool Rename(StoreObjectId destinationId, string folderName)
        {
            if (destinationId == null)
            {
                throw new ArgumentNullException("destinationId");
            }
            if (folderName == null)
            {
                throw new ArgumentNullException("folderName");
            }
            folderName = folderName.Trim();
            if (folderName.Length == 0)
            {
                this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateLocalized(615663605, InfobarMessageType.Error);
                return(false);
            }
            if (folderName.Length > 256)
            {
                this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateLocalized(-1198351885, InfobarMessageType.Error);
                return(false);
            }
            StoreObjectType  objectType = destinationId.ObjectType;
            FolderSaveResult folderSaveResult;

            try
            {
                Folder folder2;
                Folder folder = folder2 = Folder.Bind(this.owaContext.UserContext.MailboxSession, destinationId);
                try
                {
                    folder.DisplayName = folderName;
                    folderSaveResult   = folder.Save();
                }
                finally
                {
                    if (folder2 != null)
                    {
                        ((IDisposable)folder2).Dispose();
                    }
                }
            }
            catch (ObjectNotFoundException)
            {
                this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateLocalized(2106120183, InfobarMessageType.Error);
                return(false);
            }
            catch (ObjectValidationException)
            {
                this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateLocalized(2103130667, InfobarMessageType.Error);
                return(false);
            }
            catch (InvalidOperationException)
            {
                this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateLocalized(2103130667, InfobarMessageType.Error);
                return(false);
            }
            catch (StoragePermanentException e)
            {
                InfobarMessage.PutExceptionInfoIntoContextInfobarMessage(e, this.owaContext);
                return(false);
            }
            catch (StorageTransientException e2)
            {
                InfobarMessage.PutExceptionInfoIntoContextInfobarMessage(e2, this.owaContext);
                return(false);
            }
            if (folderSaveResult.OperationResult != OperationResult.Succeeded)
            {
                if (folderSaveResult.PropertyErrors.Length > 0)
                {
                    switch (folderSaveResult.PropertyErrors[0].PropertyErrorCode)
                    {
                    case PropertyErrorCode.MapiCallFailed:
                        this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateLocalized(2103130667, InfobarMessageType.Error);
                        return(false);

                    case PropertyErrorCode.FolderNameConflict:
                        this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateLocalized(1602494619, InfobarMessageType.Error);
                        return(false);
                    }
                }
                this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateLocalized(2103130667, InfobarMessageType.Error);
                return(false);
            }
            this.owaContext[OwaContextProperty.InfobarMessage] = InfobarMessage.CreateText(string.Format(LocalizedStrings.GetNonEncoded(-889243793), folderName), InfobarMessageType.Informational);
            return(true);
        }