Ejemplo n.º 1
0
        /// <include file='doc\LogicalMethodInfo.uex' path='docs/doc[@for="LogicalMethodInfo.Create1"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public static LogicalMethodInfo[] Create(MethodInfo[] methodInfos, LogicalMethodTypes types)
        {
            ArrayList begins = (types & LogicalMethodTypes.Async) != 0 ? new ArrayList() : null;
            Hashtable ends   = (types & LogicalMethodTypes.Async) != 0 ? new Hashtable() : null;
            ArrayList syncs  = (types & LogicalMethodTypes.Sync) != 0 ? new ArrayList() : null;

            for (int i = 0; i < methodInfos.Length; i++)
            {
                MethodInfo methodInfo = methodInfos[i];
                if (IsBeginMethod(methodInfo))
                {
                    if (begins != null)
                    {
                        begins.Add(methodInfo);
                    }
                }
                else if (IsEndMethod(methodInfo))
                {
                    if (ends != null)
                    {
                        ends.Add(methodInfo.Name, methodInfo);
                    }
                }
                else
                {
                    if (syncs != null)
                    {
                        syncs.Add(methodInfo);
                    }
                }
            }

            int beginsCount = begins == null ? 0 : begins.Count;
            int syncsCount  = syncs == null ? 0 : syncs.Count;
            int count       = syncsCount + beginsCount;

            LogicalMethodInfo[] methods = new LogicalMethodInfo[count];
            count = 0;
            for (int i = 0; i < syncsCount; i++)
            {
                methods[count++] = new LogicalMethodInfo((MethodInfo)syncs[i]);
            }
            for (int i = 0; i < beginsCount; i++)
            {
                MethodInfo beginMethodInfo = (MethodInfo)begins[i];
                string     endName         = "End" + beginMethodInfo.Name.Substring(5);
                MethodInfo endMethodInfo   = (MethodInfo)ends[endName];
                if (endMethodInfo == null)
                {
                    throw new InvalidOperationException(Res.GetString(Res.WebAsyncMissingEnd, beginMethodInfo.DeclaringType.FullName, beginMethodInfo.Name, endName));
                }
                methods[count++] = new LogicalMethodInfo(beginMethodInfo, endMethodInfo);
            }

            return(methods);
        }
	public static LogicalMethodInfo[] Create(System.Reflection.MethodInfo[] methodInfos, LogicalMethodTypes types) {}
 /// <include file='doc\LogicalMethodInfo.uex' path='docs/doc[@for="LogicalMethodInfo.Create1"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public static LogicalMethodInfo[] Create(MethodInfo[] methodInfos, LogicalMethodTypes types)
 {
     return(Create(methodInfos, types, null));
 }
Ejemplo n.º 4
0
 /// <include file='doc\LogicalMethodInfo.uex' path='docs/doc[@for="LogicalMethodInfo.Create1"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public static LogicalMethodInfo[] Create(MethodInfo[] methodInfos, LogicalMethodTypes types) {
     return Create(methodInfos, types, null);
 }
Ejemplo n.º 5
0
        internal static LogicalMethodInfo[] Create(MethodInfo[] methodInfos, LogicalMethodTypes types, Hashtable declarations) {
            ArrayList begins = (types & LogicalMethodTypes.Async) != 0 ? new ArrayList() : null;
            Hashtable ends = (types & LogicalMethodTypes.Async) != 0 ? new Hashtable() : null;
            ArrayList syncs = (types & LogicalMethodTypes.Sync) != 0 ? new ArrayList() : null;

            for (int i = 0; i < methodInfos.Length; i++) {
                MethodInfo methodInfo = methodInfos[i];
                if (IsBeginMethod(methodInfo)) {
                    if (begins != null) begins.Add(methodInfo);
                }
                else if (IsEndMethod(methodInfo)) {
                    if (ends != null) ends.Add(methodInfo.Name, methodInfo);
                }
                else {
                    if (syncs != null) syncs.Add(methodInfo);
                }
            }

            int beginsCount = begins == null ? 0 : begins.Count;
            int syncsCount = syncs == null ? 0 : syncs.Count;
            int count = syncsCount + beginsCount;
            LogicalMethodInfo[] methods = new LogicalMethodInfo[count];
            count = 0;
            for (int i = 0; i < syncsCount; i++) {
                MethodInfo syncMethod = (MethodInfo)syncs[i];
                WebMethod webMethod = declarations == null ? null : (WebMethod)declarations[syncMethod];
                methods[count] = new LogicalMethodInfo(syncMethod, webMethod);
                methods[count].CheckContractOverride();
                count++;
            }
            for (int i = 0; i < beginsCount; i++) {
                MethodInfo beginMethodInfo = (MethodInfo)begins[i];
                string endName = "End" + beginMethodInfo.Name.Substring(5);
                MethodInfo endMethodInfo = (MethodInfo)ends[endName];
                if (endMethodInfo == null) {
                    throw new InvalidOperationException(Res.GetString(Res.WebAsyncMissingEnd, beginMethodInfo.DeclaringType.FullName, beginMethodInfo.Name, endName));
                }
                WebMethod webMethod = declarations == null ? null : (WebMethod)declarations[beginMethodInfo];
                methods[count++] = new LogicalMethodInfo(beginMethodInfo, endMethodInfo, webMethod);
            }

            return methods;
        }
        internal static LogicalMethodInfo[] Create(System.Reflection.MethodInfo[] methodInfos, LogicalMethodTypes types, Hashtable declarations)
        {
            ArrayList list      = ((types & LogicalMethodTypes.Async) != ((LogicalMethodTypes)0)) ? new ArrayList() : null;
            Hashtable hashtable = ((types & LogicalMethodTypes.Async) != ((LogicalMethodTypes)0)) ? new Hashtable() : null;
            ArrayList list2     = ((types & LogicalMethodTypes.Sync) != ((LogicalMethodTypes)0)) ? new ArrayList() : null;

            for (int i = 0; i < methodInfos.Length; i++)
            {
                System.Reflection.MethodInfo methodInfo = methodInfos[i];
                if (IsBeginMethod(methodInfo))
                {
                    if (list != null)
                    {
                        list.Add(methodInfo);
                    }
                }
                else if (IsEndMethod(methodInfo))
                {
                    if (hashtable != null)
                    {
                        hashtable.Add(methodInfo.Name, methodInfo);
                    }
                }
                else if (list2 != null)
                {
                    list2.Add(methodInfo);
                }
            }
            int num2  = (list == null) ? 0 : list.Count;
            int num3  = (list2 == null) ? 0 : list2.Count;
            int index = num3 + num2;

            LogicalMethodInfo[] infoArray = new LogicalMethodInfo[index];
            index = 0;
            for (int j = 0; j < num3; j++)
            {
                System.Reflection.MethodInfo info2 = (System.Reflection.MethodInfo)list2[j];
                WebMethod webMethod = (declarations == null) ? null : ((WebMethod)declarations[info2]);
                infoArray[index] = new LogicalMethodInfo(info2, webMethod);
                infoArray[index].CheckContractOverride();
                index++;
            }
            for (int k = 0; k < num2; k++)
            {
                System.Reflection.MethodInfo beginMethodInfo = (System.Reflection.MethodInfo)list[k];
                string str = "End" + beginMethodInfo.Name.Substring(5);
                System.Reflection.MethodInfo endMethodInfo = (System.Reflection.MethodInfo)hashtable[str];
                if (endMethodInfo == null)
                {
                    throw new InvalidOperationException(Res.GetString("WebAsyncMissingEnd", new object[] { beginMethodInfo.DeclaringType.FullName, beginMethodInfo.Name, str }));
                }
                WebMethod method2 = (declarations == null) ? null : ((WebMethod)declarations[beginMethodInfo]);
                infoArray[index++] = new LogicalMethodInfo(beginMethodInfo, endMethodInfo, method2);
            }
            return(infoArray);
        }
Ejemplo n.º 7
0
        public static LogicalMethodInfo[] Create(MethodInfo[] method_infos, LogicalMethodTypes types)
        {
            ArrayList sync = ((types & LogicalMethodTypes.Sync) != 0) ? new ArrayList() : null;
            ArrayList begin, end;

            if ((types & LogicalMethodTypes.Async) != 0)
            {
                begin = new ArrayList();
                end   = new ArrayList();
            }
            else
            {
                begin = end = null;
            }

            foreach (MethodInfo mi in method_infos)
            {
                if (IsBeginMethod(mi) && begin != null)
                {
                    begin.Add(mi);
                }
                else if (IsEndMethod(mi) && end != null)
                {
                    end.Add(mi);
                }
                else if (sync != null)
                {
                    sync.Add(mi);
                }
            }

            int bcount = 0, count = 0;

            if (begin != null)
            {
                bcount = count = begin.Count;
                if (count != end.Count)
                {
                    throw new InvalidOperationException("Imbalance of begin/end methods");
                }
            }
            if (sync != null)
            {
                count += sync.Count;
            }

            LogicalMethodInfo [] res = new LogicalMethodInfo [count];
            int dest = 0;

            if (begin != null)
            {
                foreach (MethodInfo bm in begin)
                {
                    string end_name = "End" + bm.Name.Substring(5);

                    for (int i = 0; i < bcount; i++)
                    {
                        MethodInfo em = (MethodInfo)end [i];
                        if (em.Name == end_name)
                        {
                            res [dest++] = new LogicalMethodInfo(bm, em);
                            break;
                        }
                        throw new InvalidOperationException("Imbalance of begin/end methods");
                    }
                }
            }


            if (sync != null)
            {
                foreach (MethodInfo mi in sync)
                {
                    res [dest++] = new LogicalMethodInfo(mi);
                }
            }

            return(res);
        }
 public static LogicalMethodInfo[] Create(System.Reflection.MethodInfo[] methodInfos, LogicalMethodTypes types)
 {
     return(Create(methodInfos, types, null));
 }
Ejemplo n.º 9
0
		public static LogicalMethodInfo[] Create (MethodInfo[] method_infos, LogicalMethodTypes types)
		{
			ArrayList sync = ((types & LogicalMethodTypes.Sync) != 0) ? new ArrayList () : null;
			ArrayList begin, end;

			if ((types & LogicalMethodTypes.Async) != 0){
				begin = new ArrayList ();
				end = new ArrayList ();
			} else 
				begin = end = null;

			foreach (MethodInfo mi in method_infos){
				if (IsBeginMethod (mi) && begin != null)
					begin.Add (mi);
				else if (IsEndMethod (mi) && end != null)
					end.Add (mi);
				else if (sync != null)
					sync.Add (mi);
			}

			int bcount = 0, count = 0;
			if (begin != null){
				bcount = count = begin.Count;
				if (count != end.Count)
					throw new InvalidOperationException ("Imbalance of begin/end methods");
			}
			if (sync != null)
				count += sync.Count;

			LogicalMethodInfo [] res = new LogicalMethodInfo [count];
			int dest = 0;
			if (begin != null){
				foreach (MethodInfo bm in begin){
					string end_name = "End" + bm.Name.Substring (5);

					for (int i = 0; i < bcount; i++){
						MethodInfo em = (MethodInfo) end [i];
						if (em.Name == end_name){
							res [dest++] = new LogicalMethodInfo (bm, em);
							break;
						}
						throw new InvalidOperationException ("Imbalance of begin/end methods");
					}
				}
			}


			if (sync != null)
				foreach (MethodInfo mi in sync){
					res [dest++] = new LogicalMethodInfo (mi);
				}
			
			return res;
		}
 internal static LogicalMethodInfo[] Create(System.Reflection.MethodInfo[] methodInfos, LogicalMethodTypes types, Hashtable declarations)
 {
     ArrayList list = ((types & LogicalMethodTypes.Async) != ((LogicalMethodTypes) 0)) ? new ArrayList() : null;
     Hashtable hashtable = ((types & LogicalMethodTypes.Async) != ((LogicalMethodTypes) 0)) ? new Hashtable() : null;
     ArrayList list2 = ((types & LogicalMethodTypes.Sync) != ((LogicalMethodTypes) 0)) ? new ArrayList() : null;
     for (int i = 0; i < methodInfos.Length; i++)
     {
         System.Reflection.MethodInfo methodInfo = methodInfos[i];
         if (IsBeginMethod(methodInfo))
         {
             if (list != null)
             {
                 list.Add(methodInfo);
             }
         }
         else if (IsEndMethod(methodInfo))
         {
             if (hashtable != null)
             {
                 hashtable.Add(methodInfo.Name, methodInfo);
             }
         }
         else if (list2 != null)
         {
             list2.Add(methodInfo);
         }
     }
     int num2 = (list == null) ? 0 : list.Count;
     int num3 = (list2 == null) ? 0 : list2.Count;
     int index = num3 + num2;
     LogicalMethodInfo[] infoArray = new LogicalMethodInfo[index];
     index = 0;
     for (int j = 0; j < num3; j++)
     {
         System.Reflection.MethodInfo info2 = (System.Reflection.MethodInfo) list2[j];
         WebMethod webMethod = (declarations == null) ? null : ((WebMethod) declarations[info2]);
         infoArray[index] = new LogicalMethodInfo(info2, webMethod);
         infoArray[index].CheckContractOverride();
         index++;
     }
     for (int k = 0; k < num2; k++)
     {
         System.Reflection.MethodInfo beginMethodInfo = (System.Reflection.MethodInfo) list[k];
         string str = "End" + beginMethodInfo.Name.Substring(5);
         System.Reflection.MethodInfo endMethodInfo = (System.Reflection.MethodInfo) hashtable[str];
         if (endMethodInfo == null)
         {
             throw new InvalidOperationException(Res.GetString("WebAsyncMissingEnd", new object[] { beginMethodInfo.DeclaringType.FullName, beginMethodInfo.Name, str }));
         }
         WebMethod method2 = (declarations == null) ? null : ((WebMethod) declarations[beginMethodInfo]);
         infoArray[index++] = new LogicalMethodInfo(beginMethodInfo, endMethodInfo, method2);
     }
     return infoArray;
 }
 public static LogicalMethodInfo[] Create(System.Reflection.MethodInfo[] methodInfos, LogicalMethodTypes types)
 {
     return Create(methodInfos, types, null);
 }
 public static LogicalMethodInfo[] Create(System.Reflection.MethodInfo[] methodInfos, LogicalMethodTypes types)
 {
 }