Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial

  • Loading branch information...
commit 2c65aef052fb816988e514e7413ee78fe65f504b 0 parents
@rblumenthal authored
22 .gitattributes
@@ -0,0 +1,22 @@
+# Auto detect text files and perform LF normalization
+* text=auto
+
+# Custom for Visual Studio
+*.cs diff=csharp
+*.sln merge=union
+*.csproj merge=union
+*.vbproj merge=union
+*.fsproj merge=union
+*.dbproj merge=union
+
+# Standard to msysgit
+*.doc diff=astextplain
+*.DOC diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain
163 .gitignore
@@ -0,0 +1,163 @@
+#################
+## Eclipse
+#################
+
+*.pydevproject
+.project
+.metadata
+bin/
+tmp/
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.classpath
+.settings/
+.loadpath
+
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# CDT-specific
+.cproject
+
+# PDT-specific
+.buildpath
+
+
+#################
+## Visual Studio
+#################
+
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+
+# Build results
+[Dd]ebug/
+[Rr]elease/
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.vspscc
+.builds
+*.dotCover
+
+## TODO: If you have NuGet Package Restore enabled, uncomment this
+#packages/
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+
+# Visual Studio profiler
+*.psess
+*.vsp
+
+# ReSharper is a .NET coding add-in
+_ReSharper*
+
+# Installshield output folder
+[Ee]xpress
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish
+
+# Others
+[Bb]in
+[Oo]bj
+sql
+TestResults
+*.Cache
+ClientBin
+stylecop.*
+~$*
+*.dbmdl
+Generated_Code #added for RIA/Silverlight projects
+
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+
+
+
+############
+## Windows
+############
+
+# Windows image file caches
+Thumbs.db
+
+# Folder config file
+Desktop.ini
+
+
+#############
+## Python
+#############
+
+*.py[co]
+
+# Packages
+*.egg
+*.egg-info
+dist
+build
+eggs
+parts
+bin
+var
+sdist
+develop-eggs
+.installed.cfg
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.tox
+
+#Translations
+*.mo
+
+#Mr Developer
+.mr.developer.cfg
+
+# Mac crap
+.DS_Store
39 App.config
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <configSections>
+ <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
+ <section name="EventLogMonitor.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
+ </sectionGroup>
+ </configSections>
+ <startup>
+ <supportedRuntime version="v2.0.50727" />
+ </startup>
+ <userSettings>
+ <EventLogMonitor.My.MySettings>
+ <setting name="Servers" serializeAs="Xml">
+ <value>
+ <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
+ </value>
+ </setting>
+ <setting name="ToEmail" serializeAs="String">
+ <value />
+ </setting>
+ <setting name="FromEmail" serializeAs="String">
+ <value />
+ </setting>
+ <setting name="Interval" serializeAs="String">
+ <value />
+ </setting>
+ <setting name="SMTPServer" serializeAs="String">
+ <value />
+ </setting>
+ <setting name="IntervalLength" serializeAs="String">
+ <value />
+ </setting>
+ <setting name="DaysToScan" serializeAs="String">
+ <value>0</value>
+ </setting>
+ </EventLogMonitor.My.MySettings>
+ </userSettings>
+</configuration>
137 EventLogMonitor.vbproj
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+ <ProductVersion>
+ </ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{35CC7DC9-112B-48A5-8BA7-FA5CE65FBECA}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <StartupObject>EventLogMonitor.My.MyApplication</StartupObject>
+ <RootNamespace>EventLogMonitor</RootNamespace>
+ <AssemblyName>EventLogMonitor</AssemblyName>
+ <FileAlignment>512</FileAlignment>
+ <MyType>WindowsForms</MyType>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <DefineDebug>true</DefineDebug>
+ <DefineTrace>true</DefineTrace>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DocumentationFile>EventLogMonitor.xml</DocumentationFile>
+ <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <DefineDebug>false</DefineDebug>
+ <DefineTrace>true</DefineTrace>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DocumentationFile>EventLogMonitor.xml</DocumentationFile>
+ <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup>
+ <OptionExplicit>On</OptionExplicit>
+ </PropertyGroup>
+ <PropertyGroup>
+ <OptionCompare>Binary</OptionCompare>
+ </PropertyGroup>
+ <PropertyGroup>
+ <OptionStrict>Off</OptionStrict>
+ </PropertyGroup>
+ <PropertyGroup>
+ <OptionInfer>On</OptionInfer>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Deployment" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ </ItemGroup>
+ <ItemGroup>
+ <Import Include="Microsoft.VisualBasic" />
+ <Import Include="System" />
+ <Import Include="System.Collections" />
+ <Import Include="System.Collections.Generic" />
+ <Import Include="System.Data" />
+ <Import Include="System.Drawing" />
+ <Import Include="System.Diagnostics" />
+ <Import Include="System.Windows.Forms" />
+ <Import Include="System.Linq" />
+ <Import Include="System.Xml.Linq" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Form1.vb">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Form1.Designer.vb">
+ <DependentUpon>Form1.vb</DependentUpon>
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="My Project\AssemblyInfo.vb" />
+ <Compile Include="My Project\Application.Designer.vb">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Application.myapp</DependentUpon>
+ </Compile>
+ <Compile Include="My Project\Resources.Designer.vb">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <Compile Include="My Project\Settings.Designer.vb">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Settings.settings</DependentUpon>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ </Compile>
+ <Compile Include="Viewer.Designer.vb">
+ <DependentUpon>Viewer.vb</DependentUpon>
+ </Compile>
+ <Compile Include="Viewer.vb">
+ <SubType>Form</SubType>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Form1.resx">
+ <DependentUpon>Form1.vb</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="My Project\Resources.resx">
+ <Generator>VbMyResourcesResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.vb</LastGenOutput>
+ <CustomToolNamespace>My.Resources</CustomToolNamespace>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ <EmbeddedResource Include="Viewer.resx">
+ <DependentUpon>Viewer.vb</DependentUpon>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ <None Include="My Project\Application.myapp">
+ <Generator>MyApplicationCodeGenerator</Generator>
+ <LastGenOutput>Application.Designer.vb</LastGenOutput>
+ </None>
+ <None Include="My Project\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <CustomToolNamespace>My</CustomToolNamespace>
+ <LastGenOutput>Settings.Designer.vb</LastGenOutput>
+ </None>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
398 Form1.Designer.vb
@@ -0,0 +1,398 @@
+<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
+Partial Class Form1
+ Inherits System.Windows.Forms.Form
+
+ 'Form overrides dispose to clean up the component list.
+ <System.Diagnostics.DebuggerNonUserCode()> _
+ Protected Overrides Sub Dispose(ByVal disposing As Boolean)
+ Try
+ If disposing AndAlso components IsNot Nothing Then
+ components.Dispose()
+ End If
+ Finally
+ MyBase.Dispose(disposing)
+ End Try
+ End Sub
+
+ 'Required by the Windows Form Designer
+ Private components As System.ComponentModel.IContainer
+
+ 'NOTE: The following procedure is required by the Windows Form Designer
+ 'It can be modified using the Windows Form Designer.
+ 'Do not modify it using the code editor.
+ <System.Diagnostics.DebuggerStepThrough()> _
+ Private Sub InitializeComponent()
+ Me.components = New System.ComponentModel.Container()
+ Me.ListView1 = New System.Windows.Forms.ListView()
+ Me.btnStartStop = New System.Windows.Forms.Button()
+ Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
+ Me.ToolStripStatusLabel1 = New System.Windows.Forms.ToolStripStatusLabel()
+ Me.ToolStripStatusLabel3 = New System.Windows.Forms.ToolStripStatusLabel()
+ Me.ToolStripStatusLabel2 = New System.Windows.Forms.ToolStripStatusLabel()
+ Me.ToolStripStatusLabel4 = New System.Windows.Forms.ToolStripStatusLabel()
+ Me.ToolStripStatusLabel5 = New System.Windows.Forms.ToolStripStatusLabel()
+ Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
+ Me.txtServers = New System.Windows.Forms.TextBox()
+ Me.Label1 = New System.Windows.Forms.Label()
+ Me.txtFromEmail = New System.Windows.Forms.TextBox()
+ Me.txtToEmail = New System.Windows.Forms.TextBox()
+ Me.Label2 = New System.Windows.Forms.Label()
+ Me.Label3 = New System.Windows.Forms.Label()
+ Me.btnEdit = New System.Windows.Forms.Button()
+ Me.MenuStrip1 = New System.Windows.Forms.MenuStrip()
+ Me.ToolStripMenuItem1 = New System.Windows.Forms.ToolStripMenuItem()
+ Me.OpenViewerToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.GroupBox1 = New System.Windows.Forms.GroupBox()
+ Me.Label7 = New System.Windows.Forms.Label()
+ Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker()
+ Me.Label5 = New System.Windows.Forms.Label()
+ Me.txtDaysToScan = New System.Windows.Forms.TextBox()
+ Me.radMinutes = New System.Windows.Forms.RadioButton()
+ Me.radDays = New System.Windows.Forms.RadioButton()
+ Me.txtSMTP = New System.Windows.Forms.TextBox()
+ Me.Label6 = New System.Windows.Forms.Label()
+ Me.txtInterval = New System.Windows.Forms.TextBox()
+ Me.Label4 = New System.Windows.Forms.Label()
+ Me.Button1 = New System.Windows.Forms.Button()
+ Me.Timer2 = New System.Windows.Forms.Timer(Me.components)
+ Me.Label8 = New System.Windows.Forms.Label()
+ Me.StatusStrip1.SuspendLayout()
+ Me.MenuStrip1.SuspendLayout()
+ Me.GroupBox1.SuspendLayout()
+ Me.SuspendLayout()
+ '
+ 'ListView1
+ '
+ Me.ListView1.Location = New System.Drawing.Point(22, 39)
+ Me.ListView1.Name = "ListView1"
+ Me.ListView1.Size = New System.Drawing.Size(27, 28)
+ Me.ListView1.TabIndex = 1
+ Me.ListView1.UseCompatibleStateImageBehavior = False
+ Me.ListView1.Visible = False
+ '
+ 'btnStartStop
+ '
+ Me.btnStartStop.Location = New System.Drawing.Point(217, 291)
+ Me.btnStartStop.Name = "btnStartStop"
+ Me.btnStartStop.Size = New System.Drawing.Size(142, 23)
+ Me.btnStartStop.TabIndex = 9
+ Me.btnStartStop.Text = "Start Scheduled Scanning"
+ Me.btnStartStop.UseVisualStyleBackColor = True
+ '
+ 'StatusStrip1
+ '
+ Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripStatusLabel1, Me.ToolStripStatusLabel3, Me.ToolStripStatusLabel2, Me.ToolStripStatusLabel4, Me.ToolStripStatusLabel5})
+ Me.StatusStrip1.Location = New System.Drawing.Point(0, 324)
+ Me.StatusStrip1.Name = "StatusStrip1"
+ Me.StatusStrip1.Size = New System.Drawing.Size(579, 22)
+ Me.StatusStrip1.TabIndex = 5
+ Me.StatusStrip1.Text = "StatusStrip1"
+ '
+ 'ToolStripStatusLabel1
+ '
+ Me.ToolStripStatusLabel1.Name = "ToolStripStatusLabel1"
+ Me.ToolStripStatusLabel1.Size = New System.Drawing.Size(0, 17)
+ '
+ 'ToolStripStatusLabel3
+ '
+ Me.ToolStripStatusLabel3.Name = "ToolStripStatusLabel3"
+ Me.ToolStripStatusLabel3.Size = New System.Drawing.Size(10, 17)
+ Me.ToolStripStatusLabel3.Text = "|"
+ '
+ 'ToolStripStatusLabel2
+ '
+ Me.ToolStripStatusLabel2.Name = "ToolStripStatusLabel2"
+ Me.ToolStripStatusLabel2.Size = New System.Drawing.Size(0, 17)
+ '
+ 'ToolStripStatusLabel4
+ '
+ Me.ToolStripStatusLabel4.Name = "ToolStripStatusLabel4"
+ Me.ToolStripStatusLabel4.Size = New System.Drawing.Size(10, 17)
+ Me.ToolStripStatusLabel4.Text = "|"
+ '
+ 'ToolStripStatusLabel5
+ '
+ Me.ToolStripStatusLabel5.Name = "ToolStripStatusLabel5"
+ Me.ToolStripStatusLabel5.Size = New System.Drawing.Size(0, 17)
+ '
+ 'Timer1
+ '
+ '
+ 'txtServers
+ '
+ Me.txtServers.Location = New System.Drawing.Point(397, 43)
+ Me.txtServers.Multiline = True
+ Me.txtServers.Name = "txtServers"
+ Me.txtServers.Size = New System.Drawing.Size(139, 141)
+ Me.txtServers.TabIndex = 6
+ '
+ 'Label1
+ '
+ Me.Label1.AutoSize = True
+ Me.Label1.Location = New System.Drawing.Point(394, 22)
+ Me.Label1.Name = "Label1"
+ Me.Label1.Size = New System.Drawing.Size(119, 13)
+ Me.Label1.TabIndex = 7
+ Me.Label1.Text = "Servers being scanned:"
+ '
+ 'txtFromEmail
+ '
+ Me.txtFromEmail.Location = New System.Drawing.Point(82, 20)
+ Me.txtFromEmail.Name = "txtFromEmail"
+ Me.txtFromEmail.Size = New System.Drawing.Size(195, 20)
+ Me.txtFromEmail.TabIndex = 0
+ '
+ 'txtToEmail
+ '
+ Me.txtToEmail.Location = New System.Drawing.Point(82, 57)
+ Me.txtToEmail.Name = "txtToEmail"
+ Me.txtToEmail.Size = New System.Drawing.Size(195, 20)
+ Me.txtToEmail.TabIndex = 1
+ '
+ 'Label2
+ '
+ Me.Label2.AutoSize = True
+ Me.Label2.Location = New System.Drawing.Point(6, 23)
+ Me.Label2.Name = "Label2"
+ Me.Label2.Size = New System.Drawing.Size(60, 13)
+ Me.Label2.TabIndex = 10
+ Me.Label2.Text = "From email:"
+ '
+ 'Label3
+ '
+ Me.Label3.AutoSize = True
+ Me.Label3.Location = New System.Drawing.Point(6, 60)
+ Me.Label3.Name = "Label3"
+ Me.Label3.Size = New System.Drawing.Size(50, 13)
+ Me.Label3.TabIndex = 11
+ Me.Label3.Text = "To email:"
+ '
+ 'btnEdit
+ '
+ Me.btnEdit.Location = New System.Drawing.Point(157, 213)
+ Me.btnEdit.Name = "btnEdit"
+ Me.btnEdit.Size = New System.Drawing.Size(75, 23)
+ Me.btnEdit.TabIndex = 8
+ Me.btnEdit.Text = "Edit"
+ Me.btnEdit.UseVisualStyleBackColor = True
+ '
+ 'MenuStrip1
+ '
+ Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripMenuItem1})
+ Me.MenuStrip1.Location = New System.Drawing.Point(0, 0)
+ Me.MenuStrip1.Name = "MenuStrip1"
+ Me.MenuStrip1.Size = New System.Drawing.Size(579, 24)
+ Me.MenuStrip1.TabIndex = 14
+ Me.MenuStrip1.Text = "MenuStrip1"
+ '
+ 'ToolStripMenuItem1
+ '
+ Me.ToolStripMenuItem1.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.OpenViewerToolStripMenuItem})
+ Me.ToolStripMenuItem1.Name = "ToolStripMenuItem1"
+ Me.ToolStripMenuItem1.Size = New System.Drawing.Size(37, 20)
+ Me.ToolStripMenuItem1.Text = "File"
+ '
+ 'OpenViewerToolStripMenuItem
+ '
+ Me.OpenViewerToolStripMenuItem.Name = "OpenViewerToolStripMenuItem"
+ Me.OpenViewerToolStripMenuItem.Size = New System.Drawing.Size(141, 22)
+ Me.OpenViewerToolStripMenuItem.Text = "Open Viewer"
+ '
+ 'GroupBox1
+ '
+ Me.GroupBox1.Controls.Add(Me.Label7)
+ Me.GroupBox1.Controls.Add(Me.DateTimePicker1)
+ Me.GroupBox1.Controls.Add(Me.Label5)
+ Me.GroupBox1.Controls.Add(Me.txtDaysToScan)
+ Me.GroupBox1.Controls.Add(Me.radMinutes)
+ Me.GroupBox1.Controls.Add(Me.radDays)
+ Me.GroupBox1.Controls.Add(Me.txtSMTP)
+ Me.GroupBox1.Controls.Add(Me.Label6)
+ Me.GroupBox1.Controls.Add(Me.Label1)
+ Me.GroupBox1.Controls.Add(Me.txtServers)
+ Me.GroupBox1.Controls.Add(Me.txtInterval)
+ Me.GroupBox1.Controls.Add(Me.Label4)
+ Me.GroupBox1.Controls.Add(Me.Label2)
+ Me.GroupBox1.Controls.Add(Me.txtFromEmail)
+ Me.GroupBox1.Controls.Add(Me.btnEdit)
+ Me.GroupBox1.Controls.Add(Me.txtToEmail)
+ Me.GroupBox1.Controls.Add(Me.Label3)
+ Me.GroupBox1.Location = New System.Drawing.Point(12, 32)
+ Me.GroupBox1.Name = "GroupBox1"
+ Me.GroupBox1.Size = New System.Drawing.Size(555, 252)
+ Me.GroupBox1.TabIndex = 15
+ Me.GroupBox1.TabStop = False
+ Me.GroupBox1.Text = "Settings"
+ '
+ 'Label7
+ '
+ Me.Label7.AutoSize = True
+ Me.Label7.Location = New System.Drawing.Point(7, 189)
+ Me.Label7.Name = "Label7"
+ Me.Label7.Size = New System.Drawing.Size(56, 13)
+ Me.Label7.TabIndex = 20
+ Me.Label7.Text = "Start date:"
+ '
+ 'DateTimePicker1
+ '
+ Me.DateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Custom
+ Me.DateTimePicker1.Location = New System.Drawing.Point(82, 183)
+ Me.DateTimePicker1.Name = "DateTimePicker1"
+ Me.DateTimePicker1.Size = New System.Drawing.Size(238, 20)
+ Me.DateTimePicker1.TabIndex = 7
+ '
+ 'Label5
+ '
+ Me.Label5.AutoSize = True
+ Me.Label5.Location = New System.Drawing.Point(6, 156)
+ Me.Label5.Name = "Label5"
+ Me.Label5.Size = New System.Drawing.Size(74, 13)
+ Me.Label5.TabIndex = 23
+ Me.Label5.Text = "Days to Scan:"
+ '
+ 'txtDaysToScan
+ '
+ Me.txtDaysToScan.Location = New System.Drawing.Point(82, 153)
+ Me.txtDaysToScan.Name = "txtDaysToScan"
+ Me.txtDaysToScan.Size = New System.Drawing.Size(77, 20)
+ Me.txtDaysToScan.TabIndex = 6
+ '
+ 'radMinutes
+ '
+ Me.radMinutes.AutoSize = True
+ Me.radMinutes.Location = New System.Drawing.Point(165, 114)
+ Me.radMinutes.Name = "radMinutes"
+ Me.radMinutes.Size = New System.Drawing.Size(62, 17)
+ Me.radMinutes.TabIndex = 4
+ Me.radMinutes.TabStop = True
+ Me.radMinutes.Text = "Minutes"
+ Me.radMinutes.UseVisualStyleBackColor = True
+ '
+ 'radDays
+ '
+ Me.radDays.AutoSize = True
+ Me.radDays.Location = New System.Drawing.Point(165, 130)
+ Me.radDays.Name = "radDays"
+ Me.radDays.Size = New System.Drawing.Size(49, 17)
+ Me.radDays.TabIndex = 5
+ Me.radDays.TabStop = True
+ Me.radDays.Text = "Days"
+ Me.radDays.UseVisualStyleBackColor = True
+ '
+ 'txtSMTP
+ '
+ Me.txtSMTP.Location = New System.Drawing.Point(82, 89)
+ Me.txtSMTP.Name = "txtSMTP"
+ Me.txtSMTP.Size = New System.Drawing.Size(195, 20)
+ Me.txtSMTP.TabIndex = 2
+ '
+ 'Label6
+ '
+ Me.Label6.AutoSize = True
+ Me.Label6.Location = New System.Drawing.Point(6, 96)
+ Me.Label6.Name = "Label6"
+ Me.Label6.Size = New System.Drawing.Size(74, 13)
+ Me.Label6.TabIndex = 17
+ Me.Label6.Text = "SMTP Server:"
+ '
+ 'txtInterval
+ '
+ Me.txtInterval.Location = New System.Drawing.Point(82, 120)
+ Me.txtInterval.Name = "txtInterval"
+ Me.txtInterval.Size = New System.Drawing.Size(77, 20)
+ Me.txtInterval.TabIndex = 3
+ '
+ 'Label4
+ '
+ Me.Label4.AutoSize = True
+ Me.Label4.Location = New System.Drawing.Point(6, 125)
+ Me.Label4.Name = "Label4"
+ Me.Label4.Size = New System.Drawing.Size(73, 13)
+ Me.Label4.TabIndex = 13
+ Me.Label4.Text = "Scan Interval:"
+ '
+ 'Button1
+ '
+ Me.Button1.Location = New System.Drawing.Point(21, 290)
+ Me.Button1.Name = "Button1"
+ Me.Button1.Size = New System.Drawing.Size(75, 23)
+ Me.Button1.TabIndex = 19
+ Me.Button1.Text = "Button1"
+ Me.Button1.UseVisualStyleBackColor = True
+ Me.Button1.Visible = False
+ '
+ 'Timer2
+ '
+ Me.Timer2.Interval = 1000
+ '
+ 'Label8
+ '
+ Me.Label8.AutoSize = True
+ Me.Label8.Location = New System.Drawing.Point(475, 300)
+ Me.Label8.Name = "Label8"
+ Me.Label8.Size = New System.Drawing.Size(39, 13)
+ Me.Label8.TabIndex = 20
+ Me.Label8.Text = "Label8"
+ '
+ 'Form1
+ '
+ Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
+ Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
+ Me.ClientSize = New System.Drawing.Size(579, 346)
+ Me.Controls.Add(Me.Label8)
+ Me.Controls.Add(Me.GroupBox1)
+ Me.Controls.Add(Me.StatusStrip1)
+ Me.Controls.Add(Me.MenuStrip1)
+ Me.Controls.Add(Me.btnStartStop)
+ Me.Controls.Add(Me.Button1)
+ Me.Controls.Add(Me.ListView1)
+ Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D
+ Me.MainMenuStrip = Me.MenuStrip1
+ Me.MaximizeBox = False
+ Me.Name = "Form1"
+ Me.Text = "AD Security Log Scanner"
+ Me.StatusStrip1.ResumeLayout(False)
+ Me.StatusStrip1.PerformLayout()
+ Me.MenuStrip1.ResumeLayout(False)
+ Me.MenuStrip1.PerformLayout()
+ Me.GroupBox1.ResumeLayout(False)
+ Me.GroupBox1.PerformLayout()
+ Me.ResumeLayout(False)
+ Me.PerformLayout()
+
+ End Sub
+ Friend WithEvents ListView1 As System.Windows.Forms.ListView
+ Friend WithEvents btnStartStop As System.Windows.Forms.Button
+ Friend WithEvents StatusStrip1 As System.Windows.Forms.StatusStrip
+ Friend WithEvents ToolStripStatusLabel1 As System.Windows.Forms.ToolStripStatusLabel
+ Friend WithEvents Timer1 As System.Windows.Forms.Timer
+ Friend WithEvents txtServers As System.Windows.Forms.TextBox
+ Friend WithEvents Label1 As System.Windows.Forms.Label
+ Friend WithEvents txtFromEmail As System.Windows.Forms.TextBox
+ Friend WithEvents txtToEmail As System.Windows.Forms.TextBox
+ Friend WithEvents Label2 As System.Windows.Forms.Label
+ Friend WithEvents Label3 As System.Windows.Forms.Label
+ Friend WithEvents btnEdit As System.Windows.Forms.Button
+ Friend WithEvents MenuStrip1 As System.Windows.Forms.MenuStrip
+ Friend WithEvents ToolStripMenuItem1 As System.Windows.Forms.ToolStripMenuItem
+ Friend WithEvents OpenViewerToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
+ Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
+ Friend WithEvents txtInterval As System.Windows.Forms.TextBox
+ Friend WithEvents Label4 As System.Windows.Forms.Label
+ Friend WithEvents txtSMTP As System.Windows.Forms.TextBox
+ Friend WithEvents Label6 As System.Windows.Forms.Label
+ Friend WithEvents Button1 As System.Windows.Forms.Button
+ Friend WithEvents radMinutes As System.Windows.Forms.RadioButton
+ Friend WithEvents radDays As System.Windows.Forms.RadioButton
+ Friend WithEvents Label5 As System.Windows.Forms.Label
+ Friend WithEvents txtDaysToScan As System.Windows.Forms.TextBox
+ Friend WithEvents ToolStripStatusLabel2 As System.Windows.Forms.ToolStripStatusLabel
+ Friend WithEvents ToolStripStatusLabel3 As System.Windows.Forms.ToolStripStatusLabel
+ Friend WithEvents ToolStripStatusLabel4 As System.Windows.Forms.ToolStripStatusLabel
+ Friend WithEvents ToolStripStatusLabel5 As System.Windows.Forms.ToolStripStatusLabel
+ Friend WithEvents DateTimePicker1 As System.Windows.Forms.DateTimePicker
+ Friend WithEvents Timer2 As System.Windows.Forms.Timer
+ Friend WithEvents Label7 As System.Windows.Forms.Label
+ Friend WithEvents Label8 As System.Windows.Forms.Label
+
+End Class
132 Form1.resx
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <metadata name="StatusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <metadata name="Timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>134, 17</value>
+ </metadata>
+ <metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>223, 17</value>
+ </metadata>
+ <metadata name="Timer2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>338, 17</value>
+ </metadata>
+</root>
419 Form1.vb
@@ -0,0 +1,419 @@
+Imports System.IO
+Imports System.Net.Mail
+Imports System.Threading
+Imports System.Diagnostics
+
+Public Class Form1
+ Dim appdir As String = Application.StartupPath() & "\"
+ Dim timespan As DateTime '= DateTime.Today.AddDays(-3)
+ Dim smtp As New SmtpClient '("192.168.208.13")
+ Dim mail As New MailMessage()
+ Dim servers As New List(Of String)()
+ Dim trd As Thread
+ Dim errWriter As New StreamWriter(appdir & "errors.log", True)
+ Dim fromempty As Boolean
+ Dim toempty As Boolean
+ Dim intervalempty As Boolean
+ Dim smtpempty As Boolean
+ Dim radMinUnchecked As Boolean
+ Dim radDayUnchecked As Boolean
+ Dim emptyDaysToScan As Boolean
+ Dim sSource As String = "Security Log Monitor"
+ Dim sLog As String = "Application"
+ Dim sEvent As String
+ Dim sMachine As String = "."
+ Dim running As Boolean
+ Dim timerenabled As Boolean
+
+ Sub getSecurity(ByVal servername As String)
+ Try
+ Dim elEvent As New System.Diagnostics.EventLog("Security", servername)
+ Dim elEventEntry As System.Diagnostics.EventLogEntry
+ ListView1.Items.Clear()
+ For Each elEventEntry In elEvent.Entries
+ Dim li As New ListViewItem()
+ With li
+ If elEventEntry.EventID = "662" Or elEventEntry.EventID = "630" Or elEventEntry.EventID = "633" Or elEventEntry.EventID = "660" Or elEventEntry.EventID = "661" Or elEventEntry.EventID = "634" Then
+ If elEventEntry.TimeGenerated > timespan Then
+ .Text = elEventEntry.EntryType.ToString
+ .SubItems.Add(elEventEntry.TimeGenerated.ToString)
+ .SubItems.Add(elEventEntry.Source.ToString)
+ .SubItems.Add(elEventEntry.EventID.ToString)
+
+ If elEventEntry.UserName Is Nothing Then
+ .SubItems.Add("N/A")
+ Else
+ .SubItems.Add(elEventEntry.UserName.ToString)
+ End If
+ .SubItems.Add(elEventEntry.MachineName.ToString)
+ .SubItems.Add(elEventEntry.Message.ToString)
+ ListView1.Items.Add(li)
+ li = Nothing
+ End If
+ End If
+ End With
+ Next
+ saveInfo(servername)
+ Catch ex As Exception
+ errWriter.WriteLine(ex.ToString)
+ Dim ELog As New EventLog(sLog, sMachine, sSource)
+ ELog.WriteEntry(ex.ToString, EventLogEntryType.Error, 234, CType(3, Short))
+ ToolStripStatusLabel2.Text = "Error detected. Please see Event Viewer for more details."
+ End Try
+ End Sub
+
+ Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
+ If timerenabled = True Then
+ If MessageBox.Show("A timer is still enabled and currently running. Are you sure you want to close?", "Confirm", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
+ Me.Close()
+ Else
+ e.Cancel = True
+ End If
+ End If
+ End Sub
+ Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
+ DateTimePicker1.CustomFormat = "MMMM dddd yyyy HH:mm tt"
+ With ListView1 ' ListView1 is not seen on the form. Used just to save information from.
+ .Clear()
+ .Columns.Add("Entry Type", 85, HorizontalAlignment.Left)
+ .Columns.Add("Date/Time Generated", 140, HorizontalAlignment.Left)
+ .Columns.Add("Source", 150, HorizontalAlignment.Left)
+ .Columns.Add("Event", 50, HorizontalAlignment.Left)
+ .Columns.Add("User", 150, HorizontalAlignment.Left)
+ .Columns.Add("Computer", 150, HorizontalAlignment.Left)
+ .Columns.Add("Description", 150, HorizontalAlignment.Left)
+ .View = View.Details
+ End With
+ ToolStripStatusLabel1.Text = "Not Running"
+ ToolStripStatusLabel2.Text = "Awaiting results"
+ ToolStripStatusLabel5.Text = "Next scan not scheduled"
+
+ DateTimePicker1.Enabled = False
+ txtFromEmail.Enabled = False
+ txtToEmail.Enabled = False
+ txtServers.Enabled = False
+ txtInterval.Enabled = False
+ txtSMTP.Enabled = False
+ radMinutes.Enabled = False
+ radDays.Enabled = False
+ txtDaysToScan.Enabled = False
+
+ For Each Entry As String In My.Settings.Servers
+ txtServers.Text &= Entry & Environment.NewLine
+ Next
+
+ txtFromEmail.Text = My.Settings.FromEmail
+ txtToEmail.Text = My.Settings.ToEmail
+ txtInterval.Text = My.Settings.Interval
+ txtSMTP.Text = My.Settings.SMTPServer
+ txtDaysToScan.Text = My.Settings.DaysToScan
+
+ If My.Settings.IntervalLength = "Days" Then
+ radDays.Checked = True
+ ElseIf My.Settings.IntervalLength = "Minutes" Then
+ radMinutes.Checked = True
+ End If
+ End Sub
+ Sub saveInfo(ByVal servername As String)
+ Try
+ Dim Writer As New StreamWriter(appdir & servername & "_" & timespan.ToString("MM-dd-yyyy") & "-" & Date.Today.ToString("MM-dd-yyyy") & ".log")
+ For i As Integer = 0 To Me.ListView1.Items.Count - 1
+ For j As Integer = 0 To Me.ListView1.Columns.Count - 1
+ Writer.Write(Me.ListView1.Items(i).SubItems(j).Text & ControlChars.Tab)
+ Next
+ Writer.WriteLine()
+ Next
+ Writer.Close()
+ ToolStripStatusLabel2.Text = ""
+ Catch ex As Exception
+ errWriter.WriteLine(Date.Now)
+ errWriter.WriteLine(ex.ToString)
+ errWriter.WriteLine("")
+ Dim ELog As New EventLog(sLog, sMachine, sSource)
+ ELog.WriteEntry(ex.ToString, EventLogEntryType.Error, 234, CType(3, Short))
+ ToolStripStatusLabel2.Text = "Error detected. Please see Event Viewer for more details."
+ End Try
+ End Sub
+ Sub sendMail()
+ Dim ToEmail As String = My.Settings.ToEmail
+ Dim FromEmail As String = My.Settings.FromEmail
+ Dim attachments As String
+
+ mail.From = New MailAddress(FromEmail)
+ mail.To.Add(ToEmail)
+ mail.Subject = "Active Directory User/Group Logs - " & timespan & " - " & Date.Today
+ mail.Body = ""
+
+ For Each Entry As String In My.Settings.Servers
+ If My.Computer.FileSystem.FileExists(appdir & Entry & "_" & timespan.ToString("MM-dd-yyyy") & "-" & Date.Today.ToString("MM-dd-yyyy") & ".log") = True Then
+ mail.Attachments.Add(New Attachment(appdir & Entry & "_" & timespan.ToString("MM-dd-yyyy") & "-" & Date.Today.ToString("MM-dd-yyyy") & ".log"))
+ attachments += ControlChars.Tab & ControlChars.Tab & ControlChars.Tab & Entry & "_" & timespan.ToString("MM-dd-yyyy") & "-" & Date.Today.ToString("MM-dd-yyyy") & ".log" & Environment.NewLine
+ Else
+ errWriter.WriteLine(appdir & Entry & "_" & timespan.ToString("MM-dd-yyyy") & "-" & Date.Today.ToString("MM-dd-yyyy") & ".log - File not found.")
+ End If
+
+ Next
+ Try
+ smtp.Send(mail)
+ Dim Now As DateTime = DateTime.Now
+
+ sEvent = "Scan has completed." & Environment.NewLine
+ sEvent += ControlChars.Tab & "Date:" & ControlChars.Tab & ControlChars.Tab & Date.Now & Environment.NewLine
+ sEvent += ControlChars.Tab & "To:" & ControlChars.Tab & ControlChars.Tab & ToEmail & Environment.NewLine
+ sEvent += ControlChars.Tab & "From:" & ControlChars.Tab & ControlChars.Tab & FromEmail & Environment.NewLine
+ sEvent += ControlChars.Tab & "Logs Emailed:" & ControlChars.Tab & "Yes" & Environment.NewLine
+ sEvent += ControlChars.Tab & "Attachments:" & ControlChars.Tab & ControlChars.Tab & Environment.NewLine
+ sEvent += attachments
+ sMachine = "."
+ If Not EventLog.SourceExists(sSource, sMachine) Then
+ EventLog.CreateEventSource(sSource, sLog, sMachine)
+ End If
+ Dim ELog As New EventLog(sLog, sMachine, sSource)
+ ELog.WriteEntry(sEvent)
+ ToolStripStatusLabel2.Text = "Last email sent at " & Date.Now
+ Catch ex As Exception
+ errWriter.WriteLine(Date.Now)
+ errWriter.WriteLine(ex.ToString)
+ errWriter.WriteLine("")
+ Dim ELog As New EventLog(sLog, sMachine, sSource)
+ ELog.WriteEntry(ex.ToString, EventLogEntryType.Error, 234, CType(3, Short))
+ ToolStripStatusLabel2.Text = "Error detected. Please see Event Viewer for more details."
+ End Try
+ mail.Attachments.Clear()
+ mail.To.Clear()
+ End Sub
+ Sub beginScan()
+ For Each Entry As String In My.Settings.Servers
+ getSecurity(Entry)
+ Next
+ sendMail()
+ ToolStripStatusLabel1.Text = "Waiting..."
+ End Sub
+ Function emptyCheck()
+ If Me.InvokeRequired Then
+ Me.Invoke(New MethodInvoker(AddressOf emptyCheck))
+ Else
+ If String.IsNullOrEmpty(txtFromEmail.Text) Then
+ fromempty = True
+ txtFromEmail.BackColor = Color.Red
+ End If
+ If String.IsNullOrEmpty(txtToEmail.Text) Then
+ toempty = True
+ txtToEmail.BackColor = Color.Red
+ End If
+ If String.IsNullOrEmpty(txtInterval.Text) Then
+ intervalempty = True
+ txtInterval.BackColor = Color.Red
+ End If
+ If String.IsNullOrEmpty(txtSMTP.Text) Then
+ smtpempty = True
+ txtSMTP.BackColor = Color.Red
+ End If
+ If String.IsNullOrEmpty(txtDaysToScan.Text) Then
+ emptyDaysToScan = True
+ txtDaysToScan.BackColor = Color.Red
+ End If
+ If radMinutes.Checked = False Then
+ If radDays.Checked = False Then
+ radMinUnchecked = True
+ radMinutes.BackColor = Color.Red
+ End If
+ End If
+ If radDays.Checked = False Then
+ If radMinutes.Checked = False Then
+ radDayUnchecked = True
+ radDays.BackColor = Color.Red
+ End If
+ End If
+ End If
+
+ If (fromempty = True) Or (toempty = True) Or (intervalempty = True) Or (smtpempty = True) Or ((radMinUnchecked = True And radDayUnchecked = True)) Or emptyDaysToScan = True Then
+ MessageBox.Show("Invalid entry detected! Please correct highlighted entries.", "Invalid entry", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
+ Return True
+ Else
+ If btnEdit.Text = "Save" Then
+ Dim time As TimeSpan = Date.Now - DateTimePicker1.Value
+ Dim seconds As Double = time.Seconds
+ If seconds > 0 Then
+ MessageBox.Show("Invalid date detected! Please select a future date.", "Invalid date", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
+ Return True
+ Else
+ Return False
+ End If
+ End If
+ Return False
+ End If
+
+ End Function
+ Function MinuteToMilliseconds(ByVal min As Double)
+ Return min * 60000
+ End Function
+ Function DaysToMilliseconds(ByVal day As Double)
+ Return day * 86400000
+ End Function
+ Private Sub btnStartStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStartStop.Click
+ If emptyCheck() = False Then
+ If btnStartStop.Text = "Start Scheduled Scanning" Then
+ btnStartStop.Text = "Stop"
+ btnEdit.Enabled = False
+ ToolStripStatusLabel1.Text = "Waiting..."
+ smtp = New SmtpClient(My.Settings.SMTPServer)
+ timespan = DateTime.Today.AddDays("-" & CInt(txtDaysToScan.Text))
+ ToolStripStatusLabel5.Text = "Scan scheduled for " & DateTimePicker1.Text
+ Timer2.Start()
+ Else
+ btnStartStop.Text = "Start Scheduled Scanning"
+ ToolStripStatusLabel1.Text = "Stopped"
+ ToolStripStatusLabel5.Text = "Next scan not scheduled"
+ btnEdit.Enabled = True
+ Timer1.Stop()
+ Timer2.Stop()
+ timerenabled = False
+ Try
+ If trd.IsAlive() Then
+ trd.Abort()
+ End If
+ Catch ex As Exception
+ End Try
+ End If
+ End If
+ End Sub
+ Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEdit.Click
+ If btnEdit.Text = "Edit" Then
+ btnEdit.Text = "Save"
+ txtFromEmail.Enabled = True
+ txtToEmail.Enabled = True
+ txtInterval.Enabled = True
+ txtSMTP.Enabled = True
+ txtServers.Enabled = True
+ btnStartStop.Enabled = False
+ radDays.Enabled = True
+ radMinutes.Enabled = True
+ txtDaysToScan.Enabled = True
+ DateTimePicker1.Enabled = True
+ Else
+ If emptyCheck() = False Then
+ btnEdit.Text = "Edit"
+ txtFromEmail.Enabled = False
+ txtToEmail.Enabled = False
+ txtInterval.Enabled = False
+ txtSMTP.Enabled = False
+ btnStartStop.Enabled = True
+ txtServers.Enabled = False
+ radMinutes.Enabled = False
+ radDays.Enabled = False
+ txtDaysToScan.Enabled = False
+ DateTimePicker1.Enabled = False
+ My.Settings.Servers.Clear()
+ For Each i In txtServers.Lines
+ If My.Settings.Servers.Contains(i) Then
+ Else
+ If i = "" Then
+ Else
+ My.Settings.Servers.Add(i)
+ End If
+ End If
+ Next
+ My.Settings.ToEmail = txtToEmail.Text
+ My.Settings.FromEmail = txtFromEmail.Text
+ My.Settings.Interval = txtInterval.Text
+ My.Settings.SMTPServer = txtSMTP.Text
+ My.Settings.DaysToScan = txtDaysToScan.Text
+ If radDays.Checked = True Then
+ My.Settings.IntervalLength = "Days"
+ ElseIf radMinutes.Checked = True Then
+ My.Settings.IntervalLength = "Minutes"
+ End If
+ End If
+ End If
+ End Sub
+ Private Sub OpenViewerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenViewerToolStripMenuItem.Click
+ Dim frmViewer As New Viewer
+ frmViewer.ShowDialog()
+ End Sub
+ Private Sub txtFromEmail_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtFromEmail.GotFocus
+ If fromempty = True Then
+ fromempty = False
+ txtFromEmail.BackColor = Color.Empty
+ End If
+ End Sub
+ Private Sub txtInterval_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtInterval.GotFocus
+ If intervalempty = True Then
+ intervalempty = False
+ txtInterval.BackColor = Color.Empty
+ End If
+ End Sub
+ Private Sub txtToEmail_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtToEmail.GotFocus
+ If toempty = True Then
+ toempty = False
+ txtToEmail.BackColor = Color.Empty
+ End If
+ End Sub
+
+ Private Sub txtSMTP_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtSMTP.GotFocus
+ If smtpempty = True Then
+ smtpempty = False
+ txtSMTP.BackColor = Color.Empty
+ End If
+ End Sub
+ Sub nextScan()
+ If radDays.Checked = True Then
+ ToolStripStatusLabel5.Text = "Next scan at " & Now.AddDays(txtInterval.Text)
+ Else
+ ToolStripStatusLabel5.Text = "Next scan at " & Now.AddMinutes(txtInterval.Text)
+ End If
+ End Sub
+ Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
+ TimerEnabled = True
+ If radMinutes.Checked = True Then
+ Timer1.Interval = MinuteToMilliseconds(txtInterval.Text)
+ End If
+ If radDays.Checked = True Then
+ Timer1.Interval = DaysToMilliseconds(txtInterval.Text)
+ End If
+ trd = New Thread(AddressOf beginScan)
+ nextScan()
+ trd.Start()
+ ToolStripStatusLabel1.Text = "Running"
+ End Sub
+ Private Sub radDays_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles radDays.GotFocus
+ If radDayUnchecked = True Then
+ radDayUnchecked = False
+ radDays.BackColor = Color.Empty
+ radMinUnchecked = False
+ radMinutes.BackColor = Color.Empty
+ End If
+ End Sub
+
+ Private Sub radMinutes_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles radMinutes.GotFocus
+ If radMinUnchecked = True Then
+ radDayUnchecked = False
+ radDays.BackColor = Color.Empty
+ radMinUnchecked = False
+ radMinutes.BackColor = Color.Empty
+ End If
+ End Sub
+
+ Private Sub txtDaysToScan_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtDaysToScan.GotFocus
+ If emptyDaysToScan = True Then
+ emptyDaysToScan = False
+ txtDaysToScan.BackColor = Color.Empty
+ End If
+ End Sub
+ Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
+ Dim time As TimeSpan = Date.Now - DateTimePicker1.Value
+ Dim seconds As Double = time.Seconds
+ Dim minutes As Double = time.Minutes
+ Dim hours As Double = time.Hours
+ timerenabled = True
+ Label8.Text = hours & " - " & minutes & " - " & seconds
+ If seconds = 0 And minutes = 0 And hours = 0 Then
+ Timer1.Start()
+ Timer2.Stop()
+ End If
+ End Sub
+
+ Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
+ MsgBox(Date.Now & " - " & DateTimePicker1.Value)
+ End Sub
+End Class
38 My Project/Application.Designer.vb
@@ -0,0 +1,38 @@
+'------------------------------------------------------------------------------
+' <auto-generated>
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.269
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+' </auto-generated>
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
+ ' or if you encounter build errors in this file, go to the Project Designer
+ ' (go to Project Properties or double-click the My Project node in
+ ' Solution Explorer), and make changes on the Application tab.
+ '
+ Partial Friend Class MyApplication
+
+ <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
+ Public Sub New()
+ MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
+ Me.IsSingleInstance = false
+ Me.EnableVisualStyles = true
+ Me.SaveMySettingsOnExit = true
+ Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
+ End Sub
+
+ <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
+ Protected Overrides Sub OnCreateMainForm()
+ Me.MainForm = Global.EventLogMonitor.Form1
+ End Sub
+ End Class
+End Namespace
11 My Project/Application.myapp
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <MySubMain>true</MySubMain>
+ <MainForm>Form1</MainForm>
+ <SingleInstance>false</SingleInstance>
+ <ShutdownMode>0</ShutdownMode>
+ <EnableVisualStyles>true</EnableVisualStyles>
+ <AuthenticationMode>0</AuthenticationMode>
+ <ApplicationType>0</ApplicationType>
+ <SaveMySettingsOnExit>true</SaveMySettingsOnExit>
+</MyApplicationData>
35 My Project/AssemblyInfo.vb
@@ -0,0 +1,35 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+
+<Assembly: AssemblyTitle("EventLogMonitor")>
+<Assembly: AssemblyDescription("")>
+<Assembly: AssemblyCompany("")>
+<Assembly: AssemblyProduct("EventLogMonitor")>
+<Assembly: AssemblyCopyright("Copyright © 2012")>
+<Assembly: AssemblyTrademark("")>
+
+<Assembly: ComVisible(False)>
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+<Assembly: Guid("c9d270c4-aa84-44f3-bbb6-ff5ed1cad757")>
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+' <Assembly: AssemblyVersion("1.0.*")>
+
+<Assembly: AssemblyVersion("1.0.0.0")>
+<Assembly: AssemblyFileVersion("1.0.0.0")>
62 My Project/Resources.Designer.vb
@@ -0,0 +1,62 @@
+'------------------------------------------------------------------------------
+' <auto-generated>
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.269
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+' </auto-generated>
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''<summary>
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''</summary>
+ <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
+ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
+ Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
+ Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''<summary>
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''</summary>
+ <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("EventLogMonitor.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''<summary>
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''</summary>
+ <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set(ByVal value As Global.System.Globalization.CultureInfo)
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
117 My Project/Resources.resx
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
158 My Project/Settings.Designer.vb
@@ -0,0 +1,158 @@
+'------------------------------------------------------------------------------
+' <auto-generated>
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.269
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+' </auto-generated>
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
+ Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0"), _
+ Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+
+ <Global.System.Configuration.UserScopedSettingAttribute(), _
+ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
+ Global.System.Configuration.DefaultSettingValueAttribute("<?xml version=""1.0"" encoding=""utf-16""?>"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"<ArrayOfString xmlns:xsi=""http://www.w3."& _
+ "org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" />")> _
+ Public Property Servers() As Global.System.Collections.Specialized.StringCollection
+ Get
+ Return CType(Me("Servers"),Global.System.Collections.Specialized.StringCollection)
+ End Get
+ Set
+ Me("Servers") = value
+ End Set
+ End Property
+
+ <Global.System.Configuration.UserScopedSettingAttribute(), _
+ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
+ Global.System.Configuration.DefaultSettingValueAttribute("")> _
+ Public Property ToEmail() As String
+ Get
+ Return CType(Me("ToEmail"),String)
+ End Get
+ Set
+ Me("ToEmail") = value
+ End Set
+ End Property
+
+ <Global.System.Configuration.UserScopedSettingAttribute(), _
+ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
+ Global.System.Configuration.DefaultSettingValueAttribute("")> _
+ Public Property FromEmail() As String
+ Get
+ Return CType(Me("FromEmail"),String)
+ End Get
+ Set
+ Me("FromEmail") = value
+ End Set
+ End Property
+
+ <Global.System.Configuration.UserScopedSettingAttribute(), _
+ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
+ Global.System.Configuration.DefaultSettingValueAttribute("")> _
+ Public Property Interval() As String
+ Get
+ Return CType(Me("Interval"),String)
+ End Get
+ Set
+ Me("Interval") = value
+ End Set
+ End Property
+
+ <Global.System.Configuration.UserScopedSettingAttribute(), _
+ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
+ Global.System.Configuration.DefaultSettingValueAttribute("")> _
+ Public Property SMTPServer() As String
+ Get
+ Return CType(Me("SMTPServer"),String)
+ End Get
+ Set
+ Me("SMTPServer") = value
+ End Set
+ End Property
+
+ <Global.System.Configuration.UserScopedSettingAttribute(), _
+ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
+ Global.System.Configuration.DefaultSettingValueAttribute("")> _
+ Public Property IntervalLength() As String
+ Get
+ Return CType(Me("IntervalLength"),String)
+ End Get
+ Set
+ Me("IntervalLength") = value
+ End Set
+ End Property
+
+ <Global.System.Configuration.UserScopedSettingAttribute(), _
+ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
+ Global.System.Configuration.DefaultSettingValueAttribute("0")> _
+ Public Property DaysToScan() As String
+ Get
+ Return CType(Me("DaysToScan"),String)
+ End Get
+ Set
+ Me("DaysToScan") = value
+ End Set
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ <Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
+ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
+ Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
+ Friend Module MySettingsProperty
+
+ <Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
+ Friend ReadOnly Property Settings() As Global.EventLogMonitor.My.MySettings
+ Get
+ Return Global.EventLogMonitor.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
28 My Project/Settings.settings
@@ -0,0 +1,28 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true">
+ <Profiles />
+ <Settings>
+ <Setting Name="Servers" Type="System.Collections.Specialized.StringCollection" Scope="User">
+ <Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
+&lt;ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /&gt;</Value>
+ </Setting>
+ <Setting Name="ToEmail" Type="System.String" Scope="User">
+ <Value Profile="(Default)" />
+ </Setting>
+ <Setting Name="FromEmail" Type="System.String" Scope="User">
+ <Value Profile="(Default)" />
+ </Setting>
+ <Setting Name="Interval" Type="System.String" Scope="User">
+ <Value Profile="(Default)" />
+ </Setting>
+ <Setting Name="SMTPServer" Type="System.String" Scope="User">
+ <Value Profile="(Default)" />
+ </Setting>
+ <Setting Name="IntervalLength" Type="System.String" Scope="User">
+ <Value Profile="(Default)" />
+ </Setting>
+ <Setting Name="DaysToScan" Type="System.String" Scope="User">
+ <Value Profile="(Default)">0</Value>
+ </Setting>
+ </Settings>
+</SettingsFile>
71 Viewer.Designer.vb
@@ -0,0 +1,71 @@
+<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
+Partial Class Viewer
+ Inherits System.Windows.Forms.Form
+
+ 'Form overrides dispose to clean up the component list.
+ <System.Diagnostics.DebuggerNonUserCode()> _
+ Protected Overrides Sub Dispose(ByVal disposing As Boolean)
+ Try
+ If disposing AndAlso components IsNot Nothing Then
+ components.Dispose()
+ End If
+ Finally
+ MyBase.Dispose(disposing)
+ End Try
+ End Sub
+
+ 'Required by the Windows Form Designer
+ Private components As System.ComponentModel.IContainer
+
+ 'NOTE: The following procedure is required by the Windows Form Designer
+ 'It can be modified using the Windows Form Designer.
+ 'Do not modify it using the code editor.
+ <System.Diagnostics.DebuggerStepThrough()> _
+ Private Sub InitializeComponent()
+ Me.txtLog = New System.Windows.Forms.TextBox()
+ Me.btnOpen = New System.Windows.Forms.Button()
+ Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
+ Me.SuspendLayout()
+ '
+ 'txtLog
+ '
+ Me.txtLog.Location = New System.Drawing.Point(0, 0)
+ Me.txtLog.Multiline = True
+ Me.txtLog.Name = "txtLog"
+ Me.txtLog.ReadOnly = True
+ Me.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Both
+ Me.txtLog.Size = New System.Drawing.Size(926, 384)
+ Me.txtLog.TabIndex = 0
+ '
+ 'btnOpen
+ '
+ Me.btnOpen.Location = New System.Drawing.Point(383, 404)
+ Me.btnOpen.Name = "btnOpen"
+ Me.btnOpen.Size = New System.Drawing.Size(75, 23)
+ Me.btnOpen.TabIndex = 1
+ Me.btnOpen.Text = "Open"
+ Me.btnOpen.UseVisualStyleBackColor = True
+ '
+ 'OpenFileDialog1
+ '
+ Me.OpenFileDialog1.FileName = "OpenFileDialog1"
+ '
+ 'Viewer
+ '
+ Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
+ Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
+ Me.ClientSize = New System.Drawing.Size(926, 450)
+ Me.Controls.Add(Me.btnOpen)
+ Me.Controls.Add(Me.txtLog)
+ Me.MaximizeBox = False
+ Me.MinimizeBox = False
+ Me.Name = "Viewer"
+ Me.Text = "Log Viewer - Open file:"
+ Me.ResumeLayout(False)
+ Me.PerformLayout()
+
+ End Sub
+ Friend WithEvents txtLog As System.Windows.Forms.TextBox
+ Friend WithEvents btnOpen As System.Windows.Forms.Button
+ Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
+End Class
123 Viewer.resx
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <metadata name="OpenFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+</root>
25 Viewer.vb
@@ -0,0 +1,25 @@
+Imports System.IO
+Public Class Viewer
+ Dim filename As String
+ Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
+ Dim oReader As StreamReader
+ OpenFileDialog1.CheckFileExists = True
+ OpenFileDialog1.CheckPathExists = True
+ OpenFileDialog1.DefaultExt = "txt"
+ OpenFileDialog1.FileName = ""
+ OpenFileDialog1.Filter = "Log Files (*.log)|*.log|All Files (*.*)|*.*"
+ OpenFileDialog1.Multiselect = False
+ Try
+ If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
+ oReader = New StreamReader(OpenFileDialog1.FileName, True)
+ filename = OpenFileDialog1.FileName
+ txtLog.Clear()
+ txtLog.Text = oReader.ReadToEnd
+ Me.Text = "Log Viewer - Open file: " & filename
+ oReader.Close()
+ End If
+ Catch ex As Exception
+ txtLog.Text = "Error opening file. Please try another"
+ End Try
+ End Sub
+End Class
Please sign in to comment.
Something went wrong with that request. Please try again.