예제 #1
0
 protected void SelectBlock(int index)
 {
     if (BlockChanged != null)
     {
         if (index > -1)
         {
             Type         type  = blockCollection.GetType();
             PropertyInfo pi    = type.GetProperty("Item"); // Default name of an indexer is "Item"
             IBlock       block = (pi.GetGetMethod().Invoke(blockCollection, new object[1] {
                 index
             }) as IBlock);
             BlockChanged(new BlockChangedEventArgs(block));
         }
         else
         {
             BlockChanged(new BlockChangedEventArgs(null));
         }
     }
 }
        /// <summary>
        /// Loop through a cecil methods collection
        /// </summary>
        /// <param name="cecilMethods"></param>
        /// <param name="classTyp"></param>
        private void ProcessCecilMethod(CollectionBase cecilMethods, NetBaseType classTyp)
        {
            foreach (MethodDefinition def in cecilMethods)
            {
                if (!RefreshMethod(classTyp.Children, def))
                {
                    if (cecilMethods.GetType() == typeof(ConstructorCollection))
                    {
                        AddMethod(MethodType.Constructor, def);
                    }
                    if (cecilMethods.GetType() == typeof(MethodDefinitionCollection))
                    {
                        AddMethod(MethodType.Method, def);
                    }
                    if (cecilMethods.GetType() == typeof(PropertyDefinitionCollection))
                    {
                        AddMethod(MethodType.Property, def);
                    }
                    if (cecilMethods.GetType() == typeof(EventDefinitionCollection))
                    {
                        AddMethod(MethodType.Event, def);
                    }
                    if (cecilMethods.GetType() == typeof(FieldDefinitionCollection))
                    {
                        AddMethod(MethodType.Field, def);
                    }
                    if (cecilMethods.GetType() == typeof(InterfaceCollection))
                    {
                        AddMethod(MethodType.Interface, def);
                    }

                    //process nested types
                    //if (cecilMethods.GetType() == typeof(NestedTypeCollection))
                }
            }
        }