JohnAskew wrote:Whew! At first I thought they had found me out, or some VB devotee bent on revenge was outing me, but it's you and I can read your code. Thank God!
There is absolutely nothing wrong with VB.
Option Explicit On
Option Strict On
Imports System
Imports System.Collections
Imports ElDNCtrls.Windows.Forms
Imports System.Collections.Specialized
Imports NinerStat.Framework
Imports NinerStat.Framework.User
Imports NinerStat.Framework.Providers
Imports NinerStat.Framework.Subscriptions
Public Class FeedValidator
Inherits System.Windows.Forms.Form
Shared ValidationErrorData As New ArrayList
Dim c As New CheckBox
Public Structure ErrorCodeData
Public ErrorCodeTitle As String
Public ErrorCodeDescription As String
End Structure
''' The actual validation. (Via URL)
Public Function ValidateSubscriptionAndReturnTrueFalse(ByVal eSub As String) As Boolean
Dim rFeed As New RssFeed
Dim rReader As New RssReader
Try
rFeed = rReader.Retrieve(eSub)
If rFeed.Items.Count = 0 Then
Return False ' Nope, invalid feed. Add it to "The Junkyard"
Else
Return True ' Go ahead, this feed is valid
End If
Catch ex As Exception
Throw ex
End Try
End Function
' The actual feed validation (Via subscription)
Public Function ValidateSubscriptionAndReturnTrueFalse(ByVal eSub As Subscription) As Boolean
Dim fSub As New Subscription
Try
For Each fSub In CurrentSubscriptions.UsersSubscriptions
If fSub.Title = eSub.Title Then
Try
Dim rReader As New RssReader
Dim rFeed As New RssFeed
rFeed = rReader.Retrieve(eSub.FeedURL)
If rFeed.Items.Count = 0 Then
Return False ' Nope, invalid feed. Add it to "The Junkyard"
Else
Return True ' Go ahead, this feed is valid
End If
Catch ex As Exception
Return False ' Nope, invalid feed. Add it to "The Junkyard"
End Try
End If
Next
Catch ex As Exception
Throw ex
End Try
End Function
''' Here we validate the temporary feed
Private Sub mnuTempFeedVal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuTempFeedVal.Click
Dim TempXPItem As New XPListViewItem
Dim TempFeedVal As New TemporaryValidation
Try
If TempFeedVal.ShowDialog() = DialogResult.OK Then
If ValidateSubscriptionAndReturnTrueFalse(TempFeedVal.FeedURL) = True Then
' Alert the user of successfull validation
MessageBox.Show(String.Format("NinerStat Feed Validator has successfully validated '{0}'. {1}'{2}' registered as an 0.94 or above RSS based feed.", TempFeedVal.FeedTitle, Environment.NewLine, TempFeedVal.FeedTitle), Text, MessageBoxButtons.OK, MessageBoxIcon.Information)
TempXPItem.Text = TempFeedVal.FeedTitle
TempXPItem.SubItems.Add(TempFeedVal.FeedURL)
TempXPItem.SubItems.Add("Not Specified")
TempXPItem.SubItems.Add(TempFeedVal.FeedRDFBased)
ListValidSubscriptions.Items.Add(TempXPItem)
Else
' Alert the user of failure to validate
MessageBox.Show(String.Format("NinerStat Feed Validator has failed to validate '{0}'.{1}Elwoh Software recommends that you contact the managing editor of this website as soon as possible.", TempFeedVal.FeedTitle, Environment.NewLine), Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
If ListValidSubscriptions.Items.Contains(TempXPItem) = True Then
ListUnknown.Items.Add(TempXPItem)
ListValidSubscriptions.Items.Remove(TempXPItem)
End If
End If
End If
Catch ex As Exception
Throw ex
'MessageBox.Show("NinerStat experienced an internal error while attempting to start a new feed validator.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
End Class
By the way, the syntax provider on channel9 sucks.
Steve.