Beispiel #1
0
 // Token: 0x0600098B RID: 2443 RVA: 0x00043642 File Offset: 0x00041842
 public FormsRegistryContext(ApplicationElement applicationElement, string type, string state, string action)
 {
     this.ApplicationElement = applicationElement;
     this.Type   = type;
     this.State  = state;
     this.Action = action;
 }
Beispiel #2
0
        public static string ToString(FlightType type, ApplicationElement appElement = ApplicationElement.SearchFlight)
        {
            if (appElement == ApplicationElement.SearchFlight)
            {
                switch (type)
                {
                case FlightType.OneWay: return("One-way");

                case FlightType.RoundTrip: return("Return journey");

                case FlightType.MultiCity: return("Multi-city");

                default:
                    throw new Exception("FlightTypeConverter. Cannot convert given FlightType: "
                                        + type.ToString() + " to string");
                }
            }
            else if (appElement == ApplicationElement.FlightSummary)
            {
                switch (type)
                {
                case FlightType.OneWay: return("One-way");

                case FlightType.RoundTrip: return("Round Trip");

                case FlightType.MultiCity: return("Multi-city");

                default:
                    throw new Exception("FlightTypeConverter. Cannot convert given FlightType: "
                                        + type.ToString() + " to string");
                }
            }

            return(null);
        }
Beispiel #3
0
        public void ApplicationCoordinatorRefreshRemove()
        {
            ApplicationElement element1 = new ApplicationElement()
            {
                ApplicationPath = ApplicationUtils.CreateValidExampleApplication(), Framework = Framework
            };
            ApplicationElement element2 = new ApplicationElement()
            {
                ApplicationPath = ApplicationUtils.CreateValidExampleApplication(), Framework = Framework
            };
            ApplicationElement element3 = new ApplicationElement()
            {
                ApplicationPath = ApplicationUtils.CreateValidExampleApplication(), Framework = Framework
            };

            using (ApplicationCoordinator coordinator = new ApplicationCoordinator(Logger, Path.GetFullPath("Collar.exe")))
            {
                coordinator.StartAndRefresh(new ApplicationElement[] { element1, element2, element3 });
                Assert.IsTrue(coordinator.IsRunning);

                var paths = coordinator.GetCoordinatedApplicationPaths();
                Assert.AreEqual(3, coordinator.Count);
                Assert.IsTrue(paths.Contains(element1.ApplicationPath));
                Assert.IsTrue(paths.Contains(element2.ApplicationPath));
                Assert.IsTrue(paths.Contains(element3.ApplicationPath));

                coordinator.StartAndRefresh(new ApplicationElement[] { element1, element3 });
                Assert.IsTrue(coordinator.IsRunning);

                paths = coordinator.GetCoordinatedApplicationPaths();
                Assert.AreEqual(2, coordinator.Count);
                Assert.IsTrue(paths.Contains(element1.ApplicationPath));
                Assert.IsTrue(paths.Contains(element3.ApplicationPath));
            }
        }
        // Token: 0x06000300 RID: 768 RVA: 0x0001AF0C File Offset: 0x0001910C
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("OwaContext");
            }
            applicationElement = ApplicationElement.NotSet;
            type   = null;
            state  = null;
            action = null;
            HttpRequest request     = owaContext.HttpContext.Request;
            UserContext userContext = owaContext.UserContext;

            if (!Utilities.IsPostRequest(request))
            {
                return(userContext.LastClientViewState.ToPreFormActionResponse());
            }
            string             type2 = owaContext.FormsRegistryContext.Type;
            NavigationModule   navigationModuleFromStoreType   = MoveItemHelper.GetNavigationModuleFromStoreType(type2);
            ApplicationElement applicationElementFromStoreType = MoveItemHelper.GetApplicationElementFromStoreType(type2);

            if ((navigationModuleFromStoreType == NavigationModule.Calendar && !userContext.IsFeatureEnabled(Feature.Calendar)) || (navigationModuleFromStoreType == NavigationModule.Contacts && !userContext.IsFeatureEnabled(Feature.Contacts)))
            {
                throw new OwaSegmentationException("The " + type + " feature is disabled");
            }
            StoreObjectId[] storeObjectIdsFromForm        = RequestParser.GetStoreObjectIdsFromForm(request, true);
            StoreObjectId   folderIdFromQueryString       = RequestParser.GetFolderIdFromQueryString(request, true);
            StoreObjectId   targetFolderIdFromQueryString = RequestParser.GetTargetFolderIdFromQueryString(request, true);
            string          formParameter = Utilities.GetFormParameter(request, "hidt");

            string[] array = formParameter.Split(new char[]
            {
                ','
            });
            if (array.Length != storeObjectIdsFromForm.Length)
            {
                throw new OwaInvalidRequestException("The counts of the items and their types are not identical.");
            }
            ItemOperations.Result result = null;
            if (navigationModuleFromStoreType == NavigationModule.Mail && applicationElementFromStoreType == ApplicationElement.Item)
            {
                result = ItemOperations.GetNextViewItem(userContext, ItemOperations.Action.Delete, storeObjectIdsFromForm[0], folderIdFromQueryString);
            }
            if (!MoveItemPreFormAction.DoMove(targetFolderIdFromQueryString, storeObjectIdsFromForm, array, owaContext))
            {
                PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
                preFormActionResponse.ApplicationElement = ApplicationElement.Dialog;
                preFormActionResponse.Type   = owaContext.FormsRegistryContext.Type;
                preFormActionResponse.Action = owaContext.FormsRegistryContext.Action;
                preFormActionResponse.AddParameter("fid", folderIdFromQueryString.ToBase64String());
                return(preFormActionResponse);
            }
            if (result != null)
            {
                owaContext[OwaContextProperty.InfobarMessage] = null;
            }
            userContext.ForceNewSearch = true;
            return(ItemOperations.GetPreFormActionResponse(userContext, result));
        }
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            applicationElement = ApplicationElement.NotSet;
            type   = string.Empty;
            state  = string.Empty;
            action = string.Empty;
            HttpContext httpContext = owaContext.HttpContext;

            this.userContext = owaContext.UserContext;
            HttpRequest request = httpContext.Request;

            if (!Utilities.IsPostRequest(request) && owaContext.FormsRegistryContext.Action != "Prev" && owaContext.FormsRegistryContext.Action != "Next")
            {
                return(this.userContext.LastClientViewState.ToPreFormActionResponse());
            }
            this.context = owaContext;
            StoreId storeId = null;

            this.itemType = this.context.FormsRegistryContext.Type;
            string text;
            string storeObjectId;

            if (Utilities.IsPostRequest(request))
            {
                text = Utilities.GetFormParameter(request, "hidid", false);
                if (text == null)
                {
                    throw new OwaInvalidRequestException("MessageId is not set in the form");
                }
                string formParameter = Utilities.GetFormParameter(request, "hidchk", false);
                if (formParameter != null)
                {
                    storeId = Utilities.CreateItemId(this.userContext.MailboxSession, text, formParameter);
                }
                storeObjectId = Utilities.GetFormParameter(request, "hidfldid", true);
                string formParameter2 = Utilities.GetFormParameter(request, "rdoRsp", false);
                int    num;
                if (!string.IsNullOrEmpty(formParameter2) && int.TryParse(formParameter2, out num))
                {
                    this.responseAction = (MeetingPagePreFormAction.ResponseAction)num;
                }
            }
            else
            {
                text          = Utilities.GetQueryStringParameter(request, "id", false);
                storeObjectId = Utilities.GetQueryStringParameter(request, "fId", true);
            }
            ItemOperations.Result result         = null;
            StoreObjectId         storeObjectId2 = Utilities.CreateStoreObjectId(this.userContext.MailboxSession, text);
            StoreObjectId         folderId       = Utilities.CreateStoreObjectId(this.userContext.MailboxSession, storeObjectId);
            string action2;

            if ((action2 = owaContext.FormsRegistryContext.Action) != null)
            {
                if (< PrivateImplementationDetails > { 83F 8DD 10 - 61AE - 4283 - B829 - 2F 464F 055E61 }.$$method0x60002a7 - 1 == null)
        public ApplicationWindow(ApplicationElement element)
        {
            Current = this;
            Element = element;
            Title   = element.Name ?? "Unknown Title";

            InitializeComponent();
        }
Beispiel #7
0
 // Token: 0x06000B84 RID: 2948 RVA: 0x00050A94 File Offset: 0x0004EC94
 public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
 {
     applicationElement = ApplicationElement.Item;
     type   = "Disabled";
     action = owaContext.FormsRegistryContext.Action;
     state  = string.Empty;
     return(null);
 }
Beispiel #8
0
 internal FormKey(string experience, ApplicationElement application, string itemClass, string action, string state)
 {
     this.experience  = experience;
     this.application = application;
     this.itemClass   = itemClass;
     this.action      = action;
     this.state       = state;
 }
Beispiel #9
0
        /// <summary>
        /// Provide the stages where an element is in use
        /// </summary>
        /// <param name="el">The element to search</param>
        /// <param name="obj">The object to use in the search</param>
        /// <returns></returns>
        public IEnumerable <Stage> ElementUses(ApplicationElement el, ObjectStage obj)
        {
            var res = new List <Stage>();

            res.AddRange(ElementUses(el, obj.MainPage));
            res.AddRange(ElementUses(el, obj.Pages.SelectMany(i => i.Stages)));
            return(res);
        }
Beispiel #10
0
        // Token: 0x06000225 RID: 549 RVA: 0x00013E08 File Offset: 0x00012008
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            applicationElement = ApplicationElement.NotSet;
            type   = string.Empty;
            action = string.Empty;
            state  = string.Empty;
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
            Item item  = null;
            Item item2 = null;
            Item item3 = null;

            try
            {
                HttpContext httpContext = owaContext.HttpContext;
                UserContext userContext = owaContext.UserContext;
                item = ReplyForwardUtilities.GetItemForRequest(owaContext, out item2);
                if (!(item is CalendarItemBase) && !(item is MessageItem))
                {
                    item3 = ReplyForwardUtilities.CreateForwardMessageWithItemAttached(item, userContext);
                }
                else
                {
                    item3 = ReplyForwardUtilities.CreateForwardItem(BodyFormat.TextPlain, item, ReplyForwardFlags.None, userContext, Utilities.GetParentFolderId(item2, item));
                }
                AttachmentUtility.PromoteInlineAttachments(item3);
                item3.Save(SaveMode.ResolveConflicts);
                item3.Load();
                ReplyForwardUtilities.DeleteLevelOneAttachments(item3, userContext);
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type   = item3.ClassName;
                preFormActionResponse.Action = "Forward";
                preFormActionResponse.AddParameter("id", item3.Id.ObjectId.ToBase64String());
            }
            finally
            {
                if (item != null)
                {
                    item.Dispose();
                    item = null;
                }
                if (item2 != null)
                {
                    item2.Dispose();
                    item2 = null;
                }
                if (item3 != null)
                {
                    item3.Dispose();
                    item3 = null;
                }
            }
            return(preFormActionResponse);
        }
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            applicationElement = ApplicationElement.NotSet;
            type   = string.Empty;
            action = string.Empty;
            state  = string.Empty;
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
            Item item  = null;
            Item item2 = null;
            Item item3 = null;

            try
            {
                HttpContext httpContext = owaContext.HttpContext;
                UserContext userContext = owaContext.UserContext;
                item = ReplyForwardUtilities.GetItemForRequest(owaContext, out item2);
                if (!(item is CalendarItemBase) && !(item is MessageItem))
                {
                    throw new OwaInvalidRequestException("Item is not supported for reply");
                }
                if (item is ReportMessage)
                {
                    Utilities.TransferToErrorPage(owaContext, LocalizedStrings.GetNonEncoded(2128562495));
                }
                item3 = ReplyForwardUtilities.CreateReplyItem(BodyFormat.TextPlain, item, ReplyForwardFlags.None, userContext, null);
                AttachmentUtility.PromoteInlineAttachments(item3);
                item3.Save(SaveMode.ResolveConflicts);
                item3.Load();
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type   = "IPM.Note";
                preFormActionResponse.Action = "Reply";
                preFormActionResponse.AddParameter("id", item3.Id.ObjectId.ToBase64String());
            }
            finally
            {
                if (item != null)
                {
                    item.Dispose();
                    item = null;
                }
                if (item2 != null)
                {
                    item2.Dispose();
                    item2 = null;
                }
                if (item3 != null)
                {
                    item3.Dispose();
                    item3 = null;
                }
            }
            return(preFormActionResponse);
        }
 public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
 {
     if (owaContext == null)
     {
         throw new ArgumentNullException("owaContext");
     }
     applicationElement = ApplicationElement.Item;
     type   = owaContext.FormsRegistryContext.Type;
     state  = owaContext.FormsRegistryContext.State;
     action = owaContext.FormsRegistryContext.Action;
     return(null);
 }
Beispiel #13
0
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            applicationElement = ApplicationElement.Item;
            type   = string.Empty;
            action = string.Empty;
            state  = string.Empty;
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
            Item item  = null;
            Item item2 = null;
            Item item3 = null;

            try
            {
                HttpContext httpContext          = owaContext.HttpContext;
                UserContext userContext          = owaContext.UserContext;
                string      queryStringParameter = Utilities.GetQueryStringParameter(httpContext.Request, "fId", true);
                item = ReplyForwardUtilities.GetItemForRequest(owaContext, out item2);
                BodyFormat replyForwardBodyFormat = ReplyForwardUtilities.GetReplyForwardBodyFormat(item, userContext);
                item3 = ReplyForwardUtilities.CreatePostReplyItem(replyForwardBodyFormat, item as PostItem, userContext, Utilities.GetParentFolderId(item2, item));
                item3.Save(SaveMode.ResolveConflicts);
                item3.Load();
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type   = "IPM.Post";
                preFormActionResponse.Action = "PostReply";
                preFormActionResponse.AddParameter("Id", OwaStoreObjectId.CreateFromStoreObject(item3).ToBase64String());
                preFormActionResponse.AddParameter("fId", queryStringParameter);
            }
            finally
            {
                if (item != null)
                {
                    item.Dispose();
                    item = null;
                }
                if (item2 != null)
                {
                    item2.Dispose();
                    item2 = null;
                }
                if (item3 != null)
                {
                    item3.Dispose();
                    item3 = null;
                }
            }
            return(preFormActionResponse);
        }
        private void ParseApplicationElement(string experience)
        {
            ExTraceGlobals.FormsRegistryCallTracer.TraceDebug((long)this.GetHashCode(), "FormsRegistryParser.ParseApplicationElement");
            bool flag = false;

            if (!this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[1]))
            {
                this.ThrowExpectedAttributeException(FormsRegistryParser.NameTableValues.Name);
            }
            object obj = FormsRegistry.ApplicationElementParser.Parse(this.reader.Value);

            if (obj == null)
            {
                this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Invalid ApplicationElement: {0}", new object[]
                {
                    this.reader.Value
                }), ClientsEventLogConstants.Tuple_FormsRegistryInvalidApplicationElement, new object[]
                {
                    this.registryFile,
                    this.reader.LineNumber.ToString(CultureInfo.InvariantCulture),
                    this.reader.LinePosition.ToString(CultureInfo.InvariantCulture),
                    this.reader.Value
                });
            }
            ApplicationElement applicationElement = (ApplicationElement)obj;

            while (!flag && this.reader.Read())
            {
                XmlNodeType nodeType = this.reader.NodeType;
                if (nodeType != XmlNodeType.Element)
                {
                    if (nodeType == XmlNodeType.EndElement)
                    {
                        if (this.reader.Name == FormsRegistryParser.nameTableValues[11])
                        {
                            flag = true;
                        }
                    }
                }
                else if (this.reader.Name == FormsRegistryParser.nameTableValues[12])
                {
                    this.ParseElementClass(experience, applicationElement);
                }
                else
                {
                    this.ThrowExpectedElementException(FormsRegistryParser.NameTableValues.ElementClass);
                }
            }
        }
Beispiel #15
0
        // Token: 0x0600132F RID: 4911 RVA: 0x000770CC File Offset: 0x000752CC
        internal static ApplicationElement GetApplicationElement(HttpRequest httpRequest)
        {
            ApplicationElement result = ApplicationElement.StartPage;
            string             queryStringParameter = Utilities.GetQueryStringParameter(httpRequest, "ae", false);

            if (!string.IsNullOrEmpty(queryStringParameter))
            {
                object obj = FormsRegistry.ApplicationElementParser.Parse(httpRequest.QueryString["ae"]);
                if (obj == null)
                {
                    throw new OwaInvalidRequestException("Invalid application element");
                }
                result = (ApplicationElement)obj;
            }
            return(result);
        }
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            applicationElement = ApplicationElement.NotSet;
            type   = string.Empty;
            action = string.Empty;
            state  = string.Empty;
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
            HttpContext           httpContext           = owaContext.HttpContext;
            string            queryStringParameter      = Utilities.GetQueryStringParameter(httpContext.Request, "lDn", true);
            IRecipientSession recipientSession          = Utilities.CreateADRecipientSession(ConsistencyMode.IgnoreInvalid, owaContext.UserContext);

            Result <ADRawEntry>[] array = recipientSession.FindByLegacyExchangeDNs(new string[]
            {
                queryStringParameter
            }, ItemReadADObjectPreFormAction.recipientQueryProperties);
            if (array == null || array.Length != 1)
            {
                throw new OwaADObjectNotFoundException();
            }
            ADRawEntry data       = array[0].Data;
            ADObjectId adobjectId = null;

            if (data != null)
            {
                adobjectId = (ADObjectId)data[ADObjectSchema.Id];
            }
            if (adobjectId == null)
            {
                throw new OwaADObjectNotFoundException();
            }
            preFormActionResponse.ApplicationElement = ApplicationElement.Item;
            preFormActionResponse.Action             = string.Empty;
            preFormActionResponse.AddParameter("id", Convert.ToBase64String(adobjectId.ObjectGuid.ToByteArray()));
            if (Utilities.IsADDistributionList((MultiValuedProperty <string>)data[ADObjectSchema.ObjectClass]))
            {
                preFormActionResponse.Type = "ADDistList";
            }
            else
            {
                preFormActionResponse.Type = "AD.RecipientType.User";
            }
            return(preFormActionResponse);
        }
Beispiel #17
0
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            applicationElement = ApplicationElement.NotSet;
            type   = string.Empty;
            state  = string.Empty;
            action = string.Empty;
            Item item  = null;
            Item item2 = null;
            PreFormActionResponse result;

            try
            {
                item = Utilities.GetItemForRequest <Item>(owaContext, out item2, new PropertyDefinition[]
                {
                    StoreObjectSchema.EffectiveRights
                });
                bool flag = ItemUtility.UserCanEditItem(item);
                PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type = owaContext.FormsRegistryContext.Type;
                preFormActionResponse.AddParameter("id", Utilities.GetQueryStringParameter(owaContext.HttpContext.Request, "id"));
                if (flag)
                {
                    preFormActionResponse.Action = "Open";
                    preFormActionResponse.State  = "Draft";
                }
                result = preFormActionResponse;
            }
            finally
            {
                if (item != null)
                {
                    item.Dispose();
                    item = null;
                }
                if (item2 != null)
                {
                    item2.Dispose();
                    item2 = null;
                }
            }
            return(result);
        }
Beispiel #18
0
        /// <summary>
        /// Provide the stages where an element is in use
        /// </summary>
        /// <param name="el">The element to search</param>
        /// <param name="stages">The stages to use in the search</param>
        /// <returns></returns>
        public IEnumerable <Stage> ElementUses(ApplicationElement el, IEnumerable <Stage> stages)
        {
            var res = new List <Stage>();

            if (el == null || string.IsNullOrWhiteSpace(el.Id))
            {
                return(res);
            }
            var navs      = new[] { "Read", "Write", "Navigate" };
            var navigates = stages.Where(i => navs.Contains(i.Type)).Select(i => (NavigateStage)i).ToList();

            res.AddRange(navigates.Where(i => i.Actions != null && i.Actions.Any(a =>
                                                                                 !string.IsNullOrWhiteSpace(a.ElementId) && a.ElementId == el.Id)));
            var waits = stages.Where(i => i.Type == "WaitStart").Select(i => (WaitStartStage)i).ToList();

            res.AddRange(waits.Where(i => i.Choices != null && i.Choices.Any(c => !string.IsNullOrWhiteSpace(c.ElementId) &&
                                                                             c.ElementId == el.Id)));
            return(res);
        }
Beispiel #19
0
        // Token: 0x06002594 RID: 9620 RVA: 0x000D9874 File Offset: 0x000D7A74
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            applicationElement = ApplicationElement.Item;
            type   = "IPM.Note";
            action = this.Action;
            state  = null;
            string           queryStringParameter  = Utilities.GetQueryStringParameter(owaContext.HttpContext.Request, "id", true);
            string           queryStringParameter2 = Utilities.GetQueryStringParameter(owaContext.HttpContext.Request, "t", true);
            UserContext      userContext           = owaContext.UserContext;
            OwaStoreObjectId owaStoreObjectId      = OwaStoreObjectId.CreateFromString(queryStringParameter);

            if (queryStringParameter2 == "IPM.Sharing" && !owaStoreObjectId.IsPublic)
            {
                using (SharingMessageItem item = Utilities.GetItem <SharingMessageItem>(userContext, owaStoreObjectId, new PropertyDefinition[0]))
                {
                    StoreObjectId     parentId          = item.ParentId;
                    bool              flag              = Utilities.IsItemInDefaultFolder(item, DefaultFolderType.JunkEmail);
                    DefaultFolderType defaultFolderType = DefaultFolderType.None;
                    try
                    {
                        defaultFolderType = item.SharedFolderType;
                    }
                    catch (NotSupportedSharingMessageException ex)
                    {
                        ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "Cannot handle this sharing message due to {0}", ex.Message);
                    }
                    if (defaultFolderType == DefaultFolderType.Calendar && !flag)
                    {
                        type = "IPM.Sharing";
                        if (item.IsDraft)
                        {
                            state = "Draft";
                        }
                    }
                }
            }
            return(null);
        }
        // Token: 0x06001914 RID: 6420 RVA: 0x00091A08 File Offset: 0x0008FC08
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            this.userContext   = owaContext.UserContext;
            this.owaContext    = owaContext;
            applicationElement = ApplicationElement.Folder;
            type   = "IPF.Note";
            action = null;
            state  = null;
            PreFormActionResponse preFormActionResponse = null;

            using (Folder folder = this.ProcessWebPartRequest())
            {
                if (folder != null)
                {
                    preFormActionResponse = new PreFormActionResponse();
                    preFormActionResponse.AddParameter("id", OwaStoreObjectId.CreateFromStoreObject(folder).ToBase64String());
                    if (!string.IsNullOrEmpty(this.webPartParameters["view"]))
                    {
                        preFormActionResponse.AddParameter("view", this.webPartParameters["view"]);
                    }
                    if (this.isoDateString != null)
                    {
                        preFormActionResponse.AddParameter("d", this.isoDateString);
                    }
                    type = folder.ClassName;
                    int num = 0;
                    if (int.TryParse(this.webPartParameters["part"], out num) && num == 1)
                    {
                        applicationElement = ApplicationElement.WebPartFolder;
                    }
                    preFormActionResponse.ApplicationElement = applicationElement;
                    preFormActionResponse.Action             = action;
                    preFormActionResponse.Type  = type;
                    preFormActionResponse.State = state;
                }
            }
            return(preFormActionResponse);
        }
Beispiel #21
0
        public static List <ApplicationElement> IndexTitles(IEnumerable <Title> titles)
        {
            List <ApplicationElement> elements = new List <ApplicationElement>();

            foreach (Title title in titles)
            {
                if (title != null)
                {
                    ApplicationElement searchedApp = elements.FirstOrDefault(x => x?.BaseTitleId == title.GetBaseTitleID());
                    if (searchedApp != null)
                    {
                        searchedApp.Titles.Add(title);
                    }
                    else
                    {
                        ApplicationElement app = new ApplicationElement();
                        app.Titles.Add(title);
                        elements.Add(app);
                    }
                }
            }

            return(elements);
        }
Beispiel #22
0
        public static int GetApplicationPageOrderInBooking(ApplicationElement page)
        {
            switch (page)
            {
            case ApplicationElement.HomePage: return(1);

            case ApplicationElement.CalendarPage: return(2);

            case ApplicationElement.PassengerContactPage: return(3);

            case ApplicationElement.ExtrasComboPage: return(4);

            case ApplicationElement.ExtrasSeatMapPage: return(5);

            case ApplicationElement.PaymentPage: return(6);

            case ApplicationElement.ItineraryPage: return(7);

            default: throw new Exception("ApplicationElementToPageOrder. Cannot take order from given ApplicationElement: "
                                         + page.ToString());
            }

            return(-1);
        }
Beispiel #23
0
        // Token: 0x060022C1 RID: 8897 RVA: 0x000C69B8 File Offset: 0x000C4BB8
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            applicationElement = ApplicationElement.NotSet;
            type   = string.Empty;
            action = string.Empty;
            state  = string.Empty;
            Item                  item       = null;
            Item                  item2      = null;
            Item                  item3      = null;
            bool                  flag       = false;
            BodyFormat            bodyFormat = BodyFormat.TextPlain;
            PreFormActionResponse result;

            try
            {
                HttpContext           httpContext           = owaContext.HttpContext;
                UserContext           userContext           = owaContext.UserContext;
                PreFormActionResponse preFormActionResponse = new PreFormActionResponse(httpContext.Request, new string[]
                {
                    "cb",
                    "smime"
                });
                item = ReplyForwardUtilities.GetItemForRequest(owaContext, out item2);
                if (item != null && !ItemUtility.IsForwardSupported(item))
                {
                    throw new OwaInvalidRequestException("Forwarding of such a type item is not supported.");
                }
                CalendarItemBase calendarItemBase = item as CalendarItemBase;
                if (item is Task || item is ContactBase || (calendarItemBase != null && !calendarItemBase.IsMeeting))
                {
                    item3 = ReplyForwardUtilities.CreateForwardMessageWithItemAttached(item, userContext);
                    preFormActionResponse.Action = "New";
                    preFormActionResponse.AddParameter("exdltdrft", "1");
                }
                else
                {
                    bool   flag2 = false;
                    string queryStringParameter = Utilities.GetQueryStringParameter(httpContext.Request, "smime", false);
                    RightsManagedMessageDecryptionStatus decryptionStatus = RightsManagedMessageDecryptionStatus.FeatureDisabled;
                    if (userContext.IsIrmEnabled)
                    {
                        try
                        {
                            flag = Utilities.IrmDecryptForReplyForward(owaContext, ref item, ref item2, ref bodyFormat, out decryptionStatus);
                        }
                        catch (RightsManagementPermanentException exception)
                        {
                            decryptionStatus = RightsManagedMessageDecryptionStatus.CreateFromException(exception);
                        }
                    }
                    if (!flag)
                    {
                        bodyFormat = ReplyForwardUtilities.GetReplyForwardBodyFormat(item, userContext);
                    }
                    bool flag3 = Utilities.IsSMimeControlNeededForEditForm(queryStringParameter, owaContext);
                    flag2 = ((flag3 && Utilities.IsSMime(item)) || flag);
                    bool flag4 = userContext.IsSmsEnabled && ObjectClass.IsSmsMessage(owaContext.FormsRegistryContext.Type);
                    ReplyForwardFlags replyForwardFlags = ReplyForwardFlags.None;
                    if (flag2)
                    {
                        replyForwardFlags |= ReplyForwardFlags.DropBody;
                    }
                    if (flag4 || flag)
                    {
                        replyForwardFlags |= ReplyForwardFlags.DropHeader;
                    }
                    StoreObjectId parentFolderId = Utilities.GetParentFolderId(item2, item);
                    item3 = ReplyForwardUtilities.CreateForwardItem(flag3 ? BodyFormat.TextHtml : bodyFormat, item, replyForwardFlags, userContext, parentFolderId);
                    if (flag)
                    {
                        item3.AttachmentCollection.RemoveAll();
                        using (ItemAttachment itemAttachment = item3.AttachmentCollection.AddExistingItem(item))
                        {
                            itemAttachment.Save();
                            goto IL_205;
                        }
                    }
                    if (Utilities.IsIrmRestrictedAndNotDecrypted(item))
                    {
                        ReplyForwardUtilities.SetAlternateIrmBody(item3, flag3 ? BodyFormat.TextHtml : bodyFormat, userContext, parentFolderId, decryptionStatus, ObjectClass.IsVoiceMessage(item.ClassName));
                        item3.AttachmentCollection.RemoveAll();
                    }
IL_205:
                    preFormActionResponse.Action = "Forward";
                    if (flag2)
                    {
                        preFormActionResponse.AddParameter("srcId", Utilities.GetItemIdQueryString(httpContext.Request));
                        if (Utilities.GetQueryStringParameter(httpContext.Request, "cb", false) == null && Utilities.IsWebBeaconsAllowed(item))
                        {
                            preFormActionResponse.AddParameter("cb", "1");
                        }
                    }
                    if (flag4)
                    {
                        item3.ClassName = "IPM.Note.Mobile.SMS";
                    }
                }
                item3.Save(SaveMode.ResolveConflicts);
                item3.Load();
                ReplyForwardUtilities.DeleteLevelOneAttachments(item3, userContext);
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type = item3.ClassName;
                preFormActionResponse.AddParameter("id", OwaStoreObjectId.CreateFromStoreObject(item3).ToBase64String());
                if (userContext.IsInOtherMailbox(item))
                {
                    preFormActionResponse.AddParameter("fOMF", "1");
                }
                if (flag)
                {
                    preFormActionResponse.AddParameter("fIrmAsAttach", "1");
                }
                result = preFormActionResponse;
            }
            finally
            {
                if (item != null)
                {
                    item.Dispose();
                    item = null;
                }
                if (item2 != null)
                {
                    item2.Dispose();
                    item2 = null;
                }
                if (item3 != null)
                {
                    item3.Dispose();
                    item3 = null;
                }
            }
            return(result);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ApplicationElementPropertyDescriptor"/> class.
 /// </summary>
 /// <param name="applications">The environments.</param>
 /// <param name="application">The environment.</param>
 public ApplicationElementPropertyDescriptor(ApplicationElementCollection applications, ApplicationElement application)
     : base(application.Name, null)
 {
     this.applications = applications;
     this.application  = application;
 }
Beispiel #25
0
        private void ValidateRoleHierarchy(ApplicationElement application, RoleElement role)
        {
            List<String> names = new List<String>();
              RoleElement current = role;

              while (true) {
            ValidateName(current.Name);
            if (names.Contains(current.Name))
              throw new ProviderException("Loop in role hierarchy");
            names.Add(current.Name);
            if (String.Empty == current.Inherits)
              return;
            if (current.Name == current.Inherits)
              throw new ProviderException("Loop in role hierarchy");
            current = application.Roles[current.Inherits];
            if (null == current)
              throw new ProviderException("Invalid name for role parent");
              }
        }
        private void ParseElementClass(string experience, ApplicationElement applicationElement)
        {
            ExTraceGlobals.FormsRegistryCallTracer.TraceDebug((long)this.GetHashCode(), "FormsRegistryParser.ParseElementClass");
            bool   flag      = false;
            string itemClass = string.Empty;

            if (this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[14]))
            {
                itemClass = this.reader.Value;
            }
            ulong num = 0UL;

            if (this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[18]))
            {
                num = this.ParseRequiredFeatures(this.reader.Value);
            }
            while (!flag && this.reader.Read())
            {
                XmlNodeType nodeType = this.reader.NodeType;
                if (nodeType != XmlNodeType.Element)
                {
                    if (nodeType == XmlNodeType.EndElement)
                    {
                        if (this.reader.Name == FormsRegistryParser.nameTableValues[12])
                        {
                            flag = true;
                        }
                    }
                }
                else
                {
                    if (this.reader.Name == FormsRegistryParser.nameTableValues[13])
                    {
                        string text              = string.Empty;
                        string action            = string.Empty;
                        string state             = string.Empty;
                        ulong  segmentationFlags = num;
                        if (this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[16]))
                        {
                            action = this.reader.Value;
                        }
                        if (this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[17]))
                        {
                            state = this.reader.Value;
                        }
                        if (this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[18]))
                        {
                            segmentationFlags = this.ParseRequiredFeatures(this.reader.Value);
                        }
                        if (!this.reader.MoveToAttribute(FormsRegistryParser.nameTableValues[15]))
                        {
                            this.ThrowExpectedAttributeException(FormsRegistryParser.NameTableValues.Form);
                        }
                        text = this.reader.Value;
                        FormKey formKey = new FormKey(experience, applicationElement, itemClass, action, state);
                        ExTraceGlobals.FormsRegistryDataTracer.TraceDebug <FormKey, string>((long)this.GetHashCode(), "Parsed Mapping - key = ({0}), form = {1}", formKey, text);
                        try
                        {
                            if (applicationElement == ApplicationElement.PreFormAction)
                            {
                                this.registry.AddPreForm(formKey, text, segmentationFlags);
                            }
                            else
                            {
                                this.registry.AddForm(formKey, text, segmentationFlags);
                            }
                            continue;
                        }
                        catch (OwaInvalidInputException ex)
                        {
                            OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_FormsRegistryParseError, ex.Message, new object[]
                            {
                                this.registryFile,
                                this.reader.LineNumber.ToString(CultureInfo.InvariantCulture),
                                this.reader.LinePosition.ToString(CultureInfo.InvariantCulture),
                                ex.Message
                            });
                            throw ex;
                        }
                    }
                    this.ThrowExpectedElementException(FormsRegistryParser.NameTableValues.Mapping);
                }
            }
        }
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            UserContext userContext = owaContext.UserContext;
            HttpRequest request     = owaContext.HttpContext.Request;

            string[] array = null;
            applicationElement = ApplicationElement.Item;
            type   = string.Empty;
            action = string.Empty;
            state  = string.Empty;
            if (!Utilities.IsPostRequest(request))
            {
                return(userContext.LastClientViewState.ToPreFormActionResponse());
            }
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
            string        formParameter = Utilities.GetFormParameter(request, "hidAB");
            int           num           = 0;
            StoreObjectId storeObjectId = null;
            string        changeKey     = null;

            string[] array2 = formParameter.Split(new char[]
            {
                ';'
            });
            if (array2 != null && array2.Length > 0)
            {
                if (string.CompareOrdinal(array2[0], "Ad") == 0)
                {
                    num = 1;
                }
                else
                {
                    if (string.CompareOrdinal(array2[0], "Con") != 0)
                    {
                        throw new OwaInvalidRequestException("Invalid search location for addressbook");
                    }
                    num = 2;
                }
            }
            string action2 = owaContext.FormsRegistryContext.Action;

            if (action2 == null)
            {
                throw new OwaInvalidRequestException("Action query string parameter is missing");
            }
            object obj = AddressBookPreFormAction.actionParser.Parse(action2);

            AddressBookPreFormAction.Action action3 = (AddressBookPreFormAction.Action)obj;
            string text = request.Form["chkRcpt"];

            if (!string.IsNullOrEmpty(text))
            {
                array = text.Split(new char[]
                {
                    ','
                });
            }
            AddressBook.Mode mode = AddressBookHelper.TryReadAddressBookMode(request, AddressBook.Mode.None);
            if (AddressBook.IsEditingMode(mode))
            {
                string formParameter2 = Utilities.GetFormParameter(request, "hidid", false);
                changeKey = Utilities.GetFormParameter(request, "hidchk", false);
                if (!string.IsNullOrEmpty(formParameter2))
                {
                    storeObjectId = Utilities.CreateStoreObjectId(userContext.MailboxSession, formParameter2);
                    if (storeObjectId == null)
                    {
                        throw new OwaInvalidRequestException("ItemId cannot be null");
                    }
                }
            }
            switch (action3)
            {
            case AddressBookPreFormAction.Action.Done:
                if (AddressBook.IsEditingMode(mode))
                {
                    using (Item item = AddressBookHelper.GetItem(userContext, mode, storeObjectId, changeKey))
                    {
                        if (array != null && array.Length > 0)
                        {
                            RecipientItemType type2          = RecipientItemType.To;
                            string            formParameter3 = Utilities.GetFormParameter(request, "hidrw");
                            if (!string.IsNullOrEmpty(formParameter3))
                            {
                                int num2;
                                if (!int.TryParse(formParameter3, out num2) || num2 < 1 || num2 > 3)
                                {
                                    type2 = RecipientItemType.To;
                                }
                                else
                                {
                                    type2 = (RecipientItemType)num2;
                                }
                            }
                            if (num == 1)
                            {
                                AddressBookHelper.AddRecipientsToDraft(array, item, type2, userContext);
                            }
                            else if (num == 2)
                            {
                                AddressBookHelper.AddContactsToDraft(item, type2, userContext, array);
                            }
                        }
                        preFormActionResponse = AddressBookHelper.RedirectToEdit(userContext, item, mode);
                        break;
                    }
                }
                throw new OwaInvalidRequestException("This action must be in editing mode");

            case AddressBookPreFormAction.Action.Mail:
                if (array != null && array.Length > 0)
                {
                    using (Item item2 = MessageItem.Create(userContext.MailboxSession, userContext.DraftsFolderId))
                    {
                        item2[ItemSchema.ConversationIndexTracking] = true;
                        if (num == 1)
                        {
                            AddressBookHelper.AddRecipientsToDraft(array, item2, RecipientItemType.To, userContext);
                        }
                        else if (num == 2)
                        {
                            AddressBookHelper.AddContactsToDraft(item2, RecipientItemType.To, userContext, array);
                        }
                        preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                        preFormActionResponse.Type   = "IPM.Note";
                        preFormActionResponse.Action = "Open";
                        preFormActionResponse.State  = "Draft";
                        preFormActionResponse.AddParameter("id", item2.Id.ObjectId.ToBase64String());
                        break;
                    }
                }
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type   = "IPM.Note";
                preFormActionResponse.Action = "New";
                break;

            case AddressBookPreFormAction.Action.MeetingRequest:
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type = "IPM.Appointment";
                if (array != null && array.Length > 0)
                {
                    using (CalendarItemBase calendarItemBase = EditCalendarItemHelper.CreateDraft(userContext, userContext.CalendarFolderId))
                    {
                        calendarItemBase.IsMeeting = true;
                        if (num == 1)
                        {
                            AddressBookHelper.AddRecipientsToDraft(array, calendarItemBase, RecipientItemType.To, userContext);
                        }
                        else if (num == 2)
                        {
                            AddressBookHelper.AddContactsToDraft(calendarItemBase, RecipientItemType.To, userContext, array);
                        }
                        preFormActionResponse.Action = "Open";
                        EditCalendarItemHelper.CreateUserContextData(userContext, calendarItemBase);
                        break;
                    }
                }
                preFormActionResponse.AddParameter("mr", "1");
                preFormActionResponse.Action = "New";
                break;

            case AddressBookPreFormAction.Action.Close:
                if (AddressBook.IsEditingMode(mode))
                {
                    using (Item item3 = AddressBookHelper.GetItem(userContext, mode, storeObjectId, changeKey))
                    {
                        preFormActionResponse = AddressBookHelper.RedirectToEdit(userContext, item3, mode);
                        break;
                    }
                }
                throw new OwaInvalidRequestException("This action must be in editing mode");

            case AddressBookPreFormAction.Action.AddToContacts:
            {
                string type3 = "IPM.Contact";
                string text2 = null;
                if (array == null || array.Length != 1)
                {
                    throw new OwaInvalidRequestException("User must select some recipient to add and can only add one recipient to contacts at one time");
                }
                ADObjectId adobjectId = DirectoryAssistance.ParseADObjectId(array[0]);
                if (adobjectId == null)
                {
                    throw new OwaADObjectNotFoundException();
                }
                IRecipientSession recipientSession = Utilities.CreateADRecipientSession(Culture.GetUserCulture().LCID, true, ConsistencyMode.FullyConsistent, true, userContext);
                ADRecipient       adrecipient      = recipientSession.Read(adobjectId);
                if (adrecipient == null)
                {
                    throw new OwaADObjectNotFoundException();
                }
                using (ContactBase contactBase = ContactUtilities.AddADRecipientToContacts(userContext, adrecipient))
                {
                    if (contactBase != null)
                    {
                        contactBase.Load();
                        text2 = contactBase.Id.ObjectId.ToBase64String();
                        type3 = contactBase.ClassName;
                    }
                }
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type = type3;
                if (text2 != null)
                {
                    preFormActionResponse.Action = "Open";
                    preFormActionResponse.State  = "Draft";
                    preFormActionResponse.AddParameter("id", text2);
                }
                else
                {
                    preFormActionResponse.Action = "New";
                }
                break;
            }

            default:
                throw new OwaInvalidRequestException("Invalid request for addressbook preformaction");
            }
            return(preFormActionResponse);
        }
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            applicationElement = ApplicationElement.NotSet;
            type   = string.Empty;
            state  = string.Empty;
            action = string.Empty;
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();

            preFormActionResponse.Type = owaContext.FormsRegistryContext.Type;
            preFormActionResponse.ApplicationElement = ApplicationElement.Item;
            bool flag  = false;
            bool flag2 = false;
            CalendarItemBaseData calendarItemBaseData = EditCalendarItemHelper.GetUserContextData(owaContext.UserContext);
            StoreObjectId        storeObjectId        = QueryStringUtilities.CreateItemStoreObjectId(owaContext.UserContext.MailboxSession, owaContext.HttpContext.Request, false);

            if (calendarItemBaseData != null && calendarItemBaseData.Id != null && storeObjectId != null && !calendarItemBaseData.Id.Equals(storeObjectId))
            {
                EditCalendarItemHelper.ClearUserContextData(owaContext.UserContext);
                calendarItemBaseData = null;
            }
            if (calendarItemBaseData != null)
            {
                flag  = calendarItemBaseData.IsOrganizer;
                flag2 = calendarItemBaseData.IsMeeting;
            }
            else
            {
                if (storeObjectId == null)
                {
                    throw new OwaLostContextException("Lost changes since last save.");
                }
                CalendarItemBase calendarItemBase2;
                CalendarItemBase calendarItemBase = calendarItemBase2 = CalendarItemBase.Bind(owaContext.UserContext.MailboxSession, storeObjectId);
                try
                {
                    flag  = calendarItemBase.IsOrganizer();
                    flag2 = calendarItemBase.IsMeeting;
                }
                finally
                {
                    if (calendarItemBase2 != null)
                    {
                        ((IDisposable)calendarItemBase2).Dispose();
                    }
                }
            }
            if (flag2 && !flag)
            {
                preFormActionResponse.Action = "Read";
            }
            else
            {
                preFormActionResponse.Action = "Open";
            }
            string text = "ae,a,t,s";

            for (int i = 0; i < owaContext.HttpContext.Request.QueryString.Count; i++)
            {
                string text2 = owaContext.HttpContext.Request.QueryString.Keys[i];
                if (text.IndexOf(text2, StringComparison.Ordinal) == -1)
                {
                    preFormActionResponse.AddParameter(text2, owaContext.HttpContext.Request.QueryString[text2]);
                }
            }
            return(preFormActionResponse);
        }
Beispiel #29
0
        // Token: 0x06000127 RID: 295 RVA: 0x00009A0C File Offset: 0x00007C0C
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            UserContext userContext = owaContext.UserContext;
            HttpRequest request     = owaContext.HttpContext.Request;

            string[] array = null;
            applicationElement = ApplicationElement.NotSet;
            type   = string.Empty;
            action = string.Empty;
            state  = string.Empty;
            if (!Utilities.IsPostRequest(request))
            {
                return(userContext.LastClientViewState.ToPreFormActionResponse());
            }
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();
            string queryStringParameter = Utilities.GetQueryStringParameter(request, "a", true);
            object obj = ContactViewPreFormAction.actionParser.Parse(queryStringParameter);

            ContactViewPreFormAction.Action action2 = (ContactViewPreFormAction.Action)obj;
            string text = request.Form["chkRcpt"];

            if (!string.IsNullOrEmpty(text))
            {
                array = text.Split(new char[]
                {
                    ','
                });
            }
            switch (action2)
            {
            case ContactViewPreFormAction.Action.Mail:
                if (array != null && array.Length > 0)
                {
                    using (MessageItem messageItem = MessageItem.Create(userContext.MailboxSession, userContext.DraftsFolderId))
                    {
                        messageItem[ItemSchema.ConversationIndexTracking] = true;
                        AddressBookHelper.AddContactsToDraft(messageItem, RecipientItemType.To, userContext, array);
                        preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                        preFormActionResponse.Type   = "IPM.Note";
                        preFormActionResponse.Action = "Open";
                        preFormActionResponse.State  = "Draft";
                        preFormActionResponse.AddParameter("id", messageItem.Id.ObjectId.ToBase64String());
                        break;
                    }
                }
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type   = "IPM.Note";
                preFormActionResponse.Action = "New";
                break;

            case ContactViewPreFormAction.Action.MeetingRequest:
                preFormActionResponse.ApplicationElement = ApplicationElement.Item;
                preFormActionResponse.Type = "IPM.Appointment";
                if (array != null && array.Length > 0)
                {
                    using (CalendarItemBase calendarItemBase = EditCalendarItemHelper.CreateDraft(userContext, userContext.CalendarFolderId))
                    {
                        calendarItemBase.IsMeeting = true;
                        AddressBookHelper.AddContactsToDraft(calendarItemBase, RecipientItemType.To, userContext, array);
                        preFormActionResponse.Action = "Open";
                        EditCalendarItemHelper.CreateUserContextData(userContext, calendarItemBase);
                        break;
                    }
                }
                preFormActionResponse.AddParameter("mr", "1");
                preFormActionResponse.Action = "New";
                break;

            default:
                throw new OwaInvalidRequestException("Invalid request for addressbook preformaction");
            }
            return(preFormActionResponse);
        }
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            applicationElement = ApplicationElement.NotSet;
            type   = string.Empty;
            state  = string.Empty;
            action = string.Empty;
            HttpContext httpContext = owaContext.HttpContext;
            UserContext userContext = owaContext.UserContext;
            HttpRequest request     = httpContext.Request;

            if (!Utilities.IsPostRequest(request) && owaContext.FormsRegistryContext.Action != "Prev" && owaContext.FormsRegistryContext.Action != "Next")
            {
                return(userContext.LastClientViewState.ToPreFormActionResponse());
            }
            string storeObjectId;
            string storeObjectId2;

            if (Utilities.IsPostRequest(request))
            {
                storeObjectId  = Utilities.GetFormParameter(request, "hidfldid", true);
                storeObjectId2 = Utilities.GetFormParameter(request, "hidid", true);
            }
            else
            {
                storeObjectId  = Utilities.GetQueryStringParameter(request, "fId", true);
                storeObjectId2 = Utilities.GetQueryStringParameter(request, "id", true);
            }
            StoreObjectId folderId       = Utilities.CreateStoreObjectId(userContext.MailboxSession, storeObjectId);
            StoreObjectId storeObjectId3 = Utilities.CreateStoreObjectId(userContext.MailboxSession, storeObjectId2);

            ItemOperations.Result result = null;
            string action2;

            if ((action2 = owaContext.FormsRegistryContext.Action) != null)
            {
                if (!(action2 == "Prev"))
                {
                    if (!(action2 == "Next"))
                    {
                        if (!(action2 == "Del"))
                        {
                            if (!(action2 == "Junk"))
                            {
                                if (!(action2 == "NotJunk"))
                                {
                                    goto IL_1FA;
                                }
                                if (!userContext.IsJunkEmailEnabled)
                                {
                                    throw new OwaInvalidRequestException(LocalizedStrings.GetNonEncoded(552277155));
                                }
                                owaContext[OwaContextProperty.InfobarMessage] = JunkEmailHelper.MarkAsNotJunk(userContext, new StoreObjectId[]
                                {
                                    storeObjectId3
                                });
                                userContext.ForceNewSearch = true;
                            }
                            else
                            {
                                if (!userContext.IsJunkEmailEnabled)
                                {
                                    throw new OwaInvalidRequestException(LocalizedStrings.GetNonEncoded(552277155));
                                }
                                owaContext[OwaContextProperty.InfobarMessage] = JunkEmailHelper.MarkAsJunk(userContext, new StoreObjectId[]
                                {
                                    storeObjectId3
                                });
                                userContext.ForceNewSearch = true;
                            }
                        }
                        else
                        {
                            result = ItemOperations.DeleteItem(userContext, storeObjectId3, folderId);
                            userContext.ForceNewSearch = true;
                        }
                    }
                    else
                    {
                        result = ItemOperations.GetNextViewItem(userContext, ItemOperations.Action.Next, storeObjectId3, folderId);
                    }
                }
                else
                {
                    result = ItemOperations.GetNextViewItem(userContext, ItemOperations.Action.Prev, storeObjectId3, folderId);
                }
                return(ItemOperations.GetPreFormActionResponse(userContext, result));
            }
IL_1FA:
            throw new OwaInvalidRequestException("Unknown command");
        }
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext", "owaContext is null.");
            }
            if (owaContext.HttpContext == null)
            {
                throw new ArgumentNullException("owaContext", "owaContext.HttpContext is null.");
            }
            applicationElement = ApplicationElement.NotSet;
            type   = null;
            state  = null;
            action = null;
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();

            preFormActionResponse.ApplicationElement = ApplicationElement.Item;
            preFormActionResponse.Type   = "IPM.Appointment";
            preFormActionResponse.Action = string.Empty;
            preFormActionResponse.State  = string.Empty;
            this.request     = owaContext.HttpContext.Request;
            this.userContext = owaContext.UserContext;
            InfobarMessage infobarMessage = null;
            StoreObjectId  storeObjectId  = null;
            string         changeKey      = null;
            string         action2        = owaContext.FormsRegistryContext.Action;
            string         text;

            if (string.Equals(action2, "New", StringComparison.Ordinal))
            {
                text = "new";
            }
            else
            {
                if (!Utilities.IsPostRequest(this.request))
                {
                    return(this.userContext.LastClientViewState.ToPreFormActionResponse());
                }
                text = Utilities.GetFormParameter(this.request, "hidcmdpst");
                string formParameter = Utilities.GetFormParameter(this.request, "hidid", false);
                changeKey = Utilities.GetFormParameter(this.request, "hidchk", false);
                if (!string.IsNullOrEmpty(formParameter))
                {
                    storeObjectId = Utilities.CreateStoreObjectId(this.userContext.MailboxSession, formParameter);
                }
            }
            StoreObjectId calendarFolderId = EditCalendarItemHelper.GetCalendarFolderId(this.request, this.userContext);
            bool          syncCalendarItem = true;

            if (text.Equals("attch", StringComparison.Ordinal))
            {
                syncCalendarItem = false;
            }
            bool flag = true;

            try
            {
                EditCalendarItemHelper.CalendarItemUpdateFlags storeUpdateFlags = EditCalendarItemHelper.CalendarItemUpdateFlags.None;
                if (!text.Equals("cls", StringComparison.Ordinal))
                {
                    storeUpdateFlags = EditCalendarItemHelper.GetCalendarItem(this.userContext, storeObjectId, calendarFolderId, changeKey, syncCalendarItem, out this.calendarItemBase);
                }
                switch (this.DoAction(text, storeUpdateFlags, ref preFormActionResponse, out infobarMessage))
                {
                case EditCalendarItemPreFormAction.RedirectTo.None:
                    throw new OwaInvalidRequestException("Unhandled redirection.");

                case EditCalendarItemPreFormAction.RedirectTo.AddressBook:
                    preFormActionResponse = EditMessageHelper.RedirectToPeoplePicker(owaContext, this.calendarItemBase, AddressBook.Mode.EditCalendar);
                    EditCalendarItemHelper.CreateUserContextData(this.userContext, this.calendarItemBase);
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.ADPage:
                    preFormActionResponse = EditMessageHelper.RedirectToRecipient(owaContext, this.calendarItemBase, AddressBook.Mode.EditCalendar);
                    EditCalendarItemHelper.CreateUserContextData(this.userContext, this.calendarItemBase);
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.AttachmentManager:
                    if (this.calendarItemBase.Id == null)
                    {
                        CalendarUtilities.SaveCalendarItem(this.calendarItemBase, this.userContext, out infobarMessage);
                    }
                    using (CalendarItemBase calendarItemBase = EditCalendarItemHelper.CreateDraft(this.userContext, null))
                    {
                        CalendarItemBaseData userContextData = EditCalendarItemHelper.GetUserContextData(this.userContext);
                        userContextData.CopyTo(calendarItemBase);
                        string text2;
                        EditCalendarItemHelper.UpdateCalendarItemValues(calendarItemBase, this.userContext, this.request, out text2);
                        EditCalendarItemHelper.CreateUserContextData(this.userContext, calendarItemBase);
                        if (this.calendarItemBase.Id != null)
                        {
                            CalendarItemBaseData userContextData2 = EditCalendarItemHelper.GetUserContextData(this.userContext);
                            userContextData2.Id        = this.calendarItemBase.Id.ObjectId;
                            userContextData2.ChangeKey = this.calendarItemBase.Id.ChangeKeyAsBase64String();
                        }
                    }
                    if (infobarMessage == null)
                    {
                        this.RedirectToAttachmentManager(owaContext, preFormActionResponse);
                    }
                    else
                    {
                        owaContext.PreFormActionData = this.calendarItemBase;
                        flag = false;
                        this.RedirectToEdit(owaContext, infobarMessage, preFormActionResponse);
                    }
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.CalendarDailyView:
                    EditCalendarItemHelper.ClearUserContextData(this.userContext);
                    preFormActionResponse = this.userContext.LastClientViewState.ToPreFormActionResponse();
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.EditCalendarItem:
                    EditCalendarItemHelper.CreateUserContextData(this.userContext, this.calendarItemBase);
                    owaContext.PreFormActionData = this.calendarItemBase;
                    flag = false;
                    this.RedirectToEdit(owaContext, infobarMessage, preFormActionResponse);
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.EditRecurrence:
                    EditCalendarItemHelper.CreateUserContextData(this.userContext, this.calendarItemBase);
                    owaContext.PreFormActionData = CalendarItemBaseData.Create(this.calendarItemBase);
                    preFormActionResponse.Action = "EditRecurrence";
                    if (this.calendarItemBase.IsDirty)
                    {
                        preFormActionResponse.AddParameter("cd", "1");
                    }
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.SchedulingTab:
                    EditCalendarItemHelper.CreateUserContextData(this.userContext, this.calendarItemBase);
                    owaContext.PreFormActionData = this.calendarItemBase;
                    this.RedirectToSchedulingTab(owaContext, infobarMessage, preFormActionResponse);
                    flag = false;
                    break;

                default:
                    throw new OwaInvalidRequestException("Unhandled redirection enum value in EditCalendarItemPreFormAction.");
                }
            }
            catch
            {
                flag = true;
                EditCalendarItemHelper.ClearUserContextData(this.userContext);
                throw;
            }
            finally
            {
                if (flag && this.calendarItemBase != null)
                {
                    this.calendarItemBase.Dispose();
                    this.calendarItemBase = null;
                }
            }
            return(preFormActionResponse);
        }