Click here to Skip to main content
15,889,116 members
Articles / Programming Languages / Visual Basic

Visual SourceSafe Journal Monitor Service

Rate me:
Please Sign up or sign in to vote.
4.94/5 (12 votes)
27 Jan 200412 min read 152.1K   853   59  
VMS is a windows service developed in .Net that monitors a Microsoft Visual SourceSafe (VSS) database. Customized alerts may be sent based on the defined filters.
'------------------------------------------------------------------------------
' <autogenerated>
'     This code was generated by a tool.
'     Runtime Version: 1.1.4322.573
'
'     Changes to this file may cause incorrect behavior and will be lost if 
'     the code is regenerated.
' </autogenerated>
'------------------------------------------------------------------------------

Option Strict Off
Option Explicit On

Imports System
Imports System.Data
Imports System.Runtime.Serialization
Imports System.Xml


<Serializable(),  _
 System.ComponentModel.DesignerCategoryAttribute("code"),  _
 System.Diagnostics.DebuggerStepThrough(),  _
 System.ComponentModel.ToolboxItem(true)>  _
Public Class EntryData
    Inherits DataSet
    
    Private tableEntries As EntriesDataTable
    
    Public Sub New()
        MyBase.New
        Me.InitClass
        Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged
        AddHandler Me.Tables.CollectionChanged, schemaChangedHandler
        AddHandler Me.Relations.CollectionChanged, schemaChangedHandler
    End Sub
    
    Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext)
        MyBase.New
        Dim strSchema As String = CType(info.GetValue("XmlSchema", GetType(System.String)),String)
        If (Not (strSchema) Is Nothing) Then
            Dim ds As DataSet = New DataSet
            ds.ReadXmlSchema(New XmlTextReader(New System.IO.StringReader(strSchema)))
            If (Not (ds.Tables("Entries")) Is Nothing) Then
                Me.Tables.Add(New EntriesDataTable(ds.Tables("Entries")))
            End If
            Me.DataSetName = ds.DataSetName
            Me.Prefix = ds.Prefix
            Me.Namespace = ds.Namespace
            Me.Locale = ds.Locale
            Me.CaseSensitive = ds.CaseSensitive
            Me.EnforceConstraints = ds.EnforceConstraints
            Me.Merge(ds, false, System.Data.MissingSchemaAction.Add)
            Me.InitVars
        Else
            Me.InitClass
        End If
        Me.GetSerializationData(info, context)
        Dim schemaChangedHandler As System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged
        AddHandler Me.Tables.CollectionChanged, schemaChangedHandler
        AddHandler Me.Relations.CollectionChanged, schemaChangedHandler
    End Sub
    
    <System.ComponentModel.Browsable(false),  _
     System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)>  _
    Public ReadOnly Property Entries As EntriesDataTable
        Get
            Return Me.tableEntries
        End Get
    End Property
    
    Public Overrides Function Clone() As DataSet
        Dim cln As EntryData = CType(MyBase.Clone,EntryData)
        cln.InitVars
        Return cln
    End Function
    
    Protected Overrides Function ShouldSerializeTables() As Boolean
        Return false
    End Function
    
    Protected Overrides Function ShouldSerializeRelations() As Boolean
        Return false
    End Function
    
    Protected Overrides Sub ReadXmlSerializable(ByVal reader As XmlReader)
        Me.Reset
        Dim ds As DataSet = New DataSet
        ds.ReadXml(reader)
        If (Not (ds.Tables("Entries")) Is Nothing) Then
            Me.Tables.Add(New EntriesDataTable(ds.Tables("Entries")))
        End If
        Me.DataSetName = ds.DataSetName
        Me.Prefix = ds.Prefix
        Me.Namespace = ds.Namespace
        Me.Locale = ds.Locale
        Me.CaseSensitive = ds.CaseSensitive
        Me.EnforceConstraints = ds.EnforceConstraints
        Me.Merge(ds, false, System.Data.MissingSchemaAction.Add)
        Me.InitVars
    End Sub
    
    Protected Overrides Function GetSchemaSerializable() As System.Xml.Schema.XmlSchema
        Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream
        Me.WriteXmlSchema(New XmlTextWriter(stream, Nothing))
        stream.Position = 0
        Return System.Xml.Schema.XmlSchema.Read(New XmlTextReader(stream), Nothing)
    End Function
    
    Friend Sub InitVars()
        Me.tableEntries = CType(Me.Tables("Entries"),EntriesDataTable)
        If (Not (Me.tableEntries) Is Nothing) Then
            Me.tableEntries.InitVars
        End If
    End Sub
    
    Private Sub InitClass()
        Me.DataSetName = "EntryData"
        Me.Prefix = ""
        Me.Namespace = ""
        Me.Locale = New System.Globalization.CultureInfo("en-US")
        Me.CaseSensitive = false
        Me.EnforceConstraints = true
        Me.tableEntries = New EntriesDataTable
        Me.Tables.Add(Me.tableEntries)
    End Sub
    
    Private Function ShouldSerializeEntries() As Boolean
        Return false
    End Function
    
    Private Sub SchemaChanged(ByVal sender As Object, ByVal e As System.ComponentModel.CollectionChangeEventArgs)
        If (e.Action = System.ComponentModel.CollectionChangeAction.Remove) Then
            Me.InitVars
        End If
    End Sub
    
    Public Delegate Sub EntriesRowChangeEventHandler(ByVal sender As Object, ByVal e As EntriesRowChangeEvent)
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class EntriesDataTable
        Inherits DataTable
        Implements System.Collections.IEnumerable
        
        Private columnLogged As DataColumn
        
        Private column_Date As DataColumn
        
        Private columnPath As DataColumn
        
        Private columnVersion As DataColumn
        
        Private columnAction As DataColumn
        
        Private columnUser As DataColumn
        
        Private column_Event As DataColumn
        
        Private columnComment As DataColumn
        
        Friend Sub New()
            MyBase.New("Entries")
            Me.InitClass
        End Sub
        
        Friend Sub New(ByVal table As DataTable)
            MyBase.New(table.TableName)
            If (table.CaseSensitive <> table.DataSet.CaseSensitive) Then
                Me.CaseSensitive = table.CaseSensitive
            End If
            If (table.Locale.ToString <> table.DataSet.Locale.ToString) Then
                Me.Locale = table.Locale
            End If
            If (table.Namespace <> table.DataSet.Namespace) Then
                Me.Namespace = table.Namespace
            End If
            Me.Prefix = table.Prefix
            Me.MinimumCapacity = table.MinimumCapacity
            Me.DisplayExpression = table.DisplayExpression
        End Sub
        
        <System.ComponentModel.Browsable(false)>  _
        Public ReadOnly Property Count As Integer
            Get
                Return Me.Rows.Count
            End Get
        End Property
        
        Friend ReadOnly Property LoggedColumn As DataColumn
            Get
                Return Me.columnLogged
            End Get
        End Property
        
        Friend ReadOnly Property _DateColumn As DataColumn
            Get
                Return Me.column_Date
            End Get
        End Property
        
        Friend ReadOnly Property PathColumn As DataColumn
            Get
                Return Me.columnPath
            End Get
        End Property
        
        Friend ReadOnly Property VersionColumn As DataColumn
            Get
                Return Me.columnVersion
            End Get
        End Property
        
        Friend ReadOnly Property ActionColumn As DataColumn
            Get
                Return Me.columnAction
            End Get
        End Property
        
        Friend ReadOnly Property UserColumn As DataColumn
            Get
                Return Me.columnUser
            End Get
        End Property
        
        Friend ReadOnly Property _EventColumn As DataColumn
            Get
                Return Me.column_Event
            End Get
        End Property
        
        Friend ReadOnly Property CommentColumn As DataColumn
            Get
                Return Me.columnComment
            End Get
        End Property
        
        Public Default ReadOnly Property Item(ByVal index As Integer) As EntriesRow
            Get
                Return CType(Me.Rows(index),EntriesRow)
            End Get
        End Property
        
        Public Event EntriesRowChanged As EntriesRowChangeEventHandler
        
        Public Event EntriesRowChanging As EntriesRowChangeEventHandler
        
        Public Event EntriesRowDeleted As EntriesRowChangeEventHandler
        
        Public Event EntriesRowDeleting As EntriesRowChangeEventHandler
        
        Public Overloads Sub AddEntriesRow(ByVal row As EntriesRow)
            Me.Rows.Add(row)
        End Sub
        
        Public Overloads Function AddEntriesRow(ByVal Logged As Date, ByVal _Date As Date, ByVal Path As String, ByVal Version As Integer, ByVal Action As String, ByVal User As String, ByVal _Event As String, ByVal Comment As String) As EntriesRow
            Dim rowEntriesRow As EntriesRow = CType(Me.NewRow,EntriesRow)
            rowEntriesRow.ItemArray = New Object() {Logged, _Date, Path, Version, Action, User, _Event, Comment}
            Me.Rows.Add(rowEntriesRow)
            Return rowEntriesRow
        End Function
        
        Public Function FindBy_DatePathVersionAction(ByVal _Date As Date, ByVal Path As String, ByVal Version As Integer, ByVal Action As String) As EntriesRow
            Return CType(Me.Rows.Find(New Object() {_Date, Path, Version, Action}),EntriesRow)
        End Function
        
        Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
            Return Me.Rows.GetEnumerator
        End Function
        
        Public Overrides Function Clone() As DataTable
            Dim cln As EntriesDataTable = CType(MyBase.Clone,EntriesDataTable)
            cln.InitVars
            Return cln
        End Function
        
        Protected Overrides Function CreateInstance() As DataTable
            Return New EntriesDataTable
        End Function
        
        Friend Sub InitVars()
            Me.columnLogged = Me.Columns("Logged")
            Me.column_Date = Me.Columns("Date")
            Me.columnPath = Me.Columns("Path")
            Me.columnVersion = Me.Columns("Version")
            Me.columnAction = Me.Columns("Action")
            Me.columnUser = Me.Columns("User")
            Me.column_Event = Me.Columns("Event")
            Me.columnComment = Me.Columns("Comment")
        End Sub
        
        Private Sub InitClass()
            Me.columnLogged = New DataColumn("Logged", GetType(System.DateTime), Nothing, System.Data.MappingType.Attribute)
            Me.Columns.Add(Me.columnLogged)
            Me.column_Date = New DataColumn("Date", GetType(System.DateTime), Nothing, System.Data.MappingType.Attribute)
            Me.Columns.Add(Me.column_Date)
            Me.columnPath = New DataColumn("Path", GetType(System.String), Nothing, System.Data.MappingType.Attribute)
            Me.Columns.Add(Me.columnPath)
            Me.columnVersion = New DataColumn("Version", GetType(System.Int32), Nothing, System.Data.MappingType.Attribute)
            Me.Columns.Add(Me.columnVersion)
            Me.columnAction = New DataColumn("Action", GetType(System.String), Nothing, System.Data.MappingType.Attribute)
            Me.Columns.Add(Me.columnAction)
            Me.columnUser = New DataColumn("User", GetType(System.String), Nothing, System.Data.MappingType.Attribute)
            Me.Columns.Add(Me.columnUser)
            Me.column_Event = New DataColumn("Event", GetType(System.String), Nothing, System.Data.MappingType.Attribute)
            Me.Columns.Add(Me.column_Event)
            Me.columnComment = New DataColumn("Comment", GetType(System.String), Nothing, System.Data.MappingType.Attribute)
            Me.Columns.Add(Me.columnComment)
            Me.Constraints.Add(New UniqueConstraint("EntryDataKey", New DataColumn() {Me.column_Date, Me.columnPath, Me.columnVersion, Me.columnAction}, true))
            Me.columnLogged.Namespace = ""
            Me.column_Date.AllowDBNull = false
            Me.column_Date.Namespace = ""
            Me.columnPath.AllowDBNull = false
            Me.columnPath.Namespace = ""
            Me.columnVersion.AllowDBNull = false
            Me.columnVersion.Namespace = ""
            Me.columnAction.AllowDBNull = false
            Me.columnAction.Namespace = ""
            Me.columnUser.Namespace = ""
            Me.column_Event.Namespace = ""
            Me.columnComment.Namespace = ""
        End Sub
        
        Public Function NewEntriesRow() As EntriesRow
            Return CType(Me.NewRow,EntriesRow)
        End Function
        
        Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
            Return New EntriesRow(builder)
        End Function
        
        Protected Overrides Function GetRowType() As System.Type
            Return GetType(EntriesRow)
        End Function
        
        Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanged(e)
            If (Not (Me.EntriesRowChangedEvent) Is Nothing) Then
                RaiseEvent EntriesRowChanged(Me, New EntriesRowChangeEvent(CType(e.Row,EntriesRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanging(e)
            If (Not (Me.EntriesRowChangingEvent) Is Nothing) Then
                RaiseEvent EntriesRowChanging(Me, New EntriesRowChangeEvent(CType(e.Row,EntriesRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleted(e)
            If (Not (Me.EntriesRowDeletedEvent) Is Nothing) Then
                RaiseEvent EntriesRowDeleted(Me, New EntriesRowChangeEvent(CType(e.Row,EntriesRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleting(e)
            If (Not (Me.EntriesRowDeletingEvent) Is Nothing) Then
                RaiseEvent EntriesRowDeleting(Me, New EntriesRowChangeEvent(CType(e.Row,EntriesRow), e.Action))
            End If
        End Sub
        
        Public Sub RemoveEntriesRow(ByVal row As EntriesRow)
            Me.Rows.Remove(row)
        End Sub
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class EntriesRow
        Inherits DataRow
        
        Private tableEntries As EntriesDataTable
        
        Friend Sub New(ByVal rb As DataRowBuilder)
            MyBase.New(rb)
            Me.tableEntries = CType(Me.Table,EntriesDataTable)
        End Sub
        
        Public Property Logged As Date
            Get
                Try 
                    Return CType(Me(Me.tableEntries.LoggedColumn),Date)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tableEntries.LoggedColumn) = value
            End Set
        End Property
        
        Public Property _Date As Date
            Get
                Return CType(Me(Me.tableEntries._DateColumn),Date)
            End Get
            Set
                Me(Me.tableEntries._DateColumn) = value
            End Set
        End Property
        
        Public Property Path As String
            Get
                Return CType(Me(Me.tableEntries.PathColumn),String)
            End Get
            Set
                Me(Me.tableEntries.PathColumn) = value
            End Set
        End Property
        
        Public Property Version As Integer
            Get
                Return CType(Me(Me.tableEntries.VersionColumn),Integer)
            End Get
            Set
                Me(Me.tableEntries.VersionColumn) = value
            End Set
        End Property
        
        Public Property Action As String
            Get
                Return CType(Me(Me.tableEntries.ActionColumn),String)
            End Get
            Set
                Me(Me.tableEntries.ActionColumn) = value
            End Set
        End Property
        
        Public Property User As String
            Get
                Try 
                    Return CType(Me(Me.tableEntries.UserColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tableEntries.UserColumn) = value
            End Set
        End Property
        
        Public Property _Event As String
            Get
                Try 
                    Return CType(Me(Me.tableEntries._EventColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tableEntries._EventColumn) = value
            End Set
        End Property
        
        Public Property Comment As String
            Get
                Try 
                    Return CType(Me(Me.tableEntries.CommentColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tableEntries.CommentColumn) = value
            End Set
        End Property
        
        Public Function IsLoggedNull() As Boolean
            Return Me.IsNull(Me.tableEntries.LoggedColumn)
        End Function
        
        Public Sub SetLoggedNull()
            Me(Me.tableEntries.LoggedColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsUserNull() As Boolean
            Return Me.IsNull(Me.tableEntries.UserColumn)
        End Function
        
        Public Sub SetUserNull()
            Me(Me.tableEntries.UserColumn) = System.Convert.DBNull
        End Sub
        
        Public Function Is_EventNull() As Boolean
            Return Me.IsNull(Me.tableEntries._EventColumn)
        End Function
        
        Public Sub Set_EventNull()
            Me(Me.tableEntries._EventColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsCommentNull() As Boolean
            Return Me.IsNull(Me.tableEntries.CommentColumn)
        End Function
        
        Public Sub SetCommentNull()
            Me(Me.tableEntries.CommentColumn) = System.Convert.DBNull
        End Sub
    End Class
    
    <System.Diagnostics.DebuggerStepThrough()>  _
    Public Class EntriesRowChangeEvent
        Inherits EventArgs
        
        Private eventRow As EntriesRow
        
        Private eventAction As DataRowAction
        
        Public Sub New(ByVal row As EntriesRow, ByVal action As DataRowAction)
            MyBase.New
            Me.eventRow = row
            Me.eventAction = action
        End Sub
        
        Public ReadOnly Property Row As EntriesRow
            Get
                Return Me.eventRow
            End Get
        End Property
        
        Public ReadOnly Property Action As DataRowAction
            Get
                Return Me.eventAction
            End Get
        End Property
    End Class
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
United States United States
If you got this far, you are probably interested in who exactly I am and are eager to pick some knowledge out of my head.

I am a programmer - no doubt. I grew up with an Atari 400 using BASIC and PILOT and saving my programs to a casset tape. Over the years, I would rush to the library looking for books with source code of computer games in them that I could create with basic. After long hours of coding, I would save, then load, and then spend the next few days figuring out where I made a mistake - and even the book for that matter! What I'm trying to say is, you got to learn by doing. Don't give up, and always get help from someone else - wether it be source code, a book, or actually communicating with them on a one-on-one relationship.

I'll admit it - I'm a book worm. I have a shelf full of red books (if you know what I mean), and tons of other shelves of other books. I can't recommend just one, but I have found that Wrox is the best for me. After that, I have O'Reilly and Sams in third.

As far as source code goes, I have my own personal site with source code (and lots of working demos), and other sites that I post code to.

Ok, so we are down to contact info. I have ICQ. If you need the number it is 364308. Pretty low eh? I've been a die hard at this computer stuff for years on end. I even ran my own BBS and was a SysOp on many other BBS's in the Pittsburgh area when the Internet was still known as a toy called "the information super highway".

Ok, I'll close with that and let you go on your way. If you see my code - please vote. If it is bad, put up some feedback letting me know. And if you want to see more to me then just code (I'm an artist too), then just visit my web site.

Comments and Discussions