Public Class Form1
'Dim intGlobalCounter As Integer = 0
Dim strLink As String = "http://www.fimfiction.net/group/"
Dim blnOpenNext As Boolean = False
'Dim intEntryCounter As Integer = 0
Dim objtemp0 As Object
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
txtintGlobalCounter.Text = 0
txtintEntryCounter.Text = 0
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Try
Dim i As Integer = 0
Dim strClipBoard = ""
txtintGlobalCounter.Text = TextBox1.Text
timSlowOpenerOfAll.Enabled = True
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub timSlowOpenerOfAll_Tick(sender As System.Object, e As System.EventArgs) Handles timSlowOpenerOfAll.Tick
Try
If TextBox2.Text = "" Then bttAdd_Click(Nothing, Nothing)
Dim i As Integer = 0
If SetOpeningIfProcessClosed() Then
For i = 0 To 9
System.Diagnostics.Process.Start("Firefox.exe", strLink & txtintGlobalCounter.Text + i)
Next
If txtintGlobalCounter.Text > TextBox2.Text Then timSlowOpenerOfAll.Enabled = False
txtintGlobalCounter.Text += 10
End If
Catch ex As Exception
MsgBox(ex.Message)
'Conversion from string "" to type 'Double' is not valid.
End Try
End Sub
Private Sub bttBuildComment_Click(sender As System.Object, e As System.EventArgs) Handles bttBuildComment.Click
Try
If TextBox2.Text = "" Then bttAdd_Click(Nothing, Nothing)
txtComment.Text = ""
Clipboard.Clear()
blnOpenNext = True
Timer1.Enabled = True
If TextBox1.Text <> "" Then txtintGlobalCounter.Text = TextBox1.Text
txtintGlobalCounter.Text -= 1
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
Try
Dim strClipboard As String = ""
strClipboard = Clipboard.GetText()
strClipboard = strClipboard.Replace(vbCrLf, "")
strClipboard = strClipboard.Replace(" ", "")
strClipboard = Trim(strClipboard)
SetOpeningIfProcessClosed()
If strClipboard = "" Then
If blnOpenNext Then
Dim processes As Process() = Process.GetProcessesByName("Firefox.exe")
For Each process__1 As Process In processes
process__1.Kill()
Next
txtintGlobalCounter.Text += 1
System.Diagnostics.Process.Start("Firefox.exe", strLink & txtintGlobalCounter.Text)
blnOpenNext = False
End If
Else
objtemp0 = "[url=" & strLink & txtintGlobalCounter.Text & "]" & strClipboard & "[/url]" & vbCrLf
If Not txtComment.Text.Contains(objtemp0) Then
txtComment.Text = objtemp0 & txtComment.Text
End If
Clipboard.Clear()
blnOpenNext = True
txtintEntryCounter.Text += 1
End If
If (txtintGlobalCounter.Text - 1).ToString = TextBox2.Text Then
Timer1.Enabled = False
txtComment.Text = "Number of entries: " & txtintEntryCounter.Text & vbCrLf & txtComment.Text
End If
Catch ex As Exception
Timer1.Enabled = False
MsgBox(ex.Message)
End Try
End Sub
Private Function SetOpeningIfProcessClosed() As Boolean
SetOpeningIfProcessClosed = False
Dim blnExists As Boolean = False
Dim processes As Process() = Process.GetProcesses
For Each process__1 As Process In processes
If process__1.ProcessName.ToLower.Contains("firefox") Then
blnExists = True
End If
Next
If Not blnExists Then
blnOpenNext = True
SetOpeningIfProcessClosed = True
End If
End Function
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
If txtComment.Text = "" Then bttAdd_Click(Nothing, Nothing)
If txtComment.Text <> "" Then
Clipboard.SetText(txtComment.Text)
End If
'Value cannot be null. Parameter(Name) : Text
Timer1.Enabled = False
End Sub
Private Sub bttAdd_Click(sender As System.Object, e As System.EventArgs) Handles bttAdd.Click
If TextBox1.Text = "" Then
TextBox1.Text = 0
End If
TextBox2.Text = TextBox1.Text + 200
End Sub
Private Sub radGroups_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles radGroups.CheckedChanged
ManageRadioButtons()
End Sub
Private Sub radBlogs_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles radBlogs.CheckedChanged
ManageRadioButtons()
End Sub
Private Sub radStories_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles radStories.CheckedChanged
ManageRadioButtons()
End Sub
Private Sub ManageRadioButtons()
If radGroups.Checked Then
strLink = "http://www.fimfiction.net/group/"
End If
If radBlogs.Checked Then
strLink = "https://www.fimfiction.net/blog/"
End If
If radStories.Checked Then
strLink = "http://www.fimfiction.net/story/"
End If
End Sub
Private Sub bttClipboard_Click(sender As Object, e As EventArgs) Handles bttClipboard.Click
Button2_Click(Nothing, Nothing)
Clipboard.Clear()
Clipboard.SetText(txtComment.Text)
End Sub
End Class