protected UserMethod(ScopeGroup scope, UserMethodBase node)
        {
            Name           = node.Name;
            ParameterNodes = node.Parameters;
            Documentation  = node.Documentation;
            Wiki           = new WikiMethod(Name, Documentation, null);
            AccessLevel    = node.AccessLevel;
            Node           = node;

            scope.In(this);
        }
        public ElementList(Type type)
        {
            ElementData data = type.GetCustomAttribute <ElementData>();

            Name             = type.Name.Substring(2);
            WorkshopName     = data.ElementName;
            Type             = type;
            IsValue          = data.IsValue;
            Parameters       = type.GetCustomAttributes <ParameterBase>().ToArray();
            Wiki             = WorkshopWiki.Wiki.GetWikiMethod(WorkshopName);
            UsageDiagnostics = type.GetCustomAttributes <UsageDiagnostic>().ToArray();
        }
        public UserMethod(ScopeGroup scope, UserMethodNode node)
        {
            Name           = node.Name;
            TypeString     = node.Type;
            Block          = node.Block;
            ParameterNodes = node.Parameters;
            IsRecursive    = node.IsRecursive;
            Documentation  = node.Documentation;
            Wiki           = new WikiMethod(Name, Documentation, null);
            AccessLevel    = node.AccessLevel;
            Node           = node;

            scope.In(this);
        }
Esempio n. 4
0
        public CustomMethodData(Type type)
        {
            Type = type;

            CustomMethod data = type.GetCustomAttribute <CustomMethod>();

            Name             = data.MethodName;
            CustomMethodType = data.MethodType;

            Parameters = type.GetCustomAttributes <ParameterBase>()
                         .ToArray();

            CustomMethodWiki cmWiki = GetObject().Wiki();

            if (cmWiki != null)
            {
                WikiParameter[] parameters = null;

                if (cmWiki.ParameterDescriptions != null)
                {
                    parameters = new WikiParameter[cmWiki.ParameterDescriptions.Length];
                    for (int i = 0; i < parameters.Length; i++)
                    {
                        parameters[i] = new WikiParameter(Parameters[i].Name, cmWiki.ParameterDescriptions[i]);
                    }
                }

                string description = cmWiki.Description;
                if (CustomMethodType == CustomMethodType.MultiAction_Value)
                {
                    if (description != null)
                    {
                        description += "\nThis method cannot be used in conditions.";
                    }
                    else
                    {
                        description = "This method cannot be used in conditions.";
                    }
                }

                Wiki = new WikiMethod(Name, description, parameters);
            }
        }