Esempio n. 1
0
        private void BuildAllSections()
        {
            DisposeAllListsAndControls();

            if (_returnType.Equals(typeof(void)))
            {
                _primaryStatement = new IDMethodList(this);
            }
            else
            {
                _primaryStatement = new IDPropertyList(this, _returnType, -1);
            }

            if (string.IsNullOrEmpty(_id))
            {
                return;
            }

            string id = "";

            if (!_id.Contains("(Object)"))
            {
                id = SplitMethodOrProperty(_primaryStatement, _id);
                BuildMethodArgs(id);
            }
            else
            {
                id = _id.Replace("(Object)", "");
                _primaryStatement.InsertPathNode(id);
            }


            // Now we validate Methods and arguments
            if (_argStatements != null)
            {
                IDMethodList mList    = _primaryStatement as IDMethodList;
                string       methodID = BuildFullID(mList.BuildID());
                Type[]       args     = new Type[_argStatements.Count];
                for (int i = 0; i < _argStatements.Count; i++)
                {
                    args[i] = _argStatements[i].PropNode.type;
                }
                if (!mList.ConfirmArgTypes(args))
                {
                    U.LogPopup("Unable to find matching method for '{0}'", _id);
                }
            }
        }
Esempio n. 2
0
        public string SplitMethodOrProperty(IDListBase curList, string id)
        {
            // Could be any of the following
            // CompNode.CompNode.Method(...
            // CompNode.CompNode.Property,...
            // Method(...
            // Property,...

            // No Literals expected here
            while (!string.IsNullOrEmpty(id))
            {
                string sNode   = id;
                int    iDelim  = id.IndexOfAny(new char[] { '.', ',', '(' });
                char   chDelim = '\0';
                if (iDelim < 0)
                {
                    id = string.Empty;
                }
                else
                {
                    chDelim = id[iDelim];
                    sNode   = id.Substring(0, iDelim);
                    id      = id.Substring(iDelim + 1);
                }
                if (chDelim == '.')
                {
                    // We have here a Path element
                    curList.InsertPathNode(sNode);
                }
                else // Must be last element
                {
                    curList.SetLast(sNode.TrimEnd(')'));
                    break;
                }
            }
            return(id);
        }