예제 #1
0
        /// <summary>
        /// Adds new function with specified parameters.
        /// </summary>
        /// <param name="category">Category of function.</param>
        /// <param name="groupFunctionName">Name of group function. Can be same as function name.</param>
        /// <param name="functionName">Name of function.</param>
        /// <param name="description">Description of function.</param>
        /// <param name="typeOfFunction">Type which contain method of function.</param>
        /// <param name="returnType">Return type of function.</param>
        /// <param name="returnDescription">Description of returns.</param>
        /// <param name="argumentTypes">Array which contain types of arguments.</param>
        /// <param name="argumentNames">Array which contain names of arguments.</param>
        /// <param name="argumentDescriptions">Array which contain descriptions of arguments.</param>
        public static ProryvFunction AddFunction(string category, string groupFunctionName, string functionName, string description, Type typeOfFunction, Type returnType,
                                                 string returnDescription, Type [] argumentTypes, string [] argumentNames, string [] argumentDescriptions)
        {
            if (string.IsNullOrEmpty(groupFunctionName))
            {
                groupFunctionName = functionName;
            }

            var function = new ProryvFunction(
                category,
                groupFunctionName,
                functionName, description,
                typeOfFunction, returnType,
                returnDescription, argumentTypes, argumentNames, argumentDescriptions);

            #region Functions
            var list = functions[groupFunctionName] as List <ProryvFunction>;
            if (list == null)
            {
                list = new List <ProryvFunction>();
                functions[groupFunctionName] = list;
                functionsLower[groupFunctionName.ToLower(System.Globalization.CultureInfo.InvariantCulture)] = list;
            }
            list.Add(function);
            #endregion

            #region Functions to Compile
            list = functionsToCompile[functionName] as List <ProryvFunction>;
            if (list == null)
            {
                list = new List <ProryvFunction>();
                functionsToCompile[functionName] = list;
                functionsToCompileLower[functionName.ToLower(System.Globalization.CultureInfo.InvariantCulture)] = list;
            }
            list.Add(function);
            #endregion

            return(function);
        }
예제 #2
0
        public int CompareTo(object obj)
        {
            ProryvFunction function = obj as ProryvFunction;

            return(this.functionName.CompareTo(function.functionName));
        }