Example #1
0
        private bool EqParts(ZMethodDesc another)
        {
            if (this.Parts.Count != another.Parts.Count)
            {
                return(false);
            }
            if (this.Args.Count != another.Args.Count)
            {
                return(false);
            }

            for (int i = 0; i < this.Parts.Count; i++)
            {
                object thisPart    = this.Parts[i];
                object anotherPart = another.Parts[i];

                if (thisPart is string)
                {
                    if (!(anotherPart is string))
                    {
                        return(false);
                    }

                    if (((thisPart as string) != anotherPart as string))
                    {
                        return(false);
                    }
                }
                else if (thisPart is ZCallArg)
                {
                    if (!(anotherPart is ZMethodArg))
                    {
                        return(false);
                    }

                    if (!((thisPart as ZCallArg).Compare(anotherPart as ZMethodArg)))
                    {
                        return(false);
                    }
                }

                /*else if (thisPart is TKTProcBracket)
                 * {
                 *  if (!(anotherPart is TKTProcBracket)) return false;
                 *
                 *  if (!((thisPart as TKTProcBracket).Eq(anotherPart as TKTProcBracket)))
                 *  {
                 *      return false;
                 *  }
                 * }*/
            }
            return(true);
        }
Example #2
0
        protected ZMethodDesc[] GetProcDesc(MethodInfo markMethod, MethodInfo sharpMethod)
        {
            List <ZMethodDesc> list = new List <ZMethodDesc>();

            ZCodeAttribute[] attrs = AttributeUtil.GetAttributes <ZCodeAttribute>(markMethod);
            foreach (ZCodeAttribute attr in attrs)
            {
                //if (markMethod.Name == "SetTitle")
                //{
                //    Console.WriteLine("ZMethodInfo.SetTitle");
                //}
                ZCodeParser parser       = new ZCodeParser(sharpMethod.DeclaringType, sharpMethod);
                ZMethodDesc typeProcDesc = parser.Parser(attr.Code);
                typeProcDesc.ZMethod = this;
                //ZMethodInfo exMethod = ZTypeUtil.CreatExMethodInfo(method, this.SharpType);
                //typeProcDesc.ExMethod = exMethod;
                list.Add(typeProcDesc);
            }
            return(list.ToArray());
        }
Example #3
0
        //public void SetArg(int k,ZMethodArg newArg)
        //{
        //    Args[k] = newArg;
        //    int j = 0;
        //    int i = 0;
        //    for (; i < this.Parts.Count;)
        //    {
        //        object thisPart = this.Parts[i];
        //        if (thisPart is ZMethodArg)
        //        {
        //            if(j==k)
        //            {
        //                Parts[i] = newArg;
        //                break;
        //            }
        //            j++;
        //        }
        //        i++;
        //    }
        //}

        public bool Compare(ZMethodDesc another)
        {
            //if (this == another) return true;
            return(EqParts(another));//&& EqBrackets(another);
        }