Help Favorites

S

SurturZ

Hi All,

One disappointment in VS2008 is that Microsoft has not improved the
'favorites' section of the help browser.

Specifically, an ability to organise favorites in folders, and to sort them
by name would be nice.

I'm hoping these features are already there and someone here can enlighten
me on how to use them, but if they aren't, is there a back door way to access
the help favorites and at least sort them via windows explorer or somesuch?
 
S

SurturZ

I worked it out!
------------------

Imports System.Xml

Module modMain

Sub Main()
'sorts help favorites in VS Help
'C:\Documents and Settings\dstreeter\Application
Data\Microsoft\VisualStudio\9.0\VS Help Data
Dim strAppDataBasePath As String =
My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData
strAppDataBasePath = Left(strAppDataBasePath,
InStr(strAppDataBasePath, "Application Data\") + 16)

Dim strFilename As String = strAppDataBasePath &
"\Microsoft\VisualStudio\9.0\VS Help Data\Favorites.xml"
Dim strOutputFilename As String = strAppDataBasePath &
"\Microsoft\VisualStudio\9.0\VS Help Data\FavoritesNew.xml"

Dim strXML As String = My.Computer.FileSystem.ReadAllText(strFilename)
Dim xdc As New XmlDocument
xdc.LoadXml(strXML)
Dim xndTopics As XmlNode = xdc.ChildNodes(1).ChildNodes(0)
If xndTopics.Name <> "FavoriteTopics" Then
Console.WriteLine("Bad file: " & strFilename)
GoTo EndProg
End If
'bubble sort
For outer As Integer = xndTopics.ChildNodes.Count - 2 To 0 Step -1
Dim intSwaps As Integer = 0
For inner As Integer = 0 To outer
If
xndTopics.ChildNodes(inner).ChildNodes(0).ChildNodes(0).Value >
xndTopics.ChildNodes(inner + 1).ChildNodes(0).ChildNodes(0).Value Then
Dim xnd As XmlNode =
xndTopics.ChildNodes(inner).CloneNode(True)
xndTopics.ReplaceChild(xndTopics.ChildNodes(inner +
1).CloneNode(True), xndTopics.ChildNodes(inner))
xndTopics.ReplaceChild(xnd, xndTopics.ChildNodes(inner +
1))
intSwaps += 1
End If
Next inner
If intSwaps = 0 Then Exit For
Next outer

On Error Resume Next
Kill(strOutputFilename)
On Error GoTo 0
xdc.Save(strOutputFilename)
Console.WriteLine("Sorted file saved as " & strOutputFilename)
EndProg:
Console.ReadKey()
End Sub

End Module
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top