Exemple #1
0
 protected override void ExecuteApplicationSpecificStart()
 {
     ExWatson.Register("E12IIS");
     OwaEventRegistry.RegisterHandler(typeof(ProxyEventHandler));
     CalendarViewEventHandler.Register();
     DatePickerEventHandler.Register();
     PrintCalendarEventHandler.Register();
 }
        // Token: 0x06000EC7 RID: 3783 RVA: 0x0005E028 File Offset: 0x0005C228
        private void ParseAndAddStruct(ArrayList itemArray)
        {
            OwaEventStructAttribute owaEventStructAttribute = OwaEventRegistry.FindStructInfo(this.reader.Name);

            if (owaEventStructAttribute != null)
            {
                bool   isEmptyElement = this.reader.IsEmptyElement;
                object value          = this.ParseStruct(owaEventStructAttribute);
                if (itemArray != null)
                {
                    base.AddStructToArray(this.paramInfo, itemArray, value);
                }
                else
                {
                    base.AddStructParameter(this.paramInfo, value);
                }
                if (!isEmptyElement)
                {
                    if (!this.reader.Read())
                    {
                        this.ThrowParserException("Unexpected end of request");
                    }
                    else if (this.reader.NodeType != XmlNodeType.EndElement || !string.Equals(owaEventStructAttribute.Name, this.reader.Name, StringComparison.Ordinal))
                    {
                        this.ThrowParserException("Expected end of struct");
                    }
                }
                if (!this.reader.Read())
                {
                    this.ThrowParserException("Unexpected end of request");
                    return;
                }
                if (itemArray != null)
                {
                    if (this.reader.NodeType != XmlNodeType.EndElement || !string.Equals(this.reader.Name, "item", StringComparison.OrdinalIgnoreCase))
                    {
                        this.ThrowParserException("Expected end of item");
                        return;
                    }
                }
                else if (this.reader.NodeType != XmlNodeType.EndElement || !string.Equals(this.reader.Name, this.paramInfo.Name, StringComparison.Ordinal))
                {
                    this.ThrowParserException("Expected end of param");
                    return;
                }
            }
            else
            {
                this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Type '{0}' is unknown", new object[]
                {
                    this.reader.Name
                }));
            }
        }
 public static void Register()
 {
     OwaEventRegistry.RegisterHandler(typeof(WebReadyFileEventHandler));
 }
        public IHttpHandler GetHandler(HttpContext httpContext, string requestType, string url, string pathTranslated)
        {
            ExTraceGlobals.OehCallTracer.TraceDebug(0L, "OwaEventHandlerFactory.GetHandler");
            string          queryStringParameter  = Utilities.GetQueryStringParameter(httpContext.Request, "ns");
            string          queryStringParameter2 = Utilities.GetQueryStringParameter(httpContext.Request, "ev");
            ISessionContext sessionContext        = OwaContext.Get(httpContext).SessionContext;

            ExTraceGlobals.OehDataTracer.TraceDebug <string, string>(0L, "Request namespace: '{0}', event: '{1}'", queryStringParameter, queryStringParameter2);
            OwaEventNamespaceAttribute owaEventNamespaceAttribute = OwaEventRegistry.FindNamespaceInfo(queryStringParameter);

            if (owaEventNamespaceAttribute == null)
            {
                throw new OwaInvalidRequestException(string.Format(CultureInfo.InvariantCulture, "Namespace '{0}' doesn't exist", new object[]
                {
                    queryStringParameter
                }), null, this);
            }
            if (sessionContext != null && !sessionContext.IsProxy && !sessionContext.AreFeaturesEnabled(owaEventNamespaceAttribute.SegmentationFlags))
            {
                Utilities.EndResponse(httpContext, HttpStatusCode.Forbidden);
                return(null);
            }
            OwaEventAttribute owaEventAttribute = owaEventNamespaceAttribute.FindEventInfo(queryStringParameter2);

            if (owaEventAttribute == null)
            {
                throw new OwaInvalidRequestException(string.Format(CultureInfo.InvariantCulture, "Event '{0}' doesn't exist", new object[]
                {
                    queryStringParameter2
                }), null, this);
            }
            if (Globals.OwaVDirType == OWAVDirType.Calendar && !owaEventAttribute.AllowAnonymousAccess)
            {
                Utilities.EndResponse(httpContext, HttpStatusCode.BadRequest);
                return(null);
            }
            if (sessionContext != null && !sessionContext.IsProxy && !sessionContext.AreFeaturesEnabled(owaEventAttribute.SegmentationFlags))
            {
                Utilities.EndResponse(httpContext, HttpStatusCode.Forbidden);
                return(null);
            }
            OwaEventVerb owaEventVerb = OwaEventVerbAttribute.Parse(httpContext.Request.HttpMethod);

            ExTraceGlobals.OehDataTracer.TraceDebug <string>(0L, "Request verb: {0}", httpContext.Request.HttpMethod);
            if ((owaEventAttribute.AllowedVerbs & owaEventVerb) == OwaEventVerb.Unsupported)
            {
                ExTraceGlobals.OehTracer.TraceDebug <OwaEventVerb, OwaEventVerb>(0L, "Verb is not allowed, returning 405. Actual verb: {0}. Allowed: {1}.", owaEventVerb, owaEventAttribute.AllowedVerbs);
                Utilities.EndResponse(httpContext, HttpStatusCode.MethodNotAllowed);
                return(null);
            }
            OwaEventHandlerBase owaEventHandlerBase = (OwaEventHandlerBase)Activator.CreateInstance(owaEventNamespaceAttribute.HandlerType);

            owaEventHandlerBase.EventInfo  = owaEventAttribute;
            owaEventHandlerBase.OwaContext = OwaContext.Current;
            owaEventHandlerBase.Verb       = owaEventVerb;
            if (Globals.CollectPerRequestPerformanceStats)
            {
                OwaContext.Current.OwaPerformanceData.SetOehRequestType(owaEventNamespaceAttribute.HandlerType.Name, owaEventAttribute.IsAsync ? owaEventAttribute.BeginMethodInfo.Name : owaEventAttribute.MethodInfo.Name);
            }
            if (owaEventAttribute.IsAsync)
            {
                OwaContext.Current.TryReleaseBudgetAndStopTiming();
                ExTraceGlobals.OehTracer.TraceDebug(0L, "Created async HTTP handler to server OEH request");
                OwaContext.Current.IsAsyncRequest = true;
                return(new OwaEventAsyncHttpHandler(owaEventHandlerBase));
            }
            ExTraceGlobals.OehTracer.TraceDebug(0L, "Created sync HTTP handler to serve OEH request");
            return(new OwaEventHttpHandler(owaEventHandlerBase));
        }
Exemple #5
0
 protected object ConvertToStrongType(Type paramType, string value)
 {
     if (string.IsNullOrEmpty(value))
     {
         this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Failed to parse type. Type = {0}, Value = {1}", new object[]
         {
             paramType,
             value
         }));
     }
     try
     {
         if (paramType.IsEnum)
         {
             OwaEventEnumAttribute owaEventEnumAttribute = OwaEventRegistry.FindEnumInfo(paramType);
             int    intValue = int.Parse(value, CultureInfo.InvariantCulture);
             object obj      = owaEventEnumAttribute.FindValueInfo(intValue);
             if (obj == null)
             {
                 this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Failed to parse enum type. Type = {0}, Value = {1}", new object[]
                 {
                     paramType,
                     value
                 }));
             }
             return(obj);
         }
         if (paramType == typeof(int))
         {
             return(int.Parse(value, CultureInfo.InvariantCulture));
         }
         if (paramType == typeof(double))
         {
             return(double.Parse(value, CultureInfo.InvariantCulture));
         }
         if (paramType == typeof(ExDateTime))
         {
             return(DateTimeUtilities.ParseIsoDate(value, this.EventHandler.OwaContext.SessionContext.TimeZone));
         }
         if (paramType == typeof(bool))
         {
             if (string.Equals(value, "0", StringComparison.Ordinal))
             {
                 return(false);
             }
             if (string.Equals(value, "1", StringComparison.Ordinal))
             {
                 return(true);
             }
             this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Failed to parse type. Type = {0}, Value = {1}", new object[]
             {
                 paramType,
                 value
             }));
         }
         else
         {
             if (paramType == typeof(StoreObjectId))
             {
                 UserContext userContext = this.EventHandler.OwaContext.UserContext;
                 return(Utilities.CreateStoreObjectId(userContext.MailboxSession, value));
             }
             if (paramType == typeof(ADObjectId))
             {
                 ADObjectId adobjectId = DirectoryAssistance.ParseADObjectId(value);
                 if (adobjectId == null)
                 {
                     this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Failed to parse type. Type = {0}, Value = {1}", new object[]
                     {
                         paramType,
                         value
                     }));
                 }
                 return(adobjectId);
             }
             if (paramType == typeof(DocumentLibraryObjectId))
             {
                 UserContext userContext2 = this.EventHandler.OwaContext.UserContext;
                 Uri         uri;
                 if (null == (uri = Utilities.TryParseUri(value)))
                 {
                     return(null);
                 }
                 ClassifyResult[]   array = null;
                 OwaWindowsIdentity owaWindowsIdentity = userContext2.LogonIdentity as OwaWindowsIdentity;
                 if (owaWindowsIdentity != null && owaWindowsIdentity.WindowsPrincipal != null)
                 {
                     array = LinkClassifier.ClassifyLinks(owaWindowsIdentity.WindowsPrincipal, new Uri[]
                     {
                         uri
                     });
                 }
                 if (array == null || array.Length == 0)
                 {
                     return(null);
                 }
                 return(array[0].ObjectId);
             }
             else if (paramType == typeof(OwaStoreObjectId))
             {
                 UserContext userContext3 = this.EventHandler.OwaContext.UserContext;
                 if (OwaStoreObjectId.IsDummyArchiveFolder(value))
                 {
                     return(userContext3.GetArchiveRootFolderId());
                 }
                 return(OwaStoreObjectId.CreateFromString(value));
             }
             else
             {
                 this.ThrowParserException("Internal error: unknown type");
             }
         }
     }
     catch (FormatException)
     {
         this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Failed to parse type. Type = {0}, Value = {1}", new object[]
         {
             paramType,
             value
         }));
     }
     catch (OwaParsingErrorException)
     {
         this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Failed to parse type. Type = {0}, Value = {1}", new object[]
         {
             paramType,
             value
         }));
     }
     catch (OverflowException)
     {
         this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Type overflow. Type = {0}, Value = {1}", new object[]
         {
             paramType,
             value
         }));
     }
     return(null);
 }
Exemple #6
0
 protected override void ExecuteApplicationSpecificStart()
 {
     ExWatson.Register("E12IIS");
     StoreSession.UseRPCContextPool = true;
     UMClientCommonBase.InitializePerformanceCounters(false);
     OwaEventRegistry.RegisterEnum(typeof(Importance));
     OwaEventRegistry.RegisterEnum(typeof(Sensitivity));
     OwaEventRegistry.RegisterEnum(typeof(AddressOrigin));
     OwaEventRegistry.RegisterEnum(typeof(FlagAction));
     OwaEventRegistry.RegisterEnum(typeof(TaskStatus));
     OwaEventRegistry.RegisterEnum(typeof(BusyType));
     OwaEventRegistry.RegisterEnum(typeof(ResponseType));
     OwaEventRegistry.RegisterEnum(typeof(StoreObjectType));
     OwaEventRegistry.RegisterEnum(typeof(EmailAddressIndex));
     OwaEventRegistry.RegisterEnum(typeof(NavigationNodeGroupSection));
     OwaEventRegistry.RegisterEnum(typeof(InstantMessagingTypeOptions));
     OwaEventRegistry.RegisterEnum(typeof(NavigationModule));
     OwaEventRegistry.RegisterEnum(typeof(DefaultFolderType));
     OwaEventRegistry.RegisterEnum(typeof(RecipientBlockType));
     OwaEventRegistry.RegisterEnum(typeof(RecipientJunkEmailContextMenuType));
     OwaEventRegistry.RegisterEnum(typeof(SharingLevel));
     OwaEventRegistry.RegisterEnum(typeof(DenyResponseType));
     OwaEventRegistry.RegisterEnum(typeof(AddressBookItemEventHandler.ItemTypeToPeople));
     OwaEventRegistry.RegisterStruct(typeof(RecipientInfo));
     OwaEventRegistry.RegisterStruct(typeof(DeleteItemInfo));
     OwaEventRegistry.RegisterStruct(typeof(ReminderInfo));
     OwaEventRegistry.RegisterHandler(typeof(ProxyEventHandler));
     OwaEventRegistry.RegisterHandler(typeof(PendingRequestEventHandler));
     OwaEventRegistry.RegisterHandler(typeof(ProxyToEwsEventHandler));
     NotificationEventHandler.Register();
     ClientCacheEventHandler.Register();
     DocumentLibraryEventHandler.Register();
     DocumentEventHandler.Register();
     DatePickerEventHandler.Register();
     ReadADOrgPersonEventHandler.Register();
     ListViewEventHandler.Register();
     TreeEventHandler.Register();
     NavigationEventHandler.Register();
     RecipientWellEventHandler.Register();
     AttachmentEventHandler.Register();
     ReadMessageEventHandler.Register();
     ReadConversationEventHandler.Register();
     ReadVoiceMessageEventHandler.Register();
     OptionsEventHandler.Register();
     AddressBookItemEventHandler.Register();
     OwaEventRegistry.RegisterHandler(typeof(EditMessageEventHandler));
     OwaEventRegistry.RegisterHandler(typeof(EditSmsEventHandler));
     EditCalendarItemEventHandler.Register();
     CalendarViewEventHandler.Register();
     OwaEventRegistry.RegisterHandler(typeof(EditMeetingInviteEventHandler));
     OwaEventRegistry.RegisterHandler(typeof(EditMeetingResponseEventHandler));
     OwaEventRegistry.RegisterHandler(typeof(ErrorEventHandler));
     OwaEventRegistry.RegisterHandler(typeof(FlagEventHandler));
     OwaEventRegistry.RegisterHandler(typeof(CategoryEventHandler));
     OwaEventRegistry.RegisterHandler(typeof(InstantMessageEventHandler));
     OwaEventRegistry.RegisterHandler(typeof(MonitoringEventHandler));
     OwaEventRegistry.RegisterHandler(typeof(MailTipsEventHandler));
     RemindersEventHandler.Register();
     EditContactItemEventHandler.Register();
     EditDistributionListEventHandler.Register();
     JunkEmailEventHandler.Register();
     EditTaskEventHandler.Register();
     ComplianceEventHandler.Register();
     WebReadyFileEventHandler.Register();
     EditPostEventHandler.Register();
     ReadPostEventHandler.Register();
     SMimeEventHandler.Register();
     NavigationNodeEventHandler.Register();
     MessageVirtualListViewEventHandler2.Register();
     TaskVirtualListViewEventHandler.Register();
     PersonalAutoAttendantOptionsEventHandler.Register();
     EditPAAEventHandler.Register();
     PerformanceConsoleEventHandler.Register();
     DirectoryVirtualListViewEventHandler.Register();
     ContactVirtualListViewEventHandler.Register();
     DumpsterVirtualListViewEventHandler.Register();
     SharingMessageEventHandler.Register();
     DeletePolicyEventHandler.Register();
     MovePolicyEventHandler.Register();
     PrintCalendarEventHandler.Register();
     MessageAnnotationEventHandler.Register();
 }
Exemple #7
0
        public static void RegisterStruct(Type structType)
        {
            ExTraceGlobals.OehCallTracer.TraceDebug(0L, "OwaEventRegistry.RegisterStruct");
            if (structType == null)
            {
                throw new ArgumentNullException("structType");
            }
            object[] customAttributes = structType.GetCustomAttributes(typeof(OwaEventStructAttribute), false);
            if (customAttributes == null || customAttributes.Length == 0)
            {
                throw new OwaNotSupportedException("Struct type is missing the OwaEventStructAttribute attribute");
            }
            OwaEventStructAttribute owaEventStructAttribute = (OwaEventStructAttribute)customAttributes[0];

            owaEventStructAttribute.StructType = structType;
            ExTraceGlobals.OehDataTracer.TraceDebug <Type>(0L, "Struct type: '{0}'", structType);
            Type type = null;

            customAttributes = structType.GetCustomAttributes(typeof(OwaEventObjectIdAttribute), false);
            if (customAttributes != null && customAttributes.Length > 0)
            {
                type = ((OwaEventObjectIdAttribute)customAttributes[0]).ObjectIdType;
            }
            FieldInfo[] fields = structType.GetFields(BindingFlags.Instance | BindingFlags.Public);
            int         num    = 0;
            uint        num2   = 0U;

            foreach (FieldInfo fieldInfo in fields)
            {
                customAttributes = fieldInfo.GetCustomAttributes(typeof(OwaEventFieldAttribute), false);
                if (customAttributes != null && customAttributes.Length > 0)
                {
                    OwaEventFieldAttribute owaEventFieldAttribute = (OwaEventFieldAttribute)customAttributes[0];
                    owaEventFieldAttribute.FieldInfo = fieldInfo;
                    owaEventFieldAttribute.FieldType = fieldInfo.FieldType;
                    if (type != null && owaEventFieldAttribute.FieldType == typeof(ObjectId))
                    {
                        owaEventFieldAttribute.FieldType = type;
                    }
                    if (!OwaEventRegistry.IsAllowedFieldType(owaEventFieldAttribute.FieldType))
                    {
                        throw new OwaNotSupportedException("Field type is not supported.");
                    }
                    owaEventFieldAttribute.FieldMask       = 1U << num;
                    owaEventStructAttribute.AllFieldsMask |= owaEventFieldAttribute.FieldMask;
                    if (!owaEventFieldAttribute.IsOptional)
                    {
                        num2 |= owaEventFieldAttribute.FieldMask;
                    }
                    else if (fieldInfo.FieldType == typeof(ExDateTime))
                    {
                        owaEventFieldAttribute.DefaultValue = ExDateTime.MinValue;
                    }
                    if (num >= 32)
                    {
                        throw new OwaNotSupportedException("Struct declares more fields than allowed");
                    }
                    owaEventStructAttribute.AddFieldInfo(owaEventFieldAttribute, num);
                    num++;
                    ExTraceGlobals.OehDataTracer.TraceDebug <string, Type>(0L, "Struct field found, name: '{0}', type: '{1}'", owaEventStructAttribute.Name, owaEventFieldAttribute.FieldType);
                }
            }
            if (num == 0)
            {
                throw new OwaNotSupportedException("Struct must have at least one field");
            }
            owaEventStructAttribute.FieldCount   = num;
            owaEventStructAttribute.RequiredMask = num2;
            OwaEventRegistry.structTable.Add(owaEventStructAttribute.Name, owaEventStructAttribute);
            OwaEventRegistry.structTypeTable.Add(owaEventStructAttribute.StructType, owaEventStructAttribute);
        }
Exemple #8
0
        public static void RegisterHandler(Type handlerType)
        {
            ExTraceGlobals.OehCallTracer.TraceDebug(0L, "OwaEventRegistry.RegisterHandler");
            if (handlerType == null)
            {
                throw new ArgumentNullException("handlerType");
            }
            object[] customAttributes = handlerType.GetCustomAttributes(typeof(OwaEventNamespaceAttribute), false);
            if (customAttributes == null || customAttributes.Length == 0)
            {
                throw new OwaNotSupportedException("Internal error: Handler is missing OwaEventNamespaceAttribute attribute");
            }
            OwaEventNamespaceAttribute owaEventNamespaceAttribute = (OwaEventNamespaceAttribute)customAttributes[0];

            owaEventNamespaceAttribute.HandlerType = handlerType;
            customAttributes = handlerType.GetCustomAttributes(typeof(OwaEventSegmentationAttribute), false);
            if (customAttributes != null && customAttributes.Length > 0)
            {
                OwaEventSegmentationAttribute owaEventSegmentationAttribute = (OwaEventSegmentationAttribute)customAttributes[0];
                owaEventNamespaceAttribute.SegmentationFlags = owaEventSegmentationAttribute.SegmentationFlags;
            }
            else
            {
                owaEventNamespaceAttribute.SegmentationFlags = 0UL;
            }
            Type objectIdType = null;

            customAttributes = handlerType.GetCustomAttributes(typeof(OwaEventObjectIdAttribute), false);
            if (customAttributes != null && customAttributes.Length > 0)
            {
                objectIdType = ((OwaEventObjectIdAttribute)customAttributes[0]).ObjectIdType;
            }
            ExTraceGlobals.OehDataTracer.TraceDebug <string>(0L, "Handler type: '{0}'", handlerType.ToString());
            foreach (MethodInfo methodInfo in handlerType.GetMethods(BindingFlags.Instance | BindingFlags.Public))
            {
                customAttributes = methodInfo.GetCustomAttributes(typeof(OwaEventAttribute), false);
                if (customAttributes != null && customAttributes.Length > 0)
                {
                    OwaEventAttribute owaEventAttribute = (OwaEventAttribute)customAttributes[0];
                    ParameterInfo[]   parameters        = methodInfo.GetParameters();
                    if (methodInfo.ReturnType == typeof(IAsyncResult))
                    {
                        if (parameters.Length != 2 || parameters[0].ParameterType != typeof(AsyncCallback) || parameters[1].ParameterType != typeof(object))
                        {
                            throw new OwaNotSupportedException("Wrong signature for async event handler method.");
                        }
                        owaEventAttribute.IsAsync         = true;
                        owaEventAttribute.BeginMethodInfo = methodInfo;
                    }
                    else if (methodInfo.ReturnType == typeof(void))
                    {
                        if (parameters.Length == 1 && parameters[0].ParameterType == typeof(IAsyncResult))
                        {
                            owaEventAttribute.EndMethodInfo = methodInfo;
                            owaEventAttribute.IsAsync       = true;
                        }
                        else
                        {
                            if (parameters.Length != 0)
                            {
                                throw new OwaNotSupportedException("Wrong signature for event handler method.");
                            }
                            owaEventAttribute.MethodInfo = methodInfo;
                            owaEventAttribute.IsAsync    = false;
                        }
                    }
                    if (!owaEventAttribute.IsAsync || !(null != owaEventAttribute.EndMethodInfo))
                    {
                        OwaEventRegistry.ScanHandlerAttributes(methodInfo, owaEventAttribute, objectIdType);
                    }
                    owaEventNamespaceAttribute.AddEventInfo(owaEventAttribute);
                }
            }
            foreach (object obj in owaEventNamespaceAttribute.EventInfoTable.Values)
            {
                OwaEventAttribute owaEventAttribute2 = obj as OwaEventAttribute;
                if (owaEventAttribute2.MethodInfo != null)
                {
                    if (owaEventAttribute2.BeginMethodInfo != null || owaEventAttribute2.EndMethodInfo != null)
                    {
                        throw new OwaNotSupportedException("Namespace defines the same event both sync and async");
                    }
                }
                else if (owaEventAttribute2.BeginMethodInfo != null)
                {
                    if (owaEventAttribute2.EndMethodInfo == null)
                    {
                        throw new OwaNotSupportedException(string.Format("Begin async method {0} for event {1} is missing its corresponding End method", owaEventAttribute2.BeginMethodInfo.Name, owaEventAttribute2.Name));
                    }
                }
                else if (owaEventAttribute2.EndMethodInfo != null && owaEventAttribute2.BeginMethodInfo == null)
                {
                    throw new OwaNotSupportedException(string.Format("End async method {0} for event {1} is missing its corresponding Begin method", owaEventAttribute2.EndMethodInfo.Name, owaEventAttribute2.Name));
                }
            }
            OwaEventRegistry.handlerTable.Add(owaEventNamespaceAttribute.Name, owaEventNamespaceAttribute);
        }
Exemple #9
0
        private static void ScanHandlerAttributes(MethodInfo method, OwaEventAttribute eventInfo, Type objectIdType)
        {
            object[] customAttributes = method.GetCustomAttributes(typeof(OwaEventVerbAttribute), false);
            if (customAttributes != null && customAttributes.Length > 0)
            {
                OwaEventVerbAttribute owaEventVerbAttribute = (OwaEventVerbAttribute)customAttributes[0];
                eventInfo.AllowedVerbs = owaEventVerbAttribute.Verb;
            }
            else
            {
                eventInfo.AllowedVerbs = OwaEventVerb.Post;
            }
            customAttributes = method.GetCustomAttributes(typeof(OwaEventSegmentationAttribute), false);
            if (customAttributes != null && customAttributes.Length > 0)
            {
                OwaEventSegmentationAttribute owaEventSegmentationAttribute = (OwaEventSegmentationAttribute)customAttributes[0];
                eventInfo.SegmentationFlags = owaEventSegmentationAttribute.SegmentationFlags;
            }
            else
            {
                eventInfo.SegmentationFlags = 0UL;
            }
            ExTraceGlobals.OehDataTracer.TraceDebug <string, OwaEventVerb>(0L, "Event handler found. Name: '{0}'. Allowed verbs: '{1}'.", eventInfo.Name, eventInfo.AllowedVerbs);
            ulong num  = 0UL;
            int   num2 = 0;

            if (Globals.CanaryProtectionRequired)
            {
                eventInfo.AddParameterInfo(new OwaEventParameterAttribute("canary", typeof(string)));
            }
            customAttributes = method.GetCustomAttributes(typeof(OwaEventParameterAttribute), false);
            if (customAttributes != null && customAttributes.Length > 0)
            {
                if (customAttributes.Length >= 64)
                {
                    throw new OwaNotSupportedException("Event handler declares more parameters than allowed");
                }
                if ((eventInfo.AllowedVerbs & OwaEventVerb.Get) != OwaEventVerb.Unsupported && customAttributes.Length > 16)
                {
                    throw new OwaNotSupportedException("Event handler declares more parameters than allowed for a GET request");
                }
                foreach (OwaEventParameterAttribute owaEventParameterAttribute in customAttributes)
                {
                    if (objectIdType != null && owaEventParameterAttribute.Type == typeof(ObjectId))
                    {
                        owaEventParameterAttribute = new OwaEventParameterAttribute(owaEventParameterAttribute.Name, objectIdType, owaEventParameterAttribute.IsArray, owaEventParameterAttribute.IsOptional);
                    }
                    if (!eventInfo.IsInternal && !OwaEventRegistry.IsAllowedType(owaEventParameterAttribute.Type))
                    {
                        string message = string.Format("Event handler is using a type that is not supported method: '{0}' param type '{1}'", method.Name, owaEventParameterAttribute.Type);
                        throw new OwaNotSupportedException(message);
                    }
                    if (string.Equals(owaEventParameterAttribute.Name, "ns", StringComparison.Ordinal) || string.Equals(owaEventParameterAttribute.Name, "ev", StringComparison.Ordinal))
                    {
                        throw new OwaNotSupportedException("Handler is trying to use a reserve name for a parameter");
                    }
                    if (OwaEventRegistry.structTypeTable[owaEventParameterAttribute.Type] != null)
                    {
                        owaEventParameterAttribute.IsStruct = true;
                    }
                    owaEventParameterAttribute.ParameterMask = 1UL << num2;
                    if (!owaEventParameterAttribute.IsOptional)
                    {
                        num |= owaEventParameterAttribute.ParameterMask;
                    }
                    eventInfo.AddParameterInfo(owaEventParameterAttribute);
                    num2++;
                    ExTraceGlobals.OehDataTracer.TraceDebug(0L, "Event handler parameter found, name: '{0}', type: '{1}', isArray: '{2}', isOptional: '{3}', isStruct: '{4}'", new object[]
                    {
                        owaEventParameterAttribute.Name,
                        owaEventParameterAttribute.Type,
                        owaEventParameterAttribute.IsArray,
                        owaEventParameterAttribute.IsOptional,
                        owaEventParameterAttribute.IsStruct
                    });
                }
            }
            eventInfo.RequiredMask = num;
        }