Пример #1
0
 protected ClassElement()
 {
     Namespace = new Namespace();
     Functions = new List<Function>();
     Properties = new List<Property>();
     Events = new List<Event>();
     InterfaceBases = new List<Interface>();
 }
Пример #2
0
        private void ParseClass(CodeClass2 codeClass, List<Namespace> usings, Namespace @namespace, string currentFile)
        {
            WriteLine("ParseClass" + " " + codeClass.Name);
            var @class = Classes.Find(c => c.Name == codeClass.Name) ??
                         new Class { Namespace = @namespace, Name = codeClass.Name, Usings = usings };
            @class.Files.Add(currentFile);
            foreach (CodeAttribute2 codeElement in codeClass.Attributes)
            {
                ParseAttribute(codeElement, @class, currentFile);
            }

            foreach (var element in codeClass.Members.Cast<CodeElement2>())
            {
                switch (element.Kind)
                {
                    case vsCMElement.vsCMElementFunction:
                        var function = ParseFunction((CodeFunction2)element, currentFile);
                        @class.Functions.Add(function);
                        break;
                    case vsCMElement.vsCMElementProperty:
                        var property = ParseProperty((CodeProperty)element, currentFile);
                        @class.Properties.Add(property);
                        break;
                    case vsCMElement.vsCMElementEvent:
                        var @event = ParseEvent((CodeEvent)element, currentFile);
                        @class.Events.Add(@event);
                        break;
                    case vsCMElement.vsCMElementVariable:
                        var field = ParseField((CodeVariable2) element, currentFile);
                        @class.Fields.Add(field);
                        break;
                }
            }
            Classes.Add(@class);
            
        }
Пример #3
0
        private void ParseInterface(CodeInterface2 codeInterface, List<Namespace> usings, Namespace @namespace, string currentFile)
        {
            WriteLine("ParseInterface" + " " + codeInterface.Name);
            
            var @interface = new Interface { Namespace = @namespace, Name = codeInterface.Name, Usings = usings, Type = codeInterface.Name, FileName = currentFile};
            foreach (CodeAttribute2 codeElement in codeInterface.Attributes)
            {
                ParseAttribute(codeElement, @interface, currentFile);
            }

            foreach (var element in codeInterface.Members.Cast<CodeElement2>())
            {
                switch (element.Kind)
                {
                    case vsCMElement.vsCMElementFunction:
                        var function = ParseFunction((CodeFunction2)element, currentFile);
                        @interface.Functions.Add(function);
                        break;
                    case vsCMElement.vsCMElementProperty:
                        var property = ParseProperty((CodeProperty) element, currentFile);
                        @interface.Properties.Add(property); 
                        break;
                    case vsCMElement.vsCMElementEvent:
                        var @event = ParseEvent((CodeEvent) element, currentFile);
                        @interface.Events.Add(@event);
                        break;
                }
            }


            var interfaces = GetUnResolvedInterfaces(codeInterface);
            if (interfaces.Count > 0)
            {
                unresolvedInterfaces.Add(@interface, interfaces);
            }
            Interfaces.Add(@interface);
        }
Пример #4
0
        private void ParseNameSpace(CodeNamespace codeNamespace, List<Namespace> usings, string currentFile)
        {
            var @namespace = new Namespace { Name = codeNamespace.Name };
            WriteLine("ParseNameSpace" + codeNamespace.Name);

            foreach (var element in codeNamespace.Members.Cast<CodeElement2>())
            {
                switch (element.Kind)
                {
                    case vsCMElement.vsCMElementInterface:
                        ParseInterface((CodeInterface2)element, usings, @namespace, currentFile);
                        break;
                    case vsCMElement.vsCMElementClass:
                        ParseClass((CodeClass2)element, usings, @namespace, currentFile);
                        break;
                }
            }
        }