コード例 #1
0
        /// <summary>
        /// 
        /// </summary>
        public CodeFunctionInfo(BaseInfo parent, CodeFunction2 method)
            : base(parent, method as CodeElement2)
        {
            // Can be null when an custom ActionResult has no ctor
            if (method == null)
                return;

            _item = method;
            Summary = string.Empty;
            _signature = method.Name;
            this.IsGeneric = method.IsGeneric;

            try
            {
                BuildComment(_item.DocComment);
            }
            catch (Exception)
            {

            }

            this.Access = ObjectFactory.Convert(this._item.Access);

            Parameters.ToList();
        }
コード例 #2
0
        /// <summary>
        /// constructor
        /// </summary>
        public CodePropertyInfo(BaseInfo parent, CodeProperty2 item)
            : base(parent, item as CodeElement2)
        {
            this._item = item;
            this.Access = ObjectFactory.Convert(this._item.Access);

            switch (this._item.ReadWrite)
            {
                case vsCMPropertyKind.vsCMPropertyKindReadWrite:
                    this.CanRead = true;
                    this.CanWrite = true;
                    break;
                case vsCMPropertyKind.vsCMPropertyKindReadOnly:
                    this.CanRead = true;
                    this.CanWrite = false;
                    break;
                case vsCMPropertyKind.vsCMPropertyKindWriteOnly:
                    this.CanRead = false;
                    this.CanWrite = true;
                    break;
            }

            List<ParamInfo> _parameters = new List<ParamInfo>();

            int index = 0;
            foreach (var p in this._item.Parameters.OfType<CodeParameter2>())
            {
                ParamInfo pinfo = ObjectFactory.Instance.CreateParameter(this, p, index++, p.DocComment);
                _parameters.Add(pinfo);
            }

            this.Parameters = _parameters;
        }
コード例 #3
0
 /// <summary>
 /// 
 /// </summary>
 public CodeFieldInfo(BaseInfo parent, CodeElement item, TypeInfo type)
     : base(parent, item as CodeElement2)
 {
     this._item = item;
     this.Access = CMAccess.Public; // ObjectFactory.Convert(this._item.Access);
     this._type = type;
 }
コード例 #4
0
        /// <summary>
        /// 
        /// </summary>
        public BaseInfo(BaseInfo parent, CodeElement2 item)
        {
            this.Name = item.Name;
            this.FullName = item.FullName;
            this.IsCodeType = item.IsCodeType;
            this.Root = parent;
            this.Source = item;

            try
            {
                this.Project = new NodeProject(item.ProjectItem.ContainingProject);
                this.Location = new LocationInfo(item.StartPoint, item.EndPoint);
            }
            catch (Exception)
            {
                this.Location = new LocationInfo(null, null);
            }

            this.IsArray = false;
            this.ElementType = null;
        }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ClassInfo"/> class.
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="item"></param>
 protected ClassInfo(BaseInfo parent, CodeElement2 item)
     : base(parent, item)
 {
 }
コード例 #6
0
 /// <summary>
 /// 
 /// </summary>
 public CodeEventInfo(BaseInfo parent, EnvDTE80.CodeEvent item)
     : base(parent, item as CodeElement2)
 {
     this._item = item;
     this.Access = ObjectFactory.Convert(this._item.Access);
 }
コード例 #7
0
 public CodeConstructorInfo(BaseInfo parent, CodeFunction2 method)
     : base(parent, method)
 {
 }
コード例 #8
0
 /// <summary>
 /// 
 /// </summary>
 public CodeFieldInfo(BaseInfo parent, CodeElement item)
     : base(parent, item as CodeElement2)
 {
     this._item = item;
     //this._type = type;
 }
コード例 #9
0
 /// <summary>
 /// 
 /// </summary>
 public virtual CodePropertyInfo CreateProperty(BaseInfo parent, CodeProperty2 item)
 {
     return new CodePropertyInfo(parent, item);
 }
コード例 #10
0
 /// <summary>
 /// 
 /// </summary>
 public virtual CodeFunctionInfo CreateMethod(BaseInfo parent, CodeFunction2 item)
 {
     return new CodeFunctionInfo(parent, item);
 }
コード例 #11
0
 /// <summary>
 /// 
 /// </summary>
 public virtual CodeEventInfo CreateEvent(BaseInfo parent, EnvDTE80.CodeEvent item)
 {
     return new CodeEventInfo(parent, item);
 }
コード例 #12
0
 /// <summary>
 /// 
 /// </summary>
 public virtual CodeConstructorInfo CreateConstructor(BaseInfo parent, CodeFunction2 item)
 {
     return new CodeConstructorInfo(parent, item);
 }
コード例 #13
0
        /// <summary>
        /// 
        /// </summary>
        private void Set(CodeTypeRef type)
        {
            this._list = new List<TypeInfo>();
            this._rank = 0;
            this._attributes = null;
            this._classRef = null;
            this.IsVoid = false;
            this.IsEnumerable = false;
            this.IsClass = false;
            this.MethodInfolst = null;
            this.EventInfolst = null;
            this.PropertyInfolst = null;

            this.type = type;

            switch (type.TypeKind)
            {

                case vsCMTypeRef.vsCMTypeRefArray:
                case vsCMTypeRef.vsCMTypeRefCodeType:
                case vsCMTypeRef.vsCMTypeRefBool:
                case vsCMTypeRef.vsCMTypeRefByte:
                case vsCMTypeRef.vsCMTypeRefDecimal:
                case vsCMTypeRef.vsCMTypeRefDouble:
                case vsCMTypeRef.vsCMTypeRefFloat:
                case vsCMTypeRef.vsCMTypeRefInt:
                case vsCMTypeRef.vsCMTypeRefLong:
                case vsCMTypeRef.vsCMTypeRefShort:
                case vsCMTypeRef.vsCMTypeRefVariant:
                case vsCMTypeRef.vsCMTypeRefChar:
                case vsCMTypeRef.vsCMTypeRefString:
                    Name = type.AsString;
                    break;

                case vsCMTypeRef.vsCMTypeRefVoid:
                    Name = "void";
                    break;

                case vsCMTypeRef.vsCMTypeRefOther:
                case vsCMTypeRef.vsCMTypeRefPointer:
                case vsCMTypeRef.vsCMTypeRefObject:
                    Name = type.AsFullName;
                    break;

            }

            this.KindType = type.TypeKind.ToString().Substring(11);

            if (!(this.IsVoid = (type.TypeKind == vsCMTypeRef.vsCMTypeRefVoid)))
            {

                this.IsClass = (type.TypeKind == vsCMTypeRef.vsCMTypeRefCodeType) || type.TypeKind == vsCMTypeRef.vsCMTypeRefString;

                if (!this.IsClass && type.TypeKind == vsCMTypeRef.vsCMTypeRefArray)
                    this.IsClass = (type.Rank > 0 && type.ElementType.TypeKind == vsCMTypeRef.vsCMTypeRefCodeType);

                else if (!this.IsClass && type.TypeKind != vsCMTypeRef.vsCMTypeRefOther)
                    this.IsEnumerable = type.CodeType.get_IsDerivedFrom(typeof(System.Collections.IEnumerable).FullName);

                if (type.TypeKind == vsCMTypeRef.vsCMTypeRefCodeType)
                    if (type.CodeType.InfoLocation != vsCMInfoLocation.vsCMInfoLocationExternal)
                        this.project = this.type.CodeType.ProjectItem.ContainingProject;

            }

            int i = 0;
            Parse(Name, this, ref i);
            DispatchType();
            OnCreated();

            /*
                vsCMTypeRefOther,
                vsCMTypeRefCodeType,
                vsCMTypeRefArray,
                vsCMTypeRefVoid,
                vsCMTypeRefPointer,
                vsCMTypeRefString,
                vsCMTypeRefObject,
                vsCMTypeRefByte,
                vsCMTypeRefChar,
                vsCMTypeRefShort,
                vsCMTypeRefInt,
                vsCMTypeRefLong,
                vsCMTypeRefFloat,
                vsCMTypeRefDouble,
                vsCMTypeRefDecimal,
                vsCMTypeRefBool,
                vsCMTypeRefVariant
            */
        }
コード例 #14
0
 /// <summary>
 /// 
 /// </summary>
 public CodeMemberInfo(BaseInfo parent, CodeElement2 item)
     : base(parent, item)
 {
     Parent = parent;
 }