Click here to Skip to main content
15,895,084 members
Articles / Web Development / HTML

Building a Shared Code Library as a VS.NET Plug-in

Rate me:
Please Sign up or sign in to vote.
4.00/5 (7 votes)
30 Mar 20055 min read 89.2K   594   41  
A plug-in for VS.NET that stores code snippets in a database. From the plug-in you can add code, search the database for code snippets. Also includes examples on how to integrate with the IDE as a plug-in.
'Imports SourceSafeTypeLib

'' need to;

'' add user permissions gotten from the local machine
'' allow user to set the project they are working with - read from project file?
'' add logging of what is done
'' need some way of determining that we are in the right project

''functions required ;
''checkin ALL - DONE
''getlatest version of all files - DONE, needs to utilise the ask dialog though,
''check out all - DONE
''label Project - DONE

''Check out assemblyinfo.vb
''CheckIn assemblyinfo.vb


'Public Class clsVSSManager

'    Private pSourceSafePath As String
'    Private vssDatabase As SourceSafeTypeLib.VSSDatabase
'    Private pDepthCount As Integer

'    Public Enum VSSBulkOperationType
'        GetAll = 0
'        CheckIn = 1
'        CheckOut = 2
'    End Enum

'    Private pRunOperationType As VSSBulkOperationType
'    Public Property RunOperationType() As VSSBulkOperationType
'        Get
'            Return pRunOperationType
'        End Get
'        Set(ByVal Value As VSSBulkOperationType)
'            pRunOperationType = Value
'        End Set
'    End Property

'    Public Property vssDB() As SourceSafeTypeLib.VSSDatabase
'        Get
'            Return vssDatabase
'        End Get
'        Set(ByVal Value As SourceSafeTypeLib.VSSDatabase)
'            vssDatabase = Value
'        End Set
'    End Property

'    Public Property DepthCount()
'        Get
'            Return pDepthCount
'        End Get
'        Set(ByVal Value)
'            pDepthCount = Value
'        End Set
'    End Property

'    Public Property SourceSafePath()
'        Get
'            Return pSourceSafePath
'        End Get
'        Set(ByVal Value)
'            pSourceSafePath = Value
'        End Set
'    End Property

'    Public Property CurrentProject()
'        Get
'            Return vssDatabase.CurrentProject
'        End Get
'        Set(ByVal Value)
'            vssDatabase.CurrentProject = Value
'        End Set
'    End Property

'    Public Sub OpenDatabase()
'        If vssDatabase Is Nothing Then
'            vssDatabase = New SourceSafeTypeLib.VSSDatabase
'            MsgBox(vssDatabase.SrcSafeIni)
'            vssDatabase.Open(pSourceSafePath)
'        End If
'    End Sub

'    Public Sub LabelProject(ByVal labeltext As String)

'        If Not vssDatabase Is Nothing Then
'            Dim anItem As SourceSafeTypeLib.VSSItem
'            anItem = vssDatabase.VSSItem(vssDatabase.CurrentProject)
'            anItem.Label(labeltext)
'        End If
'    End Sub

'    Public Sub IterateAllItems()
'        If Not vssDatabase Is Nothing Then
'            pDepthCount = 0
'            Dim anItem As SourceSafeTypeLib.VSSItem
'            anItem = vssDatabase.VSSItem(vssDatabase.CurrentProject)
'            PreIteration(anItem)        ' call helper functions here
'            IterateItems(anItem, pDepthCount)
'        End If
'    End Sub

'    Protected Sub PreIteration(ByVal ItemsCol As VSSItem)

'    End Sub

'    Protected Sub ProcessProjectItem(ByVal ItemsCol As VSSItem)

'    End Sub

'    Protected Sub ProcessFileItem(ByVal ItemsCol As VSSItem)
'        If pRunOperationType = VSSBulkOperationType.GetAll Then
'            If ItemsCol.IsDifferent Then

'                Dim strWorkingFolder As String = ItemsCol.Parent.LocalSpec & "\" & ItemsCol.Name
'                If strWorkingFolder = "" Then
'                    MsgBox("You must set a working folder for this file before it can be gotten.")
'                Else
'                    ' Get the file, but this should really ask before replacing the files local!
'                    ItemsCol.Get(strWorkingFolder, SourceSafeTypeLib.VSSFlags.VSSFLAG_REPREPLACE)
'                End If
'            End If
'        ElseIf pRunOperationType = VSSBulkOperationType.CheckIn Then
'            If (ItemsCol.IsCheckedOut = SourceSafeTypeLib.VSSFileStatus.VSSFILE_CHECKEDOUT_ME) Then
'                Dim strWorkingFolder As String = ItemsCol.LocalSpec
'                If strWorkingFolder = "" Then
'                    MsgBox("No working folder is set for this project.")
'                    Exit Sub
'                Else
'                    Try
'                        ItemsCol.Checkin("Automated Check In From CodeManager")
'                    Catch
'                        ' log the result
'                    End Try
'                End If
'            End If
'        ElseIf pRunOperationType = VSSBulkOperationType.CheckOut Then
'            ItemsCol.Checkout()
'        End If
'    End Sub

'    Private Sub IterateItems(ByVal ItemsCol As VSSItem, ByVal DepthCount As Integer)
'        Dim asubItem As SourceSafeTypeLib.VSSItem
'        For Each asubItem In ItemsCol.Items
'            If asubItem.Type = 0 Then 'its a project
'                ProcessProjectItem(asubItem)
'                pDepthCount = pDepthCount + 1
'                IterateItems(asubItem, DepthCount)
'                pDepthCount = pDepthCount - 1
'            ElseIf asubItem.Type = 1 Then
'                ProcessFileItem(asubItem)
'            End If
'        Next
'    End Sub

'    Public Function FindProject(ByVal ProjectName As String) As Boolean

'    End Function


'End Class


By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Thailand Thailand
Spent my whole life developing, having worked in C++, Delphi, ASP, then finally settling down to working solely in ASP.Net. Also a forex day trader.

Comments and Discussions