Ejemplo n.º 1
0
        public Parse(Type t)
        {
            maxTypeId = 0;
            maxFunId  = 0;

            types = new List <TType>();
            funs  = new List <TFunction>();

            AddBaseType(typeof(string));
            AddBaseType(typeof(byte));
            AddBaseType(typeof(Int32));
            AddBaseType(typeof(Int16));
            AddBaseType(typeof(Int64));
            AddBaseType(typeof(float));
            AddBaseType(typeof(bool));

            MethodInfo[] infos = t.GetMethods(BindingFlags.Public
                                              | BindingFlags.Instance | BindingFlags.DeclaredOnly);



            for (int i = 0; i < infos.Length; i++)
            {
                maxFunId++;

                MethodInfo info = infos[i];

                TFunction fun = new TFunction();

                fun.isClient = false;
                foreach (Attribute attr in info.GetCustomAttributes(true))
                {
                    IsClient isClient = attr as IsClient;
                    if (null != isClient)
                    {
                        fun.isClient = true;
                    }
                }

                fun.name = info.Name;
                fun.id   = maxFunId;
                fun.ret  = GetParam(info.ReturnType);


                ParameterInfo[] ps = info.GetParameters();
                fun.vars = new TParam[ps.Length];

                for (int j = 0; j < ps.Length; j++)
                {
                    fun.vars[j]      = GetParam(ps[j].ParameterType);
                    fun.vars[j].name = ps[j].Name;
                }

                funs.Add(fun);
            }
        }
Ejemplo n.º 2
0
 public override int GetHashCode()
 {
     return(Id.GetHashCode() ^ Account.GetHashCode() ^ IsClient.GetHashCode());
 }