Advertisement
Guest User

Untitled

a guest
Dec 14th, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 3.44 KB | None | 0 0
  1. Imports System.IO
  2. Imports System.Text.RegularExpressions
  3. Public Class Form1
  4.     Dim source As String
  5.     Dim contents As String
  6.     Dim sounds As String
  7.     Private Sub DeumosButton1_Click(sender As System.Object, e As System.EventArgs) Handles DeumosButton1.Click
  8.         Me.Close()
  9.     End Sub
  10.  
  11.     Private Sub DeumosButton2_Click(sender As System.Object, e As System.EventArgs) Handles DeumosButton2.Click
  12.         Me.WindowState = FormWindowState.Minimized
  13.     End Sub
  14.  
  15.     Private Sub DeumosButton3_Click(sender As System.Object, e As System.EventArgs) Handles DeumosButton3.Click
  16.         OpenFileDialog1.ShowDialog()
  17.     End Sub
  18.  
  19.     Private Sub OpenFileDialog1_FileOk(sender As System.Object, e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
  20.         source = OpenFileDialog1.FileName
  21.         DeumosTextBox1.Text = source
  22.         contents = File.ReadAllText(source)
  23.     End Sub
  24.  
  25.     Private Sub DeumosButton4_Click(sender As System.Object, e As System.EventArgs) Handles DeumosButton4.Click
  26.         If DeumosTextBox1.Text = "" Then
  27.             MessageBox.Show("The box in the top of the program cannot be empty!", "Voices Adder", MessageBoxButtons.OK, MessageBoxIcon.Error)
  28.         Else
  29.             Try
  30.                 If Regex.IsMatch(DeumosTextBox4.Text, "(.*)\/(.*)?(.*)?\/(.*)?\.wav?") = False Then
  31.                     MessageBox.Show("That is not a valid voice path.", "Voices Adder", MessageBoxButtons.OK, MessageBoxIcon.Error)
  32.                 Else
  33.                     If DeumosRadioButton1.Checked = True Then
  34.                         File.WriteAllText(source, contents + vbNewLine + "openAura.schema:AddVoice(""Combine"", """ + DeumosTextBox2.Text + """, """ + DeumosTextBox3.Text + """, """ + DeumosTextBox4.Text + """);")
  35.                         DeumosTextBox2.Text = ""
  36.                         DeumosTextBox3.Text = ""
  37.                         DeumosTextBox4.Text = ""
  38.                     Else
  39.                         File.WriteAllText(source, contents + vbNewLine + "Clockwork.schema:AddVoice(""Combine"", """ + DeumosTextBox2.Text + """, """ + DeumosTextBox3.Text + """, """ + DeumosTextBox4.Text + """);")
  40.                         DeumosTextBox2.Text = ""
  41.                         DeumosTextBox3.Text = ""
  42.                         DeumosTextBox4.Text = ""
  43.                     End If
  44.                 End If
  45.             Catch ex As Exception
  46.                 MessageBox.Show("The path specified in the top of the program does not seem to be valid.", "Voices Adder", MessageBoxButtons.OK, MessageBoxIcon.Error)
  47.             End Try
  48.         End If
  49.     End Sub
  50.  
  51.     Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
  52.         DeumosRadioButton1.Checked = True
  53.         If File.Exists(Application.StartupPath + "\sounds.txt" = False) Then
  54.             MessageBox.Show("The sounds.txt file is missing from the program's startup path! This program and the sounds.txt file must be in the same folder.", "Voices Adder", MessageBoxButtons.OK, MessageBoxIcon.Error)
  55.             Me.Close()
  56.         Else
  57.             sounds = File.ReadAllText(Application.StartupPath + "\sounds.txt")
  58.         End If
  59.     End Sub
  60.  
  61.     Private Sub Form1_FormClosing(sender As System.Object, e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
  62.         MessageBox.Show("Created by Duck from TurtleSoup Gaming.", "Voices Adder", MessageBoxButtons.OK, MessageBoxIcon.Information)
  63.     End Sub
  64. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement