예제 #1
0
        public IMethodHodler convert(rho.protocol.client.IClientMethod serverData)
        {
            if (serverData == null)
            {
                return(null);
            }

            Type       type   = typeof(RunnableClass);
            MethodInfo method = type.GetMethod(serverData.Name);

            if (method == null)
            {
                return(null);
            }

            ParameterInfo[] methodTypesinfo = method.GetParameters();

            Type[] typeList = getTypesInNamespace(Assembly.GetExecutingAssembly(), nsNameForFactory);

            foreach (Type currType in typeList)
            {
                IMethodHodler holder      = (IMethodHodler)Activator.CreateInstance(currType);
                Type[]        holderTypes = holder.ParamsTypes;

                if (holderTypes.Length != methodTypesinfo.Length)
                {
                    continue;
                }

                bool isAllEqual = true;
                for (int i = 0; i < holderTypes.Length; ++i)
                {
                    string methodParamType = methodTypesinfo[i].ParameterType.AssemblyQualifiedName;
                    string holderParamType = holderTypes[i].AssemblyQualifiedName;

                    if (!methodParamType.Equals(holderParamType))
                    {
                        isAllEqual = false;
                    }
                }

                if (!isAllEqual)
                {
                    continue;
                }

                return(fillHolderFromClient(serverData, (IMethodHodlerFill)holder));
            }

            return(null);
        }
예제 #2
0
 public MethodRunnable(IMethodHodler methodHolder)
 {
     m_methodHolder = methodHolder;
 }