Imports System.Text

Public Class SRQ_Writer
    Dim fm As New FileManagent
    Dim apppath As String = Application.StartupPath
    Dim Basics As String = apppath & "\database\Basics"
    Dim srq As String = apppath & "\database\Basics\srq"
    Dim rrq As String = apppath & "\database\Basics\rrq"
    Dim airq As String = apppath & "\database\Basics\airq"

    Private Sub SRQ_Writer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox1.ReadOnly = True
        TextBox2.ReadOnly = True
        TextBox3.ReadOnly = True

        TextBox1.Text = fm.ListAllFileInDirectory(srq, ".adf")
        TextBox2.Text = fm.ListAllFileInDirectory(rrq, ".adf")
        TextBox3.Text = fm.ListAllFileInDirectory(airq, ".adf")
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        If ListBox1.SelectedItem = Nothing Then
        Else
            ListBox1.Items.Remove(ListBox1.SelectedItem)
        End If
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        If ListBox1.Items.Contains(TextBox15.Text) = True Then
            MsgBox("該回答已經存在！", MsgBoxStyle.Exclamation)
        Else
            ListBox1.Items.Add(TextBox15.Text)
            ListBox1.Refresh()
        End If

    End Sub

    Private Sub TextBox1_MouseEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.MouseEnter
        TextBox1.ReadOnly = True

    End Sub

   
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim sb As New StringBuilder
        sb.AppendLine("*/KeyWord=" & TextBox4.Text)
        sb.AppendLine("*/Sub-Key=")
        sb.AppendLine(TextBox7.Text)
        sb.AppendLine(TextBox8.Text)
        sb.AppendLine(TextBox9.Text)
        sb.AppendLine("*/EndSub-Key")
        sb.AppendLine("*/Properties")
        If CheckBox1.Checked = True Then
            sb.AppendLine("*/ExpressionMode=")
            sb.AppendLine(TextBox5.Text)
            sb.AppendLine(TextBox6.Text)
            sb.AppendLine("*/EndExpressionMode")
        End If
        If CheckBox2.Checked = True Then
            sb.AppendLine("*/ForceResponce=True")
        Else
            sb.AppendLine("*/ForceResponce=False")
        End If
        If CheckBox3.Checked = True Then
            sb.AppendLine("*/InstantResponce=True")
        Else
            sb.AppendLine("*/InstantResponce=False")
        End If
        If CheckBox4.Checked = True Then
            sb.AppendLine("*/KnownLevel=" & NumericUpDown1.Value)
        End If
        If CheckBox5.Checked = True Then
            sb.AppendLine("*/ContainNull=True")
        Else
            sb.AppendLine("*/ContainNull=False")
        End If
        sb.AppendLine("*/Contant=")
        sb.AppendLine(TextBox10.Text)
        sb.AppendLine("*/EndContant")
        fm.WriteAndCreateFile(srq, sb.ToString)
    End Sub
End Class