Untitled

 avatar
unknown
plain_text
3 years ago
13 kB
2
Indexable
Public Class Partner

    'Make PLong "Public" to use
    Private ReadOnly PLong As New List(Of String)
    Private ReadOnly PAddLong As New List(Of String)
    Private Sub GunaRadioButton_PLong_CheckedChanged(sender As Object, e As EventArgs) Handles GunaRadioButton_PLong.CheckedChanged

        If Not GunaRadioButton_PLong.Checked Then Return
        'Read File & Split PLong
        Dim lines As String() = System.IO.File.ReadAllLines("Files\Partners\Long.txt")
        PLong.Clear()
        ComboBox_PItem.Items.Clear()
        TextBox_PCommand.Clear()
        For Each line As String In lines
            Dim parts As String() = line.Split(","c)
            ComboBox_PItem.Items.Add(parts(0))
            PLong.Add(parts(1))
            PAddLong.Add(parts(2))
        Next
        ComboBox_PItem.SelectedIndex = -1
        '<<<------>>>
        CreateNewCommandTextP()
        CreateNewCommandTextPAdd()
        GunaImageButton_ClipP.Visible = False

    End Sub

    'Make PShort "Public" to use
    Private ReadOnly PShort As New List(Of String)
    Private ReadOnly PAddShort As New List(Of String)
    Private Sub GunaRadioButton_PShort_CheckedChanged(sender As Object, e As EventArgs) Handles GunaRadioButton_PShort.CheckedChanged

        If Not GunaRadioButton_PShort.Checked Then Return
        'Read File & Split PShort
        Dim lines As String() = System.IO.File.ReadAllLines("Files\Partners\Short.txt")
        PShort.Clear()
        ComboBox_PItem.Items.Clear()
        TextBox_PCommand.Clear()
        For Each line As String In lines
            Dim parts As String() = line.Split(","c)
            ComboBox_PItem.Items.Add(parts(0))
            PShort.Add(parts(1))
            PAddShort.Add(parts(2))
        Next
        ComboBox_PItem.SelectedIndex = -1
        '<<<------>>>
        CreateNewCommandTextP()
        CreateNewCommandTextPAdd()
        GunaImageButton_ClipP.Visible = False

    End Sub

    'Make PMagic "Public" to use
    Private ReadOnly PMagic As New List(Of String)
    Private ReadOnly PAddMagic As New List(Of String)
    Private Sub GunaRadioButton_PMagic_CheckedChanged(sender As Object, e As EventArgs) Handles GunaRadioButton_PMagic.CheckedChanged

        If Not GunaRadioButton_PMagic.Checked Then Return
        'Read File & Split PMagic
        Dim lines As String() = System.IO.File.ReadAllLines("Files\Partners\Magic.txt")
        PMagic.Clear()
        ComboBox_PItem.Items.Clear()
        TextBox_PCommand.Clear()
        For Each line As String In lines
            Dim parts As String() = line.Split(","c)
            ComboBox_PItem.Items.Add(parts(0))
            PMagic.Add(parts(1))
            PAddMagic.Add(parts(2))
        Next
        ComboBox_PItem.SelectedIndex = -1
        '<<<------>>>
        CreateNewCommandTextP()
        CreateNewCommandTextPAdd()
        GunaImageButton_ClipP.Visible = False

    End Sub

    'Make PSkins "Public" to use
    Private ReadOnly PSkins As New List(Of String)
    Private Sub GunaRadioButton_PSkins_CheckedChanged(sender As Object, e As EventArgs) Handles GunaRadioButton_PSkins.CheckedChanged

        If GunaRadioButton_PSkins.Checked Then
            Label_PAmount.Visible = True
            TextBox_PAmount.Visible = True
        Else
            ComboBox_PItem.SelectedIndex = -1
            Label_PAmount.Visible = False
            TextBox_PAmount.Visible = False
        End If

        If Not GunaRadioButton_PSkins.Checked Then Return
        'Read File & Split PSkins
        Dim lines As String() = System.IO.File.ReadAllLines("Files\Partners\Skins.txt")
        PSkins.Clear()
        ComboBox_PItem.Items.Clear()
        TextBox_PCommand.Clear()
        For Each line As String In lines
            Dim parts As String() = line.Split(","c)
            ComboBox_PItem.Items.Add(parts(0))
            PSkins.Add(parts(1))
        Next
        ComboBox_PItem.SelectedIndex = -1
        '<<<------>>>
        CreateNewCommandTextP()
        GunaImageButton_ClipP.Visible = False

    End Sub

    Private Sub CreateNewCommandTextP()

        If Not GunaRadioButton_PLong.Checked AndAlso Not GunaRadioButton_PShort.Checked AndAlso Not GunaRadioButton_PMagic.Checked AndAlso Not GunaRadioButton_PSkins.Checked OrElse ComboBox_PItem.SelectedIndex = -1 Then Return
        Dim CommandTextP = "$ci "

        'edit command
        If GunaCheckBox_PE.Checked AndAlso Not String.IsNullOrEmpty(TextBox_PName.Text) Then
            CommandTextP = "$edit " + TextBox_PName.Text + " " + CommandTextP
        End If

        'special command (uses standard or edit prefix)
        If GunaCheckBox_PBead.Checked Then
            CommandTextP &= "286"
            Return
        End If

        Select Case True
            Case GunaRadioButton_PLong.Checked : CommandTextP &= PLong(ComboBox_PItem.SelectedIndex)
            Case GunaRadioButton_PShort.Checked : CommandTextP &= PShort(ComboBox_PItem.SelectedIndex)
            Case GunaRadioButton_PMagic.Checked : CommandTextP &= PMagic(ComboBox_PItem.SelectedIndex)
            Case GunaRadioButton_PSkins.Checked : CommandTextP &= PSkins(ComboBox_PItem.SelectedIndex)
        End Select

        If TextBox_PAmount.Text = "0" Or "1" Then
            CommandTextP &= " "
            If TextBox_PAmount.Text > "1" Then
                CommandTextP &= TextBox_PAmount.Text
            End If
        End If

        If GunaCheckBox_PE.Checked Then
            TextBox_PCommand.Text = "$edit " + TextBox_PName.Text + " " + CommandTextP
        Else
            TextBox_PCommand.Text = CommandTextP
        End If

    End Sub

    Private Sub CreateNewCommandTextPAdd()

        If Not GunaRadioButton_PLong.Checked AndAlso Not GunaRadioButton_PShort.Checked AndAlso Not GunaRadioButton_PMagic.Checked AndAlso Not GunaCheckBox_PE.Checked OrElse ComboBox_PItem.SelectedIndex = -1 Then Return
        Dim CommandTextPAdd = "$AddPartner "
        Select Case True
            Case GunaRadioButton_PLong.Checked : CommandTextPAdd &= PAddLong(ComboBox_PItem.SelectedIndex)
            Case GunaRadioButton_PShort.Checked : CommandTextPAdd &= PAddShort(ComboBox_PItem.SelectedIndex)
            Case GunaRadioButton_PMagic.Checked : CommandTextPAdd &= PAddMagic(ComboBox_PItem.SelectedIndex)
        End Select

        If TextBox_PLevel.ToString <> "0" Then
            CommandTextPAdd &= " "
            If TextBox_PLevel.Text <> "0" Then CommandTextPAdd &= TextBox_PLevel.Text
        End If

        If GunaCheckBox_PAdd.Checked AndAlso GunaCheckBox_PE.Checked Then
            TextBox_PCommand.Text = "$edit " + TextBox_PName.Text + " " + CommandTextPAdd
        Else
            TextBox_PCommand.Text = CommandTextPAdd
        End If
    End Sub

    Private Sub ComboBox_PItem_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox_PItem.SelectedIndexChanged

        If GunaCheckBox_PAdd.Checked Then
            CreateNewCommandTextPAdd()
        Else
            CreateNewCommandTextP()
        End If

    End Sub

    Private Sub TextBox_PLevel_TextChanged(sender As Object, e As EventArgs) Handles TextBox_PLevel.TextChanged

        CreateNewCommandTextP()

    End Sub

    Private Sub TextBox_PAmount_TextChanged(sender As Object, e As EventArgs) Handles TextBox_PAmount.TextChanged

        If GunaCheckBox_PAdd.Checked Then
            CreateNewCommandTextPAdd()
        Else
            CreateNewCommandTextP()
        End If

    End Sub

    Private Sub GunaCheckBox_PE_CheckedChanged(sender As Object, e As EventArgs) Handles GunaCheckBox_PE.CheckedChanged

        If GunaCheckBox_PE.Checked Then
            Label_PName.Visible = True
            TextBox_PName.Visible = True
        Else
            Label_PName.Visible = False
            TextBox_PName.Visible = False
        End If

        If GunaCheckBox_PE.Checked AndAlso GunaCheckBox_PBead.Checked Then
            TextBox_PCommand.Clear()
            TextBox_PCommand.Text = "$edit " + TextBox_PName.Text + " " + "$ci 286"
        Else
            TextBox_PCommand.Clear()
        End If

        If GunaCheckBox_PAdd.Checked Then
            CreateNewCommandTextPAdd()
        Else
            CreateNewCommandTextP()
        End If

        If GunaCheckBox_PE.Checked AndAlso GunaCheckBox_PBead.Checked Then
            GunaCheckBox_PAdd.Checked = False
        End If

        If GunaCheckBox_PE.Checked AndAlso GunaCheckBox_PAdd.Checked Then
            GunaCheckBox_PBead.Checked = False
        End If

    End Sub

    Private Sub GunaCheckBoxPBead_CheckedChanged(sender As Object, e As EventArgs) Handles GunaCheckBox_PBead.CheckedChanged

        If GunaCheckBox_PBead.Checked Then
            TextBox_PCommand.Text = "$ci 286"
        Else
            TextBox_PCommand.Clear()
            GunaImageButton_ClipP.Visible = False
        End If

        If GunaCheckBox_PBead.Checked Then
            Label_PItem.Visible = False
            ComboBox_PItem.Visible = False
            Label_PLevel.Visible = False
            TextBox_PLevel.Visible = False
        Else
            Label_PItem.Visible = True
            ComboBox_PItem.Visible = True
            Label_PLevel.Visible = True
            TextBox_PLevel.Visible = True
        End If

        If GunaCheckBox_PBead.Checked AndAlso GunaCheckBox_PE.Checked Then
            TextBox_PCommand.Clear()
            TextBox_PCommand.Text = "$edit " + TextBox_PName.Text + " " + "$ci 286"
        End If

        If GunaCheckBox_PE.Checked AndAlso GunaCheckBox_PBead.Checked Then
            GunaCheckBox_PAdd.Checked = False
        End If

        If GunaCheckBox_PBead.Checked Then
            GunaCheckBox_PAdd.Checked = False
        End If

    End Sub

    Private Sub TextBox_PName_TextChanged(sender As Object, e As EventArgs) Handles TextBox_PName.TextChanged

        If GunaCheckBox_PAdd.Checked Then
            CreateNewCommandTextPAdd()
        Else
            CreateNewCommandTextP()
        End If

        If GunaCheckBox_PBead.Checked AndAlso GunaCheckBox_PE.Checked Then
            TextBox_PCommand.Clear()
            TextBox_PCommand.Text = "$edit " + TextBox_PName.Text + " " + "$ci 286"
        End If

    End Sub

    Private Sub GunaCheckBox_PAdd_CheckedChanged(sender As Object, e As EventArgs) Handles GunaCheckBox_PAdd.CheckedChanged

        If GunaCheckBox_PAdd.Checked Then
            CreateNewCommandTextPAdd()
        Else
            CreateNewCommandTextP()
        End If

        If GunaCheckBox_PE.Checked And GunaCheckBox_PAdd.Checked Then
            Label_PName.Visible = True
            TextBox_PName.Visible = True
            CreateNewCommandTextPAdd()
        Else
            CreateNewCommandTextP()
        End If

        If GunaCheckBox_PAdd.Checked Then
            Label_PLevel.Visible = True
            TextBox_PLevel.Visible = True
            CreateNewCommandTextPAdd()
        Else
            Label_PLevel.Visible = False
            TextBox_PLevel.Visible = False
            CreateNewCommandTextP()
        End If

        If GunaCheckBox_PAdd.Checked Then
            GunaCheckBox_PBead.Checked = False
        End If

        If GunaCheckBox_PE.Checked AndAlso GunaCheckBox_PBead.Checked Then
            TextBox_PCommand.Clear()
            TextBox_PCommand.Text = "$edit " + TextBox_PName.Text + " " + "$ci 286"
        Else
            If GunaCheckBox_PBead.Checked Then
                TextBox_PCommand.Text = "$ci 286"
            Else
                GunaImageButton_ClipP.Visible = False
                TextBox_PCommand.Clear()
            End If
        End If

    End Sub

    Private Sub TextBox_PCommand_TextChanged(sender As Object, e As EventArgs) Handles TextBox_PCommand.TextChanged

        'When Empty don't show Clipboard Icon
        If TextBox_PCommand.Text = "" Then
            GunaImageButton_ClipP.Visible = False
        End If
        '<<<------>>>

        'Show Clipboard Icon & Hide Checkmark Icon
        GunaImageButton_ClipP.Visible = True
        GunaImageButton_CheckmarkP.Visible = False
        '<<<------>>>

        CreateNewCommandTextP()

        If GunaCheckBox_PAdd.Checked Then
            CreateNewCommandTextPAdd()
        Else
            CreateNewCommandTextP()
        End If

    End Sub

    Private Sub GunaImageButton_ClipP_Click(sender As Object, e As EventArgs) Handles GunaImageButton_ClipP.Click

        'No P Clipboard when TextBox is Empty
        If TextBox_PCommand.Text = "" Then
            Exit Sub
        End If
        '<<<------>>>

        'Clipboard Function
        Clipboard.SetText(TextBox_PCommand.Text)
        '<<<------>>>

    End Sub

    Private Sub GunaImageButton_ClipP_MouseClick(sender As Object, e As MouseEventArgs) Handles GunaImageButton_ClipP.MouseClick

        'P Hide Clipboard Icon & Show Checkmark Icon
        GunaImageButton_ClipP.Visible = False
        GunaImageButton_CheckmarkP.Visible = True
        '<<<------>>>

    End Sub

End Class
Editor is loading...