コード例 #1
0
        public static IEnumerable <Member> GetMembers(this CodeModule module, vbext_ProcKind?procedureKind = null)
        {
            var currentLine = module.CountOfDeclarationLines + 1;

            while (currentLine < module.CountOfLines)
            {
                vbext_ProcKind kind;
                var            name = module.get_ProcOfLine(currentLine, out kind);

                if ((procedureKind ?? kind) == kind)
                {
                    var startLine = module.get_ProcStartLine(name, kind);
                    var lineCount = module.get_ProcCountLines(name, kind);

                    var body = module.Lines[startLine, lineCount].Split('\n');

                    Member member;
                    if (Member.TryParse(body, new QualifiedModuleName(module.Parent), out member))
                    {
                        yield return(member);

                        currentLine = startLine + lineCount;
                    }
                    else
                    {
                        currentLine = currentLine + 1;
                    }
                }
            }
        }
コード例 #2
0
        public IEnumerable <Member> GetMembers()
        {
            var currentLine = _module.CountOfDeclarationLines + 1;

            while (currentLine < _module.CountOfLines)
            {
                vbext_ProcKind kind;
                var            name = _module.get_ProcOfLine(currentLine, out kind);

                var startLine = _module.get_ProcStartLine(name, kind);
                var lineCount = _module.get_ProcCountLines(name, kind);

                var body = _module.Lines[startLine, lineCount].Split('\n');

                Member member;
                if (Member.TryParse(body, _module.Parent.Collection.Parent.Name, _module.Parent.Name, out member))
                {
                    yield return(member);

                    currentLine = startLine + lineCount;
                }
            }
        }
コード例 #3
0
 public int get_ProcStartLine(string ProcName, Microsoft.Vbe.Interop.vbext_ProcKind ProcKind)
 {
     return(_codeModule.get_ProcStartLine(ProcName, ProcKind));
 }