public static string EncodeMember(BloxMemberInfo member)
        {
            if (member == null)
            {
                return("");
            }
            string text = "";

            if (member.MemberType == MemberTypes.Field)
            {
                text = "F";
            }
            else if (member.MemberType == MemberTypes.Property)
            {
                text = "P";
            }
            else if (member.MemberType == MemberTypes.Constructor)
            {
                text = "C";
            }
            else if (member.MemberType == MemberTypes.Method)
            {
                text = "M";
            }
            string[] obj = new string[5]
            {
                text,
                null,
                null,
                null,
                null
            };
            char mEMBER_ENCODE_SEPERATOR = BloxMemberInfo.MEMBER_ENCODE_SEPERATOR;

            obj[1] = mEMBER_ENCODE_SEPERATOR.ToString();
            obj[2] = member.ReflectedType.AssemblyQualifiedName;
            mEMBER_ENCODE_SEPERATOR = BloxMemberInfo.MEMBER_ENCODE_SEPERATOR;
            obj[3] = mEMBER_ENCODE_SEPERATOR.ToString();
            obj[4] = member.Name;
            text   = string.Concat(obj);
            ParameterInfo[] parameters = member.GetParameters();
            if (((parameters != null) ? parameters.Length : 0) != 0)
            {
                for (int i = 0; i < parameters.Length; i++)
                {
                    string str = text;
                    mEMBER_ENCODE_SEPERATOR = BloxMemberInfo.MEMBER_ENCODE_SEPERATOR;
                    text = str + mEMBER_ENCODE_SEPERATOR.ToString() + parameters[i].ParameterType.AssemblyQualifiedName;
                }
            }
            return(text);
        }
Beispiel #2
0
 public void Init()
 {
     if (this.active)
     {
         if (this.blockType == BloxBlockType.Unknown || (this.mi != null && !this.mi.IsValid))
         {
             this.isValid = false;
         }
         else
         {
             if (this.returnValue == null && this.returnType != null && this.returnType != typeof(void))
             {
                 this.returnValue = BloxMemberInfo.GetDefaultValue(this.returnType);
             }
             if (this.owningBlock != null && this.mi != null && (this.mi.MemberType == MemberTypes.Field || this.mi.MemberType == MemberTypes.Property))
             {
                 this.paramBlocks = null;
             }
             BloxMemberInfo obj = this.mi;
             this.contextType = ((obj != null) ? obj.ReflectedType : null);
             if (this.contextBlock != null)
             {
                 this.contextBlock.owningEvent = this.owningEvent;
                 this.contextBlock.owningBlock = this;
                 this.contextBlock.Init();
             }
             BloxMemberInfo  obj2  = this.mi;
             ParameterInfo[] array = (obj2 != null) ? obj2.GetParameters() : null;
             if (((array != null) ? array.Length : 0) != 0)
             {
                 this.paramTypes = new Type[array.Length];
                 for (int i = 0; i < this.paramTypes.Length; i++)
                 {
                     this.paramTypes[i] = array[i].ParameterType;
                     if (this.paramTypes[i].IsByRef)
                     {
                         this.hasReferenceTypes = true;
                         if (this.paramBlocks != null && this.paramBlocks.Length >= i && this.paramBlocks[i] != null && this.paramBlocks[i].GetType() == typeof(Variable_Block))
                         {
                             break;
                         }
                         this.LogError("The Block field [" + array[i].Name + "] expected a Variable Block.", null);
                         return;
                     }
                 }
             }
             else if (this.mi != null && (this.mi.MemberType == MemberTypes.Field || this.mi.MemberType == MemberTypes.Property))
             {
                 this.paramTypes = new Type[1]
                 {
                     this.mi.ReturnType
                 };
             }
             if (((this.paramBlocks != null) ? this.paramBlocks.Length : 0) != 0)
             {
                 this.paramValues = new object[this.paramBlocks.Length];
                 for (int j = 0; j < this.paramBlocks.Length; j++)
                 {
                     if (this.paramBlocks[j] == null)
                     {
                         if (this.paramTypes != null && this.paramTypes.Length > j)
                         {
                             this.paramValues[j] = BloxMemberInfo.GetDefaultValue(this.paramTypes[j]);
                         }
                     }
                     else
                     {
                         this.paramBlocks[j].owningEvent = this.owningEvent;
                         this.paramBlocks[j].owningBlock = this;
                         this.paramBlocks[j].fieldIdx    = j;
                         this.paramBlocks[j].Init();
                     }
                 }
             }
             this.InitBlock();
             if (this.isValid)
             {
                 for (BloxBlock bloxBlock = this.firstChild; bloxBlock != null; bloxBlock = bloxBlock.next)
                 {
                     bloxBlock.parentBlock = this;
                     bloxBlock.owningEvent = this.owningEvent;
                     if (bloxBlock.next != null)
                     {
                         bloxBlock.next.prevBlock = bloxBlock;
                     }
                     bloxBlock.Init();
                     if (bloxBlock.selfOrChildCanYield)
                     {
                         this.selfOrChildCanYield = true;
                     }
                 }
             }
         }
     }
 }