public SortedDictionary <string, MethodInfo> GetMethods()
        {
            SortedDictionary <string, MethodInfo> methods = new SortedDictionary <string, MethodInfo>();
            Type t = WrappedType;

            MethodInfo[] mifs = t.GetMethods();
            for (int i = 0; i < mifs.Length; i++)
            {
                if (!mifs[i].IsSpecialName)
                {
                    string s = MethodPointer.GetMethodSignature(mifs[i]);
                    methods.Add(s, mifs[i]);
                }
            }
            Type[] tps = t.GetInterfaces();
            if (tps != null && tps.Length > 0)
            {
                for (int i = 0; i < tps.Length; i++)
                {
                    mifs = tps[i].GetMethods();
                    for (int k = 0; k < mifs.Length; k++)
                    {
                        if (!mifs[k].IsSpecialName)
                        {
                            string s = MethodPointer.GetMethodSignature(mifs[k]);
                            if (!methods.ContainsKey(s))
                            {
                                methods.Add(s, mifs[k]);
                            }
                        }
                    }
                }
            }
            DataTypePointer ti = new DataTypePointer(CollectionItemType.LibTypePointer.ClassType);

            if (ti.IsGenericParameter)
            {
                DataTypePointer dp = GetConcreteType(ti.BaseClassType);
                if (dp != null)
                {
                    ti.SetConcreteType(dp);
                }
            }
            CollectionForEachMethodInfo af = new CollectionForEachMethodInfo(ti, CollectionType, MemberId.ToString("x"));

            methods.Add(af.Name, af);
            return(methods);
        }
Esempio n. 2
0
        public SortedDictionary <string, MethodInfo> GetMethods()
        {
            SortedDictionary <string, MethodInfo> methods = new SortedDictionary <string, MethodInfo>();
            Type t = WrappedType;

            MethodInfo[] mifs = t.GetMethods();
            for (int i = 0; i < mifs.Length; i++)
            {
                if (!mifs[i].IsSpecialName)
                {
                    string s = MethodPointer.GetMethodSignature(mifs[i]);
                    methods.Add(s, mifs[i]);
                }
            }
            Type[] tps = t.GetInterfaces();
            if (tps != null && tps.Length > 0)
            {
                for (int i = 0; i < tps.Length; i++)
                {
                    mifs = tps[i].GetMethods();
                    for (int k = 0; k < mifs.Length; k++)
                    {
                        if (!mifs[k].IsSpecialName)
                        {
                            string s = MethodPointer.GetMethodSignature(mifs[k]);
                            if (!methods.ContainsKey(s))
                            {
                                methods.Add(s, mifs[k]);
                            }
                        }
                    }
                }
            }
            ListForEachMethodInfo af = new ListForEachMethodInfo(typeof(String), MemberId.ToString("x"));

            methods.Add(af.Name, af);
            return(methods);
        }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         ActionClass act = context.Instance as ActionClass;
         if (act == null)
         {
             LimnorDesigner.PropertiesWrapper pw = context.Instance as LimnorDesigner.PropertiesWrapper;
             if (pw != null)
             {
                 LimnorDesigner.Action.AB_SingleAction abs = pw.Owner as LimnorDesigner.Action.AB_SingleAction;
                 if (abs != null)
                 {
                     act = abs.ActionData as ActionClass;
                 }
             }
         }
         if (act != null && act.ScopeMethod != null)
         {
             MethodClass mc = act.ScopeMethod as MethodClass;
             if (mc != null && (mc.CurrentEditor != null || mc.CurrentSubEditor != null))
             {
                 IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                 if (edSvc != null)
                 {
                     listAssignedTo list = new listAssignedTo(edSvc);
                     edSvc.DropDownControl(list);
                     if (list.SelectedAssignedTo == 0)
                     {
                         ComponentIconLocal cil       = null;
                         MethodClass        actMethod = act.ActionMethod as MethodClass;
                         if (actMethod == null)
                         {
                             CustomMethodPointer cmp = act.ActionMethod as CustomMethodPointer;
                             if (cmp != null)
                             {
                                 actMethod = cmp.MethodDef;
                             }
                         }
                         if (act.ReturnValueType.IsLibType)
                         {
                             Type t = act.ReturnValueType.BaseClassType;
                             if (t.IsArray)
                             {
                                 ArrayPointer ap = new ArrayPointer(new TypePointer(t.GetElementType()));
                                 if (mc.CurrentSubEditor != null)
                                 {
                                     cil = mc.CurrentSubEditor.CreateLocalVariable(ap, new System.Drawing.Point(0, 0), actMethod, false);
                                 }
                                 else
                                 {
                                     cil = mc.CurrentEditor.CreateLocalVariable(ap, new System.Drawing.Point(0, 0), actMethod, false);
                                 }
                             }
                         }
                         if (cil == null)
                         {
                             if (mc.CurrentSubEditor != null)
                             {
                                 cil = mc.CurrentSubEditor.CreateLocalVariable(act.ReturnValueType, new System.Drawing.Point(0, 0), actMethod, false);
                             }
                             else
                             {
                                 cil = mc.CurrentEditor.CreateLocalVariable(act.ReturnValueType, new System.Drawing.Point(0, 0), actMethod, false);
                             }
                         }
                         cil.LocalPointer.Owner = mc;
                         if (cil.LocalPointer.BaseClassType.IsGenericParameter)
                         {
                             if (cil.LocalPointer.ClassType.ConcreteType == null)
                             {
                                 DataTypePointer dp = act.GetConcreteType(cil.LocalPointer.BaseClassType);
                                 if (dp != null)
                                 {
                                     cil.LocalPointer.ClassType.SetConcreteType(dp);
                                 }
                             }
                         }
                         else if (cil.LocalPointer.BaseClassType.IsGenericType)
                         {
                             MethodPointer mp = act.ActionMethod as MethodPointer;
                             if (mp != null)
                             {
                                 if (mp.ReturnTypeConcrete != null)
                                 {
                                     cil.LocalPointer.SetDataType(mp.ReturnTypeConcrete);
                                 }
                                 else
                                 {
                                     DataTypePointer dp = mp.GetConcreteType(cil.LocalPointer.BaseClassType);
                                     if (dp != null)
                                     {
                                         cil.LocalPointer.SetDataType(dp);
                                     }
                                 }
                             }
                         }
                         value = cil.LocalPointer;
                     }
                     else if (list.SelectedAssignedTo == 1)
                     {
                         LValueSelector pe = new LValueSelector();
                         value = pe.EditValue(context, provider, value);
                     }
                 }
             }
         }
     }
     return(value);
 }
 /// <summary>
 /// get a CodeExpression representing T[i]?
 /// </summary>
 /// <param name="methodCompile"></param>
 /// <param name="statements"></param>
 /// <param name="method"></param>
 /// <param name="forValue"></param>
 /// <returns></returns>
 public CodeExpression GetReferenceCode(IMethodCompile methodCompile, CodeStatementCollection statements, MethodPointer method, CodeExpression[] ps, bool forValue)
 {
     return(new CodeVariableReferenceExpression(this.CodeName));
 }
Esempio n. 5
0
 /// <summary>
 /// get a CodeExpression representing T[i]?
 /// </summary>
 /// <param name="methodCompile"></param>
 /// <param name="statements"></param>
 /// <param name="method"></param>
 /// <param name="forValue"></param>
 /// <returns></returns>
 public CodeExpression GetReferenceCode(IMethodCompile methodCompile, CodeStatementCollection statements, MethodPointer method, CodeExpression[] ps, bool forValue)
 {
     if (string.Compare(method.MethodName, "Get", StringComparison.Ordinal) == 0)
     {
         CodeExpression ce = new CodeArrayIndexerExpression(GetReferenceCode(methodCompile, statements, forValue), ps);
         return(ce);
     }
     else if (string.Compare(method.MethodName, "Set", StringComparison.Ordinal) == 0)
     {
         CodeExpression ce = new CodeArrayIndexerExpression(GetReferenceCode(methodCompile, statements, forValue), ps[0]);
         return(ce);
     }
     return(null);
 }
        public SortedDictionary <string, MethodInfo> GetMethods()
        {
            bool bClientOnly = false;
            bool isWebPage   = false;

            if (this.RootPointer != null)
            {
                isWebPage = this.RootPointer.IsWebPage;
                if (this.RunAt == EnumWebRunAt.Client)
                {
                    bClientOnly = true;
                }
            }
            SortedDictionary <string, MethodInfo> methods = new SortedDictionary <string, MethodInfo>();
            Type t = WrappedType;

            MethodInfo[] mifs = t.GetMethods();
            for (int i = 0; i < mifs.Length; i++)
            {
                if (!mifs[i].IsSpecialName)
                {
                    if (bClientOnly)
                    {
                        bool include = false;
                        if (!string.IsNullOrEmpty(mifs[i].Name))
                        {
                            if (string.CompareOrdinal(mifs[i].Name, "Get") == 0)
                            {
                                include = true;
                            }
                            else if (string.CompareOrdinal(mifs[i].Name, "Set") == 0)
                            {
                                include = true;
                            }
                        }
                        if (!include)
                        {
                            continue;
                        }
                    }
                    string s = MethodPointer.GetMethodSignature(mifs[i]);
                    methods.Add(s, mifs[i]);
                }
            }
            Type[] tps = t.GetInterfaces();
            if (tps != null && tps.Length > 0)
            {
                for (int i = 0; i < tps.Length; i++)
                {
                    mifs = tps[i].GetMethods();
                    for (int k = 0; k < mifs.Length; k++)
                    {
                        if (!mifs[k].IsSpecialName)
                        {
                            if (bClientOnly)
                            {
                                bool include = false;
                                if (!string.IsNullOrEmpty(mifs[k].Name))
                                {
                                    if (string.CompareOrdinal(mifs[k].Name, "Get") == 0)
                                    {
                                        include = true;
                                    }
                                    else if (string.CompareOrdinal(mifs[k].Name, "Set") == 0)
                                    {
                                        include = true;
                                    }
                                }
                                if (!include)
                                {
                                    continue;
                                }
                            }
                            string s = MethodPointer.GetMethodSignature(mifs[k]);
                            if (!methods.ContainsKey(s))
                            {
                                methods.Add(s, mifs[k]);
                            }
                        }
                    }
                }
            }
            ArrayForEachMethodInfo af = new ArrayForEachMethodInfo(ArrayItemType.LibTypePointer.ClassType, MemberId.ToString("x"));

            methods.Add(af.Name, af);
            return(methods);
        }