Exemple #1
0
        public static ApiPrototype[] GetApiPrototypes(Assembly assembly)
        {
            // load type
            var apiMethodSignatureAttributeType = assembly.GetType(TypeHelper.API_METHOD_SIGNATURE_ATTRIBUTE_TYPENAME);

            // gather
            var results = new List <ApiPrototype>();

            var prototypes = assembly.GetTypes()
                             .Where(t => t.GetCustomAttributes(typeof(ScriptPrototypeAttribute), true).Length > 0);

            foreach (var prototypeType in prototypes)
            {
                var typeDef = prototypeType.GetCustomAttribute <ScriptPrototypeAttribute>();
                // prototype name
                var name = typeDef.VariableName;

                // construct prototype:
                var prototype = new ApiPrototype()
                {
                    Name = name
                };

                // get variables
                var vars = prototypeType.GetFields(BindingFlags.Public | BindingFlags.Instance)
                           .Where(f => f.GetCustomAttribute <ScriptVariableAttribute>() != null).ToArray();

                prototype.Variables = vars.Select(v => new ApiPrototypeVariable {
                    Name = v.Name, Type = TypeHelper.GetTypeName(v.FieldType)
                }).ToArray();

                // get methods
                var methods = prototypeType.GetMethods(BindingFlags.Public | BindingFlags.Static)
                              .Where(m => m.GetCustomAttributes(typeof(ScriptFunctionAttribute), true).Length > 0).ToArray();

                prototype.Methods = methods.Select(m =>
                {
                    var methodDef = m.GetCustomAttribute <ScriptFunctionAttribute>();
                    return(new ApiMethod
                    {
                        Name = methodDef.VariableName,
                        FunctionType = methodDef.FunctionType,
                        IsStatic = methodDef.IsStatic,
                        Signatures = m.GetCustomAttributes(apiMethodSignatureAttributeType, true).Select(s =>
                        {
                            var returnTypes = (Type[])apiMethodSignatureAttributeType.GetProperty("ReturnType").GetValue(s);
                            return new ApiMethodSignature
                            {
                                OptionalNum = (int)apiMethodSignatureAttributeType.GetProperty("OptionalNum").GetValue(s),
                                ParamNames = (string[])apiMethodSignatureAttributeType.GetProperty("ParamNames").GetValue(s),
                                ParamTypes = ((Type[])apiMethodSignatureAttributeType.GetProperty("ParamTypes").GetValue(s))
                                             .Select(pt => TypeHelper.GetTypeName(pt)).ToArray(),
                                ReturnTypes = returnTypes.Select(pt => TypeHelper.GetTypeName(pt, returnTypes.Length)).ToArray()
                            };
                        }).ToArray()
                    });
                }).ToArray();

                results.Add(prototype);
            }

            return(results.ToArray());
        }
        public static ApiClass[] GetApiClasses(Assembly assembly)
        {
            // load types
            var apiClassType                    = assembly.GetType(TypeHelper.API_CLASS_TYPENAME);
            var apiClassAttributeType           = assembly.GetType(TypeHelper.API_CLASS_ATTRIBUTE_TYPENAME);
            var apiMethodSignatureAttributeType = assembly.GetType(TypeHelper.API_METHOD_SIGNATURE_ATTRIBUTE_TYPENAME);

            // gather api classes:
            var results = new List <ApiClass>();

            var apiClasses = assembly.GetTypes()
                             .Where(t => t.IsSubclassOf(apiClassType) && t.GetCustomAttributes(apiClassAttributeType, true).Length > 0);

            foreach (var apiClass in apiClasses)
            {
                var attr = apiClass.GetCustomAttribute(apiClassAttributeType);
                // class name
                var name = (string)apiClassAttributeType.GetProperty("ClassName").GetValue(attr);

                // get methods
                var methods = apiClass.GetMethods(BindingFlags.Public | BindingFlags.Static)
                              .Where(m => m.GetCustomAttributes(apiMethodSignatureAttributeType, true).Length > 0).ToArray();

                // construct class
                var cl = new ApiClass {
                    Name = name
                };
                var clMethods = new List <ApiMethod>();

                foreach (var method in methods)
                {
                    var signatures = method.GetCustomAttributes(apiMethodSignatureAttributeType, true);

                    var clMethod = new ApiMethod()
                    {
                        IsStatic = true, Name = method.Name, FunctionType = ScriptFunctionType.Standard
                    };
                    var clMethodSignatures = new List <ApiMethodSignature>();
                    foreach (var signature in signatures)
                    {
                        var returnTypes = (Type[])apiMethodSignatureAttributeType.GetProperty("ReturnType").GetValue(signature);
                        var paramNames  = (string[])apiMethodSignatureAttributeType.GetProperty("ParamNames").GetValue(signature);
                        var paramTypes  = (Type[])apiMethodSignatureAttributeType.GetProperty("ParamTypes").GetValue(signature);
                        var optionalNum = (int)apiMethodSignatureAttributeType.GetProperty("OptionalNum").GetValue(signature);

                        var methodSignature = new ApiMethodSignature()
                        {
                            OptionalNum = optionalNum,
                            ParamNames  = paramNames,
                            ParamTypes  = paramTypes.Select(pt => TypeHelper.GetTypeName(pt)).ToArray(),
                            ReturnTypes = returnTypes.Select(pt => TypeHelper.GetTypeName(pt, returnTypes.Length)).ToArray()
                        };

                        clMethodSignatures.Add(methodSignature);
                    }
                    clMethod.Signatures = clMethodSignatures.ToArray();

                    clMethods.Add(clMethod);
                }
                cl.Methods = clMethods.ToArray();

                results.Add(cl);
            }

            return(results.ToArray());
        }
 public static ApiPrototype[] GetBuiltInPrototypes()
 {
     return(new[]
     {
         // array
         new ApiPrototype
         {
             Name = "Array",
             Description = "Prototype for the primitve array[] type.",
             IsBuiltIn = true,
             Variables = new ApiPrototypeVariable[0],
             Methods = new[]
             {
                 new ApiMethod
                 {
                     Name = "constructor",
                     Description = "Takes any number of arguments, types can be mixed.",
                     FunctionType = ScriptFunctionType.Constructor,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "...args" },
                             ParamTypes = new[] { "any[]" },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(NetUndefined), 1) },
                             OptionalNum = 1
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "IndexerGet",
                     Description = "Returns the item in the array at index position.",
                     FunctionType = ScriptFunctionType.IndexerGet,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "index" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(int)) },
                             ReturnTypes = new[] { "any" }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "IndexerSet",
                     Description = "Overwrites the item in the array at index position.",
                     FunctionType = ScriptFunctionType.IndexerSet,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "index" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(int)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(NetUndefined), 1) }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "length",
                     Description = "Gets the amount of items in the array.",
                     FunctionType = ScriptFunctionType.Getter,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(int), 1) }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "includes",
                     Description = "Determines whether the array includes an item.<br />" +
                                   "Comparer example: </i><code>a.includes(item, (a, b) => { a.id == b.id; });</code><i>",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "item" },
                             ParamTypes = new[] { "any" },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(bool), 1) }
                         },
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "item", "comparer" },
                             ParamTypes = new[] { "any", "function" },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(bool), 1) }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "any",
                     Description = "If the array contains any items matching the search.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new string[0],
                             ParamTypes = new string[0],
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(bool), 1) }
                         },
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "comparer" },
                             ParamTypes = new[] { "function" },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(bool), 1) }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "where",
                     Description = "Filters the array with the given search.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "filter" },
                             ParamTypes = new[] { "function" },
                             ReturnTypes = new[] { "any[]" }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "first",
                     Description = $"Returns the first item in the array that matches the search or <span class=\"arg-type\">{TypeHelper.LinkType("undefined")}</span> for no match.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new string[0],
                             ParamTypes = new string[0],
                             ReturnTypes = new[] { "any" }
                         },
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "comparer" },
                             ParamTypes = new[] { "function" },
                             ReturnTypes = new[] { "any" }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "last",
                     Description = $"Returns the last item in the array that matches the search or <span class=\"arg-type\">{TypeHelper.LinkType("undefined")}</span> for no match.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new string[0],
                             ParamTypes = new string[0],
                             ReturnTypes = new[] { "any" }
                         },
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "comparer" },
                             ParamTypes = new[] { "function" },
                             ReturnTypes = new[] { "any" }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "select",
                     Description = "Transforms all elements of the array with a transformation function.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "transformer" },
                             ParamTypes = new[] { "function" },
                             ReturnTypes = new[] { "any[]" }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "single",
                     Description = "Finds a single item within the array and returns it.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new string[0],
                             ParamTypes = new string[0],
                             ReturnTypes = new[] { "any" }
                         },
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "comparer" },
                             ParamTypes = new[] { "function" },
                             ReturnTypes = new[] { "any" }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "count",
                     Description = "Returns the amount of items in the array that match the search.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new string[0],
                             ParamTypes = new string[0],
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(int), 1) }
                         },
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "comparer" },
                             ParamTypes = new[] { "function" },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(int), 1) }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "all",
                     Description = "Returns whether all items in the array conform to a constraint.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "constraint" },
                             ParamTypes = new[] { "function" },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(bool), 1) }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "push",
                     Description = "Adds items to the end of the array.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "...items" },
                             ParamTypes = new[] { "any[]" },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(NetUndefined), 1) }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "pop",
                     Description = "Removes the last item from the array and returns it.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new string[0],
                             ParamTypes = new string[0],
                             ReturnTypes = new[] { "any" }
                         }
                     }
                 },
             }
         },
         // boolean
         new ApiPrototype
         {
             Name = "Boolean",
             Description = "Prototype for the primitive bool type.",
             IsBuiltIn = true,
             Variables = new ApiPrototypeVariable[0],
             Methods = new []
             {
                 new ApiMethod
                 {
                     Name = "constructor",
                     FunctionType = ScriptFunctionType.Constructor,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "value" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(bool)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(NetUndefined), 1) }
                         }
                     }
                 },
             }
         },
         // number
         new ApiPrototype
         {
             Name = "Number",
             Description = "Prototype for the primitive number type.",
             IsBuiltIn = true,
             Variables = new ApiPrototypeVariable[0],
             Methods = new []
             {
                 new ApiMethod
                 {
                     Name = "constructor",
                     FunctionType = ScriptFunctionType.Constructor,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "value" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(double)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(NetUndefined), 1) }
                         }
                     }
                 },
             }
         },
         // object
         new ApiPrototype
         {
             Name = "Object",
             Description = "The base prototype for all prototypes. Methods from this prototype are available to all prototypes.",
             IsBuiltIn = true,
             Variables = new ApiPrototypeVariable[0],
             Methods = new []
             {
                 new ApiMethod
                 {
                     Name = "create",
                     Description = "Creates an instance of a prototype (either by name or reference to the prototype), \"args\" are the constructor arguments for the prototype.",
                     FunctionType = ScriptFunctionType.Standard,
                     IsStatic = true,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "prototypeName", "...args" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(string)), "any[]" },
                             ReturnTypes = new[] { "any" }
                         },
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "prototype", "...args" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(Object)), "any[]" },
                             ReturnTypes = new[] { "any" }
                         },
                     }
                 },
                 new ApiMethod
                 {
                     Name = "addMember",
                     Description = "Adds a member to a prototype and all new objects created from that prototype. Values for \"signatureConfig\" are \"readOnly\", \"static\", \"indexerGet\" and \"indexerSet\".",
                     FunctionType = ScriptFunctionType.Standard,
                     IsStatic = true,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "memberName", "defaultValue", "signatureConfig" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(string)), "any", TypeHelper.GetTypeName(typeof(string[])) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(NetUndefined), 1) },
                             OptionalNum = 2
                         },
                     }
                 },
             }
         },
         // string
         new ApiPrototype
         {
             Name = "String",
             Description = "Prototype for the primitive string type.",
             IsBuiltIn = true,
             Variables = new ApiPrototypeVariable[0],
             Methods = new []
             {
                 new ApiMethod
                 {
                     Name = "constructor",
                     FunctionType = ScriptFunctionType.Constructor,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "value" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(string)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(NetUndefined), 1) }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "length",
                     Description = "Gets the amount of characters in the string.",
                     FunctionType = ScriptFunctionType.Getter,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(int), 1) }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "empty",
                     Description = "Returns an empty string.",
                     IsStatic = true,
                     FunctionType = ScriptFunctionType.Getter,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "charAt",
                     Description = "Returns a character within the string.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "index" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(int)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "concat",
                     Description = "Concatenates multiple strings to this string.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "...strings" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(string[])) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "includes",
                     Description = "Returns whether the string contains another string.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "needle" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(string)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(bool), 1) }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "endsWith",
                     Description = "Returns whether the string ends with another string.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "needle" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(string)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(bool), 1) }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "startsWith",
                     Description = "Returns whether the string starts with another string.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "needle" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(string)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(bool), 1) }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "indexOf",
                     Description = "Returns the index of the first occurrence of a string within this string.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "needle" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(string)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(int), 1) }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "lastIndexOf",
                     Description = "Returns the index of the last occurrence of a string within this string.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "needle" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(string)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(int), 1) }
                         }
                     }
                 },
                 new ApiMethod
                 {
                     Name = "padEnd",
                     Description = "Pads the end of the string until the string reaches a certain length.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "targetLength" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(int)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) }
                         },
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "targetLength", "padStr" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(int)), TypeHelper.GetTypeName(typeof(string)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) }
                         },
                     }
                 },
                 new ApiMethod
                 {
                     Name = "padStart",
                     Description = "Pads the start of the string until the string reaches a certain length.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "targetLength" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(int)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) }
                         },
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "targetLength", "padStr" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(int)), TypeHelper.GetTypeName(typeof(string)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) }
                         },
                     }
                 },
                 new ApiMethod
                 {
                     Name = "repeat",
                     Description = "Repeats the string a number of times.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "amount" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(int)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) }
                         },
                     }
                 },
                 new ApiMethod
                 {
                     Name = "replace",
                     Description = "Replaces parts within the string with another string.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "replace", "with" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(string)), TypeHelper.GetTypeName(typeof(string)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) }
                         },
                     }
                 },
                 new ApiMethod
                 {
                     Name = "slice",
                     Description = "Returns a slice of the string.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "startIndex" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(int)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) }
                         },
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "startIndex", "length" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(int)), TypeHelper.GetTypeName(typeof(int)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) }
                         },
                     }
                 },
                 new ApiMethod
                 {
                     Name = "split",
                     Description = "Splits the string at a delimiter.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "delimiters", "limit" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(string[])), TypeHelper.GetTypeName(typeof(int)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string[]), 1) },
                             OptionalNum = 1
                         },
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "delimiter", "limit" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(string)), TypeHelper.GetTypeName(typeof(int)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string[]), 1) },
                             OptionalNum = 1
                         },
                     }
                 },
                 new ApiMethod
                 {
                     Name = "toLower",
                     Description = "Converts all alphabetic characters in the string to their lower case counterparts.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new string[0],
                             ParamTypes = new string[0],
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) }
                         },
                     }
                 },
                 new ApiMethod
                 {
                     Name = "toUpper",
                     Description = "Converts all alphabetic characters in the string to their upper case counterparts.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new string[0],
                             ParamTypes = new string[0],
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) }
                         },
                     }
                 },
                 new ApiMethod
                 {
                     Name = "trim",
                     Description = "Trims characters from the start and end of the string.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new string[0],
                             ParamTypes = new string[0],
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) }
                         },
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "trimChar" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(string)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) },
                         },
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "trimChars" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(string[])) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) },
                         },
                     }
                 },
                 new ApiMethod
                 {
                     Name = "trimStart",
                     Description = "Trims characters from the start of the string.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new string[0],
                             ParamTypes = new string[0],
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) }
                         },
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "trimChar" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(string)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) },
                         },
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "trimChars" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(string[])) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) },
                         },
                     }
                 },
                 new ApiMethod
                 {
                     Name = "trimEnd",
                     Description = "Trims characters from the end of the string.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new string[0],
                             ParamTypes = new string[0],
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) }
                         },
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "trimChar" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(string)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) },
                         },
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "trimChars" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(string[])) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) },
                         },
                     }
                 },
                 new ApiMethod
                 {
                     Name = "remove",
                     Description = "Removes a set of characters from the string.",
                     FunctionType = ScriptFunctionType.Standard,
                     Signatures = new[]
                     {
                         new ApiMethodSignature
                         {
                             ParamNames = new[] { "startIndex", "length" },
                             ParamTypes = new[] { TypeHelper.GetTypeName(typeof(int)), TypeHelper.GetTypeName(typeof(int)) },
                             ReturnTypes = new[] { TypeHelper.GetTypeName(typeof(string), 1) },
                             OptionalNum = 1
                         },
                     }
                 },
             }
         }
     });
 }