Может, кому время сэкономит.
Макро скриптик для Visual Studio, который выдирает из Class View все глобальные переменные открытого solution и пишет их в новое текстовое окно. За неимением денег на анализаторы...
Доступ есть ко всем элементам, так что можно программно считать классы, пересчитывать их методы и пр., если есть охота и VisualStudio.
Возможно, я изобрел велосипед. Тогда просьба поделиться информацией.
Макро скриптик для Visual Studio, который выдирает из Class View все глобальные переменные открытого solution и пишет их в новое текстовое окно. За неимением денег на анализаторы...
Доступ есть ко всем элементам, так что можно программно считать классы, пересчитывать их методы и пр., если есть охота и VisualStudio.
Sub BrowseGlobals()
On Error Resume Next
Dim projectCount As Integer
projectCount = 0
Dim objTextDoc As TextDocument
Dim objEP As EditPoint
'Create a new text document.
Call DTE.ItemOperations.NewFile("General\Text File")
'Get a handle to the new document.
objTextDoc = DTE.ActiveDocument.Object("TextDocument" )
objEP = objTextDoc.StartPoint.CreateEditPoint
'Create an EditPoint and add some text.
objEP.Insert("==Global variable list==" & Chr(13))
Dim sol As Solution
sol = DTE.Solution
objEP.Insert("Solution: ")
objEP.Insert(sol.FullName() & Chr(13))
Dim prj As Project
For Each prj In sol.Projects
'prj = sol.Projects.Item(1)
projectCount = projectCount + 1
'objEP.Insert(Chr(13) & projectCount.ToString() & ": Project: ")
'objEP.Insert(prj.Name() & Chr(13))
Dim cm As CodeModel
cm = prj.CodeModel
Dim ce As CodeElement
For Each ce In cm.CodeElements
If ce.Kind = vsCMElement.vsCMElementVariable Then
Dim cv As CodeVariable
cv = ce
objEP.Insert(cv.Type.AsString & " " & ce.FullName() & ", " & prj.Name() & ", ")
Dim prjitem As ProjectItem
prjitem = ce.ProjectItem
If Not prjitem Is Nothing Then
objEP.Insert(prjitem.FileNames(1) & Chr(13))
End If
End If
Next
Next
objEP.Insert(Chr(13) & "Total projects: " & projectCount.ToString())
End Sub
On Error Resume Next
Dim projectCount As Integer
projectCount = 0
Dim objTextDoc As TextDocument
Dim objEP As EditPoint
'Create a new text document.
Call DTE.ItemOperations.NewFile("General\Text File")
'Get a handle to the new document.
objTextDoc = DTE.ActiveDocument.Object("TextDocument"
objEP = objTextDoc.StartPoint.CreateEditPoint
'Create an EditPoint and add some text.
objEP.Insert("==Global variable list==" & Chr(13))
Dim sol As Solution
sol = DTE.Solution
objEP.Insert("Solution: ")
objEP.Insert(sol.FullName() & Chr(13))
Dim prj As Project
For Each prj In sol.Projects
'prj = sol.Projects.Item(1)
projectCount = projectCount + 1
'objEP.Insert(Chr(13) & projectCount.ToString() & ": Project: ")
'objEP.Insert(prj.Name() & Chr(13))
Dim cm As CodeModel
cm = prj.CodeModel
Dim ce As CodeElement
For Each ce In cm.CodeElements
If ce.Kind = vsCMElement.vsCMElementVariable Then
Dim cv As CodeVariable
cv = ce
objEP.Insert(cv.Type.AsString & " " & ce.FullName() & ", " & prj.Name() & ", ")
Dim prjitem As ProjectItem
prjitem = ce.ProjectItem
If Not prjitem Is Nothing Then
objEP.Insert(prjitem.FileNames(1) & Chr(13))
End If
End If
Next
Next
objEP.Insert(Chr(13) & "Total projects: " & projectCount.ToString())
End Sub
Возможно, я изобрел велосипед. Тогда просьба поделиться информацией.
