public static string GetMethodSignature(MethodInfo mif, string name, bool includeMethodName, out int paramCount)
 {
     ParameterInfo[] pifs = mif.GetParameters();
     Type[]          pp   = new Type[pifs.Length];
     for (int i = 0; i < pifs.Length; i++)
     {
         pp[i] = pifs[i].ParameterType;
     }
     if (string.IsNullOrEmpty(name))
     {
         name = mif.Name;
     }
     if (mif.ContainsGenericParameters)
     {
         Type[]        tcs = mif.GetGenericArguments();
         StringBuilder sb  = new StringBuilder(name);
         sb.Append("<");
         if (tcs.Length > 0)
         {
             sb.Append(VPLUtil.GetTypeDisplay(tcs[0]));
             for (int i = 1; i < tcs.Length; i++)
             {
                 sb.Append(";");
                 sb.Append(VPLUtil.GetTypeDisplay(tcs[i]));
             }
         }
         sb.Append(">");
         name = sb.ToString();
     }
     return(GetMethodSignature(name, includeMethodName, pp, mif.ReturnType, out paramCount));
 }
 public static string AddToolboxType(Type t)
 {
     if (t != null)
     {
         if (_toolboxTypes == null)
         {
             _toolboxTypes = new Dictionary <string, Type>();
         }
         foreach (KeyValuePair <string, Type> kv in _toolboxTypes)
         {
             if (t.Equals(kv.Value))
             {
                 return(kv.Key);
             }
         }
         string name = VPLUtil.GetTypeDisplay(t);
         int    n    = 1;
         while (_toolboxTypes.ContainsKey(name))
         {
             n++;
             name = string.Format(CultureInfo.InvariantCulture, "{0}{1}", t.Name, n);
         }
         _toolboxTypes.Add(name, t);
         return(name);
     }
     return(string.Empty);
 }
 public override string ToString()
 {
     if (_type == null)
     {
         return("?");
     }
     return(VPLUtil.GetTypeDisplay(_type));
 }
        public static string GetMethodSignature(string methodName, bool includeMethodName, Type[] paramTypes, Type returnType, out int paramCount)
        {
            StringBuilder sb = new StringBuilder();

            if (includeMethodName)
            {
                sb.Append(methodName);
            }
            paramCount = 0;
            if ((paramTypes != null && paramTypes.Length > 0) || (returnType != null && !returnType.Equals(typeof(void))))
            {
                sb.Append("(");
                if (paramTypes != null && paramTypes.Length > 0)
                {
                    paramCount = paramTypes.Length;
                    sb.Append(VPLUtil.GetTypeDisplay(paramTypes[0]));
                    for (int i = 1; i < paramTypes.Length; i++)
                    {
                        sb.Append(",");
                        if (paramTypes[i] == null)
                        {
                            sb.Append("null");
                        }
                        else
                        {
                            sb.Append(VPLUtil.GetTypeDisplay(paramTypes[i]));
                        }
                    }
                }
                sb.Append(")");
                if (returnType != null && !returnType.Equals(typeof(void)))
                {
                    sb.Append(VPLUtil.GetTypeDisplay(returnType));
                }
            }
            return(sb.ToString());
        }
        string INameCreationService.CreateName(IContainer container, Type type)
        {
            if (container == null || type == null)
            {
                return("name1");
            }
            string baseName        = VPLUtil.FormCodeNameFromname(VPLUtil.GetTypeDisplay(type));
            ComponentCollection cc = container.Components;
            int min   = Int32.MaxValue;
            int max   = Int32.MinValue;
            int count = 0;

            for (int i = 0; i < cc.Count; i++)
            {
                IComponent comp = cc[i] as IComponent;

                if (comp.GetType() == type)
                {
                    count++;

                    string name = comp.Site.Name;
                    if (name.StartsWith(baseName))
                    {
                        try
                        {
                            int value = Int32.Parse(name.Substring(baseName.Length));

                            if (value < min)
                            {
                                min = value;
                            }

                            if (value > max)
                            {
                                max = value;
                            }
                        }
                        catch (Exception ex)
                        {
                            Trace.WriteLine(ex.ToString());
                        }
                    }
                }
            }            // for

            if (count == 0)
            {
                return(string.Format(CultureInfo.InvariantCulture, "{0}1", baseName));
            }
            else if (min > 1)
            {
                int j = min - 1;

                return(string.Format(CultureInfo.InvariantCulture, "{0}{1}", baseName, j));
            }
            else
            {
                int j = max + 1;

                return(string.Format(CultureInfo.InvariantCulture, "{0}{1}", baseName, j));
            }
        }