Imports System.IO
Imports System.IO.File
Imports System.Net
Imports System.IO.Compression

Public Class Form2


    '
    '
    ' ⟩  Copyright © ⇒ MrDarkSkil ©  ⟨               
    '      ⟩    2014 ⇒ 2015    ⟨
    '
    '    Launcher create for Emodyz©
    '               and 
    '           AltisDev.com
    '
    '    Ne pas changer les crédits !
    ' 



    Dim dTeamSpeak = ""

    Dim t32 = "0"
    Dim t64 = "0"





    Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        FlatProgressBar1.Visible = False
        ' TaskForce
        If Form1.TaskForce = "Enable" Then
        Else
            FlatButton3.Visible = False
        End If

        'Load option start arma 3
        If Form1.startoption = "any" Then
            FlatTextBox1.Text = ""
        Else
            FlatTextBox1.Text = Form1.startoption

        End If

        If Form1.startoption = "any" Then
            FlatCheckBox1.Checked = False
        Else
            FlatCheckBox1.Checked = True
        End If

        'Load Speudo Option
        If Form1.speudo = "NewUser" Then
            FlatTextBox2.Text = ""
        Else
            FlatTextBox2.Text = Form1.speudo
        End If

        If Form1.speudo = "NewUser" Then
            FlatCheckBox2.Checked = False
        Else
            FlatCheckBox2.Checked = True
        End If


    End Sub

    Private Sub FlatButton2_Click(sender As Object, e As EventArgs) Handles FlatButton2.Click
        Me.Close()
    End Sub

    Private Sub FlatButton1_Click(sender As Object, e As EventArgs) Handles FlatButton1.Click
        ' Save option start arma 3
        If FlatCheckBox1.Checked = True Then
            Form1.startoption = FlatTextBox1.Text
        Else
            Form1.startoption = "any"
        End If
        My.Computer.FileSystem.WriteAllText(Form1.appdata & "startoption.a3", Form1.startoption, False)

        ' Save custom speudo
        If FlatCheckBox2.Checked = True Then
            Form1.speudo = FlatTextBox2.Text
        Else
            Form1.speudo = "NewUser"
        End If
        My.Computer.FileSystem.WriteAllText(Form1.appdata & "speudo.a3", Form1.speudo, False)

        Me.Close()
    End Sub

    Private Sub FlatButton3_Click(sender As Object, e As EventArgs) Handles FlatButton3.Click

        FlatButton1.Enabled = False
        FlatButton2.Enabled = False
        My.Computer.FileSystem.WriteAllText(Form1.appdata & "taskforce.txt", "Not Installed", False)

        If My.Computer.FileSystem.FileExists(Form1.darma3 & "arma3.exe") Then
        Else
            MsgBox("Choisissez la destination d'arma3 avant cela !")
            Exit Sub
        End If

        If My.Computer.FileSystem.FileExists("C:\Users\" & Form1.user & "\AppData\Local\TeamSpeak 3 Client\ts3client_win32.exe") Then
            dTeamSpeak = "C:\Users\" & Form1.user & "\AppData\Local\TeamSpeak 3 Client\ts3client_win32.exe"
            My.Computer.FileSystem.WriteAllText(Form1.appdata & "dts3.a3", dTeamSpeak, False)
        End If

        If My.Computer.FileSystem.FileExists("C:\Users\" & Form1.user & "\AppData\Local\TeamSpeak 3 Client\ts3client_win64.exe") Then
            dTeamSpeak = "C:\Users\" & Form1.user & "\AppData\Local\TeamSpeak 3 Client\ts3client_win64.exe"
            My.Computer.FileSystem.WriteAllText(Form1.appdata & "dts3.a3", dTeamSpeak, False)
        End If




        If My.Computer.FileSystem.FileExists(Form1.appdata & "dts3.a3") Then
            dTeamSpeak = My.Computer.FileSystem.ReadAllText(Form1.appdata & "dts3.a3")
        End If

        If My.Computer.FileSystem.FileExists(dTeamSpeak & "ts3client_win64.exe") Or My.Computer.FileSystem.FileExists(dTeamSpeak & "ts3client_win32.exe") Then

        Else
            TeamSpeak.ShowDialog()
            dTeamSpeak = TeamSpeak.SelectedPath & "\"
            My.Computer.FileSystem.WriteAllText(Form1.appdata & "dts3.a3", dTeamSpeak, False)
        End If




        If My.Computer.FileSystem.FileExists(dTeamSpeak & "ts3client_win32.exe") Then
            dTeamSpeak = dTeamSpeak
            t32 = "1"
        End If


        If My.Computer.FileSystem.FileExists(dTeamSpeak & "ts3client_win64.exe") Then
            dTeamSpeak = dTeamSpeak
            t64 = "1"
        End If

        If t64 = "0" And t32 = "0" Then
            MsgBox("Vérifier la destination de TeamSpeak !")
            Exit Sub
        End If

        If UBound(Diagnostics.Process.GetProcessesByName("ts3client_win32")) < 0 Then
        Else
            Dim myProcesses As Process() = Process.GetProcessesByName("ts3client_win32")
            Dim myProcess As Process
            For Each myProcess In myProcesses
                myProcess.Kill()
            Next myProcess
        End If

        If UBound(Diagnostics.Process.GetProcessesByName("ts3client_win64")) < 0 Then
        Else
            Dim myProcesses As Process() = Process.GetProcessesByName("ts3client_win64")
            Dim myProcess As Process
            For Each myProcess In myProcesses
                myProcess.Kill()
            Next myProcess
        End If

        MsgBox("Installation en cour ... Ne touchez a rien !" & vbNewLine & "TeamSpeak va se fermer, ne le réouvrez pas." & vbNewLine & "Attendez jusqu'a la fin de l'opération !", vbInformation)
        FlatButton3.Text = "Installation en cour ...."
        TaskForce.RunWorkerAsync()
    End Sub



    Private Sub TaskForce_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles TaskForce.DoWork
        FlatTextBox1.Visible = False
        FlatTextBox2.Visible = False
        FlatLabel1.Visible = False
        FlatLabel2.Text = "Installation de TaskForce Radio ..."
        FlatProgressBar1.Visible = True
        FlatProgressBar1.Value = FlatProgressBar1.Value + 1
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "\plugins\task_force_radio_win64.dll") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "\plugins\task_force_radio_win64.dll")
        End If

        If My.Computer.FileSystem.FileExists(dTeamSpeak & "\plugins\task_force_radio_win32.dll") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "\plugins\task_force_radio_win32.dll")
        End If

        FlatProgressBar1.Value = FlatProgressBar1.Value + 2
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/task_force_radio_win64.dll", dTeamSpeak & "\plugins\task_force_radio_win64.dll")

        FlatProgressBar1.Value = FlatProgressBar1.Value + 10



        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/task_force_radio_win32.dll", dTeamSpeak & "plugins\task_force_radio_win32.dll")

        FlatProgressBar1.Value = FlatProgressBar1.Value + 10


        ' Crée le premier repétoire
        My.Computer.FileSystem.CreateDirectory(dTeamSpeak & "plugins\radio-sounds-new")
        'Crée les sous répertoires
        My.Computer.FileSystem.CreateDirectory(dTeamSpeak & "plugins\radio-sounds-new\ab")
        My.Computer.FileSystem.CreateDirectory(dTeamSpeak & "plugins\radio-sounds-new\dd")
        My.Computer.FileSystem.CreateDirectory(dTeamSpeak & "plugins\radio-sounds-new\lr")
        My.Computer.FileSystem.CreateDirectory(dTeamSpeak & "plugins\radio-sounds-new\sw")

        'Télécharge ON // OFF
        '' ////
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-new\off.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-new\off.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-new/off.wav", dTeamSpeak & "plugins\radio-sounds-new\off.wav")

        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-new\on.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-new\on.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-new/on.wav", dTeamSpeak & "plugins\radio-sounds-new\on.wav")
        FlatProgressBar1.Value = FlatProgressBar1.Value + 2
        ' ////



        'Télécharge le dossier "ab"
        ' ////
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-new\ab\local_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-new\ab\local_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-new/ab/local_end.wav", dTeamSpeak & "plugins\radio-sounds-new\ab\local_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-new\ab\local_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-new\ab\local_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-new/ab/local_start.wav", dTeamSpeak & "plugins\radio-sounds-new\ab\local_start.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-new\ab\remote_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-new\ab\remote_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-new/ab/remote_end.wav", dTeamSpeak & "plugins\radio-sounds-new\ab\remote_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-new\ab\remote_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-new\ab\remote_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-new/ab/remote_start.wav", dTeamSpeak & "plugins\radio-sounds-new\ab\remote_start.wav")
        FlatProgressBar1.Value = FlatProgressBar1.Value + 2
        ' ////



        'Télécharge le dossier "dd"
        ' ////
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-new\dd\local_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-new\dd\local_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-new/dd/local_end.wav", dTeamSpeak & "plugins\radio-sounds-new\dd\local_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-new\dd\local_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-new\dd\local_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-new/dd/local_start.wav", dTeamSpeak & "plugins\radio-sounds-new\dd\local_start.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-new\dd\remote_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-new\dd\remote_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-new/dd/remote_end.wav", dTeamSpeak & "plugins\radio-sounds-new\dd\remote_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-new\dd\remote_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-new\dd\remote_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-new/dd/remote_start.wav", dTeamSpeak & "plugins\radio-sounds-new\dd\remote_start.wav")
        FlatProgressBar1.Value = FlatProgressBar1.Value + 2
        ' ////



        'Télécharge le dossier "lr"
        ' ////
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-new\lr\local_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-new\lr\local_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-new/lr/local_end.wav", dTeamSpeak & "plugins\radio-sounds-new\lr\local_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-new\lr\local_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-new\lr\local_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-new/lr/local_start.wav", dTeamSpeak & "plugins\radio-sounds-new\lr\local_start.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-new\lr\remote_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-new\lr\remote_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-new/lr/remote_end.wav", dTeamSpeak & "plugins\radio-sounds-new\lr\remote_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-new\lr\remote_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-new\lr\remote_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-new/lr/remote_start.wav", dTeamSpeak & "plugins\radio-sounds-new\lr\remote_start.wav")
        FlatProgressBar1.Value = FlatProgressBar1.Value + 2
        ' ////



        'Télécharge le dossier "sw"
        ' ////
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-new\sw\local_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-new\sw\local_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-new/sw/local_end.wav", dTeamSpeak & "plugins\radio-sounds-new\sw\local_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-new\sw\local_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-new\sw\local_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-new/sw/local_start.wav", dTeamSpeak & "plugins\radio-sounds-new\sw\local_start.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-new\sw\remote_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-new\sw\remote_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-new/sw/remote_end.wav", dTeamSpeak & "plugins\radio-sounds-new\sw\remote_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-new\sw\remote_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-new\sw\remote_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-new/sw/remote_start.wav", dTeamSpeak & "plugins\radio-sounds-new\sw\remote_start.wav")
        FlatProgressBar1.Value = FlatProgressBar1.Value + 2
        ' ////


        My.Computer.FileSystem.CreateDirectory(dTeamSpeak & "plugins\radio-sounds-old")
        'Crée les sous répertoires
        My.Computer.FileSystem.CreateDirectory(dTeamSpeak & "plugins\radio-sounds-old\ab")
        My.Computer.FileSystem.CreateDirectory(dTeamSpeak & "plugins\radio-sounds-old\dd")
        My.Computer.FileSystem.CreateDirectory(dTeamSpeak & "plugins\radio-sounds-old\lr")
        My.Computer.FileSystem.CreateDirectory(dTeamSpeak & "plugins\radio-sounds-old\sw")

        'Télécharge ON // OFF
        '' ////
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-old\off.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-old\off.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-old/off.wav", dTeamSpeak & "plugins\radio-sounds-old\off.wav")

        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-old\on.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-old\on.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-old/on.wav", dTeamSpeak & "plugins\radio-sounds-old\on.wav")
        FlatProgressBar1.Value = FlatProgressBar1.Value + 2
        ' ////


        'Télécharge le dossier "ab"
        ' ////
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-old\ab\local_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-old\ab\local_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-old/ab/local_end.wav", dTeamSpeak & "plugins\radio-sounds-old\ab\local_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-old\ab\local_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-old\ab\local_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-old/ab/local_start.wav", dTeamSpeak & "plugins\radio-sounds-old\ab\local_start.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-old\ab\remote_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-old\ab\remote_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-old/ab/remote_end.wav", dTeamSpeak & "plugins\radio-sounds-old\ab\remote_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-old\ab\remote_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-old\ab\remote_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-old/ab/remote_start.wav", dTeamSpeak & "plugins\radio-sounds-old\ab\remote_start.wav")
        FlatProgressBar1.Value = FlatProgressBar1.Value + 2
        ' ////

        'Télécharge le dossier "dd"
        ' ////
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-old\dd\local_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-old\dd\local_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-old/dd/local_end.wav", dTeamSpeak & "plugins\radio-sounds-old\dd\local_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-old\dd\local_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-old\dd\local_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-old/dd/local_start.wav", dTeamSpeak & "plugins\radio-sounds-old\dd\local_start.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-old\dd\remote_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-old\dd\remote_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-old/dd/remote_end.wav", dTeamSpeak & "plugins\radio-sounds-old\dd\remote_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-old\dd\remote_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-old\dd\remote_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-old/dd/remote_start.wav", dTeamSpeak & "plugins\radio-sounds-old\dd\remote_start.wav")
        FlatProgressBar1.Value = FlatProgressBar1.Value + 2
        ' ////

        'Télécharge le dossier "lr"
        ' ////
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-old\lr\local_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-old\lr\local_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-old/lr/local_end.wav", dTeamSpeak & "plugins\radio-sounds-old\lr\local_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-old\lr\local_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-old\lr\local_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-old/lr/local_start.wav", dTeamSpeak & "plugins\radio-sounds-old\lr\local_start.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-old\lr\remote_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-old\lr\remote_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-old/lr/remote_end.wav", dTeamSpeak & "plugins\radio-sounds-old\lr\remote_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-old\lr\remote_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-old\lr\remote_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-old/lr/remote_start.wav", dTeamSpeak & "plugins\radio-sounds-old\lr\remote_start.wav")
        FlatProgressBar1.Value = FlatProgressBar1.Value + 2
        ' ////

        'Télécharge le dossier "sw"
        ' ////
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-old\sw\local_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-old\sw\local_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-old/sw/local_end.wav", dTeamSpeak & "plugins\radio-sounds-old\sw\local_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-old\sw\local_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-old\sw\local_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-old/sw/local_start.wav", dTeamSpeak & "plugins\radio-sounds-old\sw\local_start.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-old\sw\remote_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-old\sw\remote_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-old/sw/remote_end.wav", dTeamSpeak & "plugins\radio-sounds-old\sw\remote_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds-old\sw\remote_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds-old\sw\remote_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds-old/sw/remote_start.wav", dTeamSpeak & "plugins\radio-sounds-old\sw\remote_start.wav")
        FlatProgressBar1.Value = FlatProgressBar1.Value + 2
        ' ////

        My.Computer.FileSystem.CreateDirectory(dTeamSpeak & "plugins\radio-sounds")
        'Crée les sous répertoires
        My.Computer.FileSystem.CreateDirectory(dTeamSpeak & "plugins\radio-sounds\ab")
        My.Computer.FileSystem.CreateDirectory(dTeamSpeak & "plugins\radio-sounds\dd")
        My.Computer.FileSystem.CreateDirectory(dTeamSpeak & "plugins\radio-sounds\lr")
        My.Computer.FileSystem.CreateDirectory(dTeamSpeak & "plugins\radio-sounds\sw")

        'Télécharge ON // OFF
        '' ////
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds\off.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds\off.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds/off.wav", dTeamSpeak & "plugins\radio-sounds\off.wav")

        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds\on.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds\on.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds/on.wav", dTeamSpeak & "plugins\radio-sounds\on.wav")
        FlatProgressBar1.Value = FlatProgressBar1.Value + 2
        ' ////


        'Télécharge le dossier "ab"
        ' ////
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds\ab\local_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds\ab\local_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds/ab/local_end.wav", dTeamSpeak & "plugins\radio-sounds\ab\local_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds\ab\local_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds\ab\local_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds/ab/local_start.wav", dTeamSpeak & "plugins\radio-sounds\ab\local_start.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds\ab\remote_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds\ab\remote_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds/ab/remote_end.wav", dTeamSpeak & "plugins\radio-sounds\ab\remote_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds\ab\remote_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds\ab\remote_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds/ab/remote_start.wav", dTeamSpeak & "plugins\radio-sounds\ab\remote_start.wav")
        FlatProgressBar1.Value = FlatProgressBar1.Value + 2
        ' ////

        'Télécharge le dossier "dd"
        ' ////
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds\dd\local_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds\dd\local_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds/dd/local_end.wav", dTeamSpeak & "plugins\radio-sounds\dd\local_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds\dd\local_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds\dd\local_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds/dd/local_start.wav", dTeamSpeak & "plugins\radio-sounds\dd\local_start.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds\dd\remote_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds\dd\remote_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds/dd/remote_end.wav", dTeamSpeak & "plugins\radio-sounds\dd\remote_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds\dd\remote_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds\dd\remote_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds/dd/remote_start.wav", dTeamSpeak & "plugins\radio-sounds\dd\remote_start.wav")
        FlatProgressBar1.Value = FlatProgressBar1.Value + 2
        ' ////

        'Télécharge le dossier "lr"
        ' ////
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds\lr\local_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds\lr\local_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds/lr/local_end.wav", dTeamSpeak & "plugins\radio-sounds\lr\local_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds\lr\local_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds\lr\local_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds/lr/local_start.wav", dTeamSpeak & "plugins\radio-sounds\lr\local_start.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds\lr\remote_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds\lr\remote_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds/lr/remote_end.wav", dTeamSpeak & "plugins\radio-sounds\lr\remote_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds\lr\remote_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds\lr\remote_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds/lr/remote_start.wav", dTeamSpeak & "plugins\radio-sounds\lr\remote_start.wav")
        FlatProgressBar1.Value = FlatProgressBar1.Value + 2
        ' ////

        'Télécharge le dossier "sw"
        ' ////
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds\sw\local_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds\sw\local_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds/sw/local_end.wav", dTeamSpeak & "plugins\radio-sounds\sw\local_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds\sw\local_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds\sw\local_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds/sw/local_start.wav", dTeamSpeak & "plugins\radio-sounds\sw\local_start.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds\sw\remote_end.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds\sw\remote_end.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds/sw/remote_end.wav", dTeamSpeak & "plugins\radio-sounds\sw\remote_end.wav")
        If My.Computer.FileSystem.FileExists(dTeamSpeak & "plugins\radio-sounds\sw\remote_start.wav") Then
            My.Computer.FileSystem.DeleteFile(dTeamSpeak & "plugins\radio-sounds\sw\remote_start.wav")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio-sounds/sw/remote_start.wav", dTeamSpeak & "plugins\radio-sounds\sw\remote_start.wav")
        FlatProgressBar1.Value = FlatProgressBar1.Value + 2
        ' ////

        'Download userconfig
        My.Computer.FileSystem.CreateDirectory(Form1.darma3 & "userconfig")
        My.Computer.FileSystem.CreateDirectory(Form1.darma3 & "userconfig\task_force_radio")
        If My.Computer.FileSystem.FileExists(Form1.darma3 & "userconfig\task_force_radio\radio_settings.hpp") Then
            My.Computer.FileSystem.DeleteFile(Form1.darma3 & "userconfig\task_force_radio\radio_settings.hpp")
        End If
        My.Computer.Network.DownloadFile(Form1.ftp & Form1.dtask & "/plugins/radio_settings.hpp", Form1.darma3 & "userconfig\task_force_radio\radio_settings.hpp")
        FlatProgressBar1.Value = FlatProgressBar1.Value + 2

        'Termine l'opération

        FlatProgressBar1.Value = 100
        FlatTextBox1.Visible = True
        FlatTextBox2.Visible = True
        FlatLabel1.Visible = True
        FlatLabel2.Text = "Installation terminée !"
        FlatButton3.Text = "Installer TaskForce"
        FlatProgressBar1.Visible = False
        FlatButton1.Enabled = True
        FlatButton2.Enabled = True

        FlatLabel2.Text = "Speudo IG:"
        My.Computer.FileSystem.WriteAllText(Form1.appdata & "taskforce.txt", "Installed", False)

        MsgBox("TaskForce radio à bien été installé !" & vbNewLine & vbNewLine & "Veuillez vous rendre dans votre TeamSpeak, une fois dans votre TeamSpeak  " & vbNewLine & "allez dans les options TeamSpeak, puis cliquer sur ""Plugins"" et activer le plugin "" Task Force Arma 3 Radio ""  " & vbNewLine & "Il ne vous reste plus qu'a aller dans le jeux et parler :D")

        If Form1.portTS = "none" Then
            Process.Start("ts3server://" & Form1.ipTS)
        Else
            Process.Start("ts3server://" & Form1.ipTS & "?port=" & Form1.portTS)
        End If
    End Sub



End Class