Neuling hat eine Frage zum Auslesen von Dateinamen aus txt und dem Löschen dieser Namen

  • VB.NET
  • .NET (FX) 3.0–3.5

Es gibt 55 Antworten in diesem Thema. Der letzte Beitrag () ist von Julius_xD.

    Neuling hat eine Frage zum Auslesen von Dateinamen aus txt und dem Löschen dieser Namen

    Hey :)

    Habe da mal eine Frage an die Profis:

    Ich will aus einer txt Datei Dateinamen auslesen können.

    in dieser txt stehen denn Dateinamen (z.b. Löschmich.txt und Test.exe)

    Und die Dateinamen die in der TXT angegeben sind soll er auf dem Pc suchen und wenn vorhanden Löschen!

    Mein Problem ist nun, das ich im WWW keine Passenden Antworten gefunden habe und währe euch deshalb sehr Dankbar!

    Gruß,
    If My.Computer.FileSystem.FileExists(appdata & listmods) Then
    Dim StartLöschen As String() = File.ReadAllLines(appdata & listmods)
    ligne = line(nbr_ligne)
    tligne = line.Length

    (appdata wurde weiter oben im Code als Pfad für den Ordner genommen wo die txt drinne liegt (und die txt wurde auch als listmods definiert))

    Soweit habe ich die txt denn ja ausgelesen.... und nun?

    Sorry für all diese Doofen Fragen :)


    Gruß,
    Nimm doch für Verknüpfung von zwei Pfaden Path.Combine.

    Und niemals Umlaute für Variablennamen nutzen!

    Zudem, was soll die Variable "ligne"? Der Inhalt der Datei befindet sich jetzt in dem Array "StartLoeschen". Jeder Eintrag repräsentiert eine Zeile der Datei.
    Spoiler anzeigen

    Quellcode

    1. Imports System.Net
    2. Imports System.IO
    3. Imports System.Net.Mail
    4. Public Class Form1
    5. '
    6. '
    7. ' ⟩ Copyright © ⇒ MrDarkSkil © ⟨
    8. ' ⟩ 2014 ⇒ 2015 ⟨
    9. '
    10. ' Launcher create for Emodyz©
    11. ' and
    12. ' AltisDev.com
    13. '
    14. ' Ne pas changer les crédits !
    15. '
    16. ' Merci de bien vouloir ne pas changer les crédits de base qui ce trouve plus bas dans le code ( sinon votre launcher seras inutilisable ! )
    17. ' Important, A changer !
    18. Public ftp = "http://5.135.11.121/" ' Serveur ou ce trouve tout les fichier nessésaire au launcher
    19. Public servername = "artofrp"
    20. Public modsname = "@artofrp" 'Config Arma 3 'Config site web // forum
    21. Public website = "http://artofrp.de/" 'Le lien de votre site, forum ou autres
    22. Public ipserveur = "89.163.160.214:2302" 'Ip de votre serveur arma3
    23. Public servpassword = "_____________" 'Mot de passe de votre serveur ( préférable contre les hacks ! )
    24. 'Config TeamSpeak
    25. Public ipTS = "ts.artofrp.de" ' Ip de votre teamspeak ( sans les port " 0.0.0.127:25564 vous mettez juste sa 0.0.0.127 "
    26. Public portTS = "none" 'Le port de votre teamspeak ( si vous n'en avez pas mettez " none " )
    27. 'Config launcher
    28. Public extention = "ArtOfRp-Serverlauncher.exe" 'Mettez le nom que votre launcher auras en .exe ( "exemple: emodyz.exe ") puis uploader le launcher sur le FTP
    29. Public TaskForce = "Disable" 'PAS ENCORE OPERATIONNEL ! 'Mettez si oui ou non la possiblilité d'installer TaskForce est disponible ( "Enable" = Activé "Disable" = Désactivé )
    30. 'Non des fichier qui donne des infos au launcher !
    31. Public listmods = "modspack.txt" 'Liste des mods
    32. Public message = "news.txt" 'Les news du launcher
    33. Public deletepack = "deletepack.txt" 'Le pack pour surprimer les mods
    34. Public modcpp = "mod.cpp" 'Le mod.cpp
    35. Public logocpp = "logo.paa" 'Le logo.paa
    36. 'Crédits (Vous ne pouvez qu'ajouter votre nom ici et le nom de votre serveur, NE PAS CHANGER LES CREDITS QUI ME SONT PROPRES ! )
    37. Dim crédits = "Erstellt von: VotreNomIci " & vbNewLine & "für den Server" & servername
    38. 'information Version
    39. Public vlauncher = "vlauncher.txt" ' Le fichier ou est inscript la dernière version du launcher
    40. 'info adresse email
    41. Public email = "leohub@live.fr" 'Votre adresse email ( pour recevoir les allerts de cheat !)
    42. 'Direction utiles
    43. Public dmods = "mods" ' la direction sur le ftp ou les mods sont upload
    44. Public dcpp = "cpp" ' la direction sur le ftp ou le mod.cpp et logo.paa sont upload
    45. Public dversion = "version" 'la direction ou tout les fichier renseignant les version à savoir sont
    46. Public dlauncher As String = Application.StartupPath & "\" ' Ne pas changer !!
    47. Public darma3 As String = "C:\Program Files (x86)\Steam\SteamApps\common\Arma 3\" 'La destination de base ou ce cache peu être arma3
    48. 'Option Launcher
    49. Public startoption = "-skipIntro" 'Option de lancement de base ( NE PAS CHANGER !)
    50. Public speudo = "NewUser" 'Speudo de base ( NE PAS CHANGER !)
    51. 'Information anex ( Ne pas changer )
    52. Public vlaunch As String = Application.ProductVersion ' NE PAS CHANGER
    53. Public newsmessage As String = "Wird geladen..." 'NE PAS CHANGER
    54. Public appdata As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\" & servername & "\" ' Destination ou le launcher a besoin de mettre les fichier.
    55. Public user As String = Environment.UserName 'Detecte le nom d'utilisateur du PC
    56. Public internet As String 'NE PAS CHANGER
    57. ' Congiguration sensible ! ( Don't Touch ) ( NE PAS TOUCHER )
    58. Dim nbr_ligne As Integer = 0
    59. Dim ligne As String
    60. Dim tligne As String
    61. Dim totalBytes As Double
    62. Dim bytesIn As Double
    63. Dim AntiCheatRead
    64. Dim bytes As Integer
    65. Dim download = "defalt"
    66. Dim nbrdownload = "0"
    67. Dim nbr_delete = "0"
    68. Dim clock
    69. Dim deletel
    70. Dim tdelete
    71. Dim finish = "false"
    72. Dim dfinish = "false"
    73. Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    74. '
    75. '
    76. ' ⟩ Copyright © ⇒ MrDarkSkil © ⟨
    77. ' ⟩ 2014 ⇒ 2015 ⟨
    78. '
    79. ' Launcher create for Emodyz©
    80. ' and
    81. ' AltisDev
    82. '
    83. ' Ne pas changer les crédits !
    84. '
    85. PictureBox3.Visible = False
    86. PictureBox7.Visible = False
    87. If My.Computer.FileSystem.FileExists("UP.exe") Then
    88. My.Computer.FileSystem.DeleteFile("UP.exe")
    89. End If
    90. If My.Computer.FileSystem.FileExists("site.txt") Then
    91. My.Computer.FileSystem.DeleteFile("site.txt")
    92. End If
    93. If My.Computer.FileSystem.FileExists("update.txt") Then
    94. My.Computer.FileSystem.DeleteFile("update.txt")
    95. End If
    96. If My.Computer.FileSystem.FileExists(appdata & "startoption.a3") Then
    97. startoption = My.Computer.FileSystem.ReadAllText(appdata & "startoption.a3")
    98. End If
    99. If My.Computer.FileSystem.FileExists(appdata & "speudo.a3") Then
    100. speudo = My.Computer.FileSystem.ReadAllText(appdata & "speudo.a3")
    101. End If
    102. My.Computer.FileSystem.CreateDirectory(appdata)
    103. ' Change les textes perssonalisé du launcher
    104. FormSkin1.Text = " " & servername
    105. FlatLabel1.Text = "v. " & vlaunch
    106. ' Demande le choix de la destination Arma3
    107. If My.Computer.FileSystem.FileExists(appdata & "destination.a3") Then
    108. darma3 = My.Computer.FileSystem.ReadAllText(appdata & "destination.a3")
    109. If My.Computer.FileSystem.FileExists(darma3 & "arma3.exe") Then
    110. Else
    111. MsgBox("Das angegebene Ziel ist ungültig!" & vbNewLine & "Vor dem Herunterladen des Mods den Pfad überprüfen!")
    112. End If
    113. Else
    114. If My.Computer.FileSystem.FileExists(darma3 & "arma3.exe") Then
    115. darma3 = ("C:\Program Files (x86)\Steam\SteamApps\common\Arma 3\")
    116. Else
    117. Folder.ShowDialog()
    118. darma3 = Folder.SelectedPath & "\"
    119. My.Computer.FileSystem.WriteAllText(appdata & "destination.a3", darma3, False)
    120. End If
    121. If My.Computer.FileSystem.FileExists(darma3 & "arma3.exe") Then
    122. Else
    123. MsgBox("Der angebene Pfad ist nicht richtig!")
    124. End If
    125. End If
    126. FlatLabel2.Text = ("Arma3 Pfad: " & darma3)
    127. ' On run les news, mise à jour
    128. If My.Computer.Network.IsAvailable Then
    129. DownloadOther.RunWorkerAsync()
    130. News.RunWorkerAsync()
    131. Else
    132. FlatButton1.Enabled = False
    133. FlatStatusBar1.Text = "Fehler: Keine Internetverbindung!"
    134. End If
    135. End Sub
    136. Private Sub News_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles News.DoWork
    137. 'System de news ( chargement du message )
    138. Do
    139. Dim newsstream As String = ftp & message
    140. Dim clientnews As WebClient = New WebClient()
    141. Dim reader As StreamReader = New StreamReader(clientnews.OpenRead(newsstream))
    142. Dim messagerequest = reader.ReadLine
    143. Dim maintenance = reader.ReadLine
    144. If maintenance = "1" Then
    145. newsmessage = "Der Launcher befindet sich im Wartungsmodus!"
    146. PictureBox7.Visible = True
    147. PictureBox7.BringToFront()
    148. FlatButton1.Enabled = False
    149. Else
    150. newsmessage = "Nachricht: " & messagerequest
    151. PictureBox7.Visible = False
    152. FlatButton1.Enabled = True
    153. End If
    154. FlatStatusBar1.Text = newsmessage
    155. If maintenance = "0" Then
    156. Exit Sub
    157. End If
    158. Threading.Thread.Sleep(10000)
    159. Loop
    160. End Sub
    161. Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click
    162. Process.Start(website)
    163. End Sub
    164. Private Sub FlatButton2_Click(sender As Object, e As EventArgs) Handles FlatButton2.Click
    165. If user = "MrDarkSkil" Then
    166. MsgBox("Ersteller")
    167. End If
    168. MsgBox("Erstellt von Léo alias MrDarkSkil" & vbNewLine & vbNewLine & "für Emodyz.com und AltisDev.com" & vbNewLine & vbNewLine & crédits, MsgBoxStyle.Information)
    169. End Sub
    170. Private Sub FlatButton3_Click(sender As Object, e As EventArgs) Handles FlatButton3.Click
    171. Process.Start(website)
    172. End Sub
    173. Private Sub FlatButton4_Click(sender As Object, e As EventArgs) Handles FlatButton4.Click
    174. If portTS = "none" Then
    175. Process.Start("ts3server://" & ipTS)
    176. Else
    177. Process.Start("ts3server://" & ipTS & "?port=" & portTS)
    178. End If
    179. End Sub
    180. Private Sub FlatButton5_Click(sender As Object, e As EventArgs) Handles FlatButton5.Click
    181. Folder.ShowDialog()
    182. darma3 = Folder.SelectedPath & "\"
    183. FlatLabel2.Text = ("Arma3 Pfad: " & darma3)
    184. If My.Computer.FileSystem.FileExists(darma3 & "arma3.exe") Then
    185. Else
    186. MsgBox("Der angegebene Pfad ist ungültig")
    187. End If
    188. If My.Computer.FileSystem.FileExists(appdata & "destination.a3") Then
    189. My.Computer.FileSystem.DeleteFile(appdata & "destination.a3")
    190. End If
    191. My.Computer.FileSystem.WriteAllText(appdata & "destination.a3", darma3, False)
    192. End Sub
    193. Private Sub FlatButton1_Click(sender As Object, e As EventArgs) Handles FlatButton1.Click
    194. If finish = "false" Then
    195. FlatButton1.Visible = False
    196. FlatButton5.Visible = False
    197. MsgBox("Bitte warten Sie einige Sekunden, während der Launcher alles was er braucht herunterlädt!")
    198. Exit Sub
    199. End If
    200. If My.Computer.FileSystem.FileExists(darma3 & "arma3.exe") Then
    201. If dfinish = "false" Then
    202. 'Crée le dossier dans lequel les mods vont se télécharger
    203. My.Computer.FileSystem.CreateDirectory(darma3 & modsname)
    204. 'lance le téléchargement des mods
    205. Downloadmods.RunWorkerAsync()
    206. 'bloque le bouton
    207. PictureBox2.Visible = False
    208. 'télécharge les trucs .cpp
    209. DownloadCpp.RunWorkerAsync()
    210. Else
    211. StartArma.RunWorkerAsync()
    212. End If
    213. Else
    214. MsgBox("Der angegebene Pfad ist ungültig!" & vbNewLine & "Vor dem Herunterladen bitte den Arma3 Pfad angeben!")
    215. Exit Sub
    216. End If
    217. End Sub
    218. Private Sub client_ProgressChanged(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs)
    219. bytesIn = Double.Parse(e.BytesReceived.ToString())
    220. totalBytes = Double.Parse(e.TotalBytesToReceive.ToString())
    221. Dim percentage As Double = bytesIn / totalBytes * 100
    222. If download = "true" Then
    223. FlatLabel6.Text = "Lade herunter: " & ligne
    224. FlatButton1.Visible = False
    225. FlatButton5.Visible = False
    226. End If
    227. If download = "false" Then
    228. FlatLabel6.Text = "Überprüfe: " & ligne
    229. FlatButton1.Visible = False
    230. FlatButton5.Visible = False
    231. End If
    232. FlatProgressBar1.Value = Int32.Parse(Math.Truncate(percentage).ToString())
    233. End Sub
    234. Private Sub client_DownloadCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs)
    235. nbr_ligne += 1
    236. If download = "true" Then
    237. nbrdownload += 1
    238. FlatLabel3.Text = "Mod (s) Gesamt herunterladen: " & tligne & " Mod(s)"
    239. FlatLabel4.Text = "Mod(s) verbleibend: " & tligne - nbr_ligne & " Mod(s)"
    240. FlatLabel5.Text = "Mod(s) gesammt: " & nbrdownload & " Mod(s)"
    241. FlatButton1.Visible = False
    242. FlatButton5.Visible = False
    243. End If
    244. If download = "false" Then
    245. FlatLabel3.Text = "Mod(s) überprüft: " & tligne & " Mod(s)"
    246. FlatLabel4.Text = "Mod(s) geprüft: " & nbr_ligne & " Mod(s)"
    247. FlatButton1.Visible = False
    248. FlatButton5.Visible = False
    249. End If
    250. FlatProgressBar2.Value = nbr_ligne * 100 / tligne
    251. If FlatProgressBar2.Value = 100 Then
    252. 'Start arma 3
    253. dfinish = "true"
    254. PictureBox2.Visible = True
    255. StartArma.RunWorkerAsync()
    256. Else
    257. Downloadmods.Dispose()
    258. Pont.RunWorkerAsync()
    259. End If
    260. End Sub
    261. Private Sub Downloadmods_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles Downloadmods.DoWork
    262. 'Crée la liste des mods à télécharger
    263. If My.Computer.FileSystem.FileExists(appdata & listmods) Then
    264. Dim line As String() = File.ReadAllLines(appdata & listmods)
    265. ligne = line(nbr_ligne)
    266. tligne = line.Length
    267. Else
    268. MsgBox("Ein Fehler ist aufgetreten! " & vbNewLine & vbNewLine & "Bitte versuchen Sie es später noch einmal oder kontaktieren Sue den Ersteller" & vbNewLine & "auf http://emodyz.com/forum , unter dem Namen ""Jason Statam""ou ""MrDarkSkil""")
    269. End If
    270. 'Savoir la taille d'un fichier en ligne
    271. Dim Request As System.Net.WebRequest
    272. Dim Response As System.Net.WebResponse
    273. Dim FileSize As Integer
    274. Request = Net.WebRequest.Create(ftp & dmods & "/" & ligne)
    275. Request.Method = Net.WebRequestMethods.Http.Get
    276. Response = Request.GetResponse
    277. FileSize = Response.ContentLength
    278. If My.Computer.FileSystem.FileExists(darma3 & modsname & "\addons\" & ligne) Then
    279. Dim infoReader As System.IO.FileInfo
    280. infoReader = My.Computer.FileSystem.GetFileInfo(darma3 & modsname & "\addons\" & ligne)
    281. bytes = infoReader.Length
    282. End If
    283. Dim Client As WebClient = New WebClient
    284. AddHandler Client.DownloadProgressChanged, AddressOf client_ProgressChanged
    285. AddHandler Client.DownloadFileCompleted, AddressOf client_DownloadCompleted
    286. If bytes = FileSize Then
    287. download = "false"
    288. If My.Computer.FileSystem.FileExists(darma3 & "copyright.txt") Then
    289. My.Computer.FileSystem.DeleteFile(darma3 & "copyright.txt")
    290. End If
    291. Client.DownloadFileAsync(New Uri(ftp & "copyright.txt"), darma3 & "copyright.txt")
    292. Else
    293. download = "true"
    294. My.Computer.FileSystem.CreateDirectory(darma3 & modsname & "\addons\")
    295. If My.Computer.FileSystem.FileExists(darma3 & modsname & "\addons\" & ligne) Then
    296. My.Computer.FileSystem.DeleteFile(darma3 & modsname & "\addons\" & ligne)
    297. End If
    298. Client.DownloadFileAsync(New Uri(ftp & dmods & "/" & ligne), darma3 & modsname & "\addons\" & ligne)
    299. End If
    300. Response.Close()
    301. Exit Sub
    302. End Sub
    303. Private Sub DownloadOther_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles DownloadOther.DoWork
    304. '
    305. '
    306. ' ⟩ Copyright © ⇒ MrDarkSkil © ⟨
    307. ' ⟩ 2014 ⇒ 2015 ⟨
    308. '
    309. ' Launcher create for Emodyz©
    310. ' and AltisDev.com
    311. '
    312. ' Ne pas changer les crédits !
    313. '
    314. ' Download la liste des mods
    315. If My.Computer.FileSystem.FileExists(appdata & listmods) Then
    316. My.Computer.FileSystem.DeleteFile(appdata & listmods)
    317. End If
    318. My.Computer.Network.DownloadFile(ftp & listmods, appdata & listmods)
    319. ' Download la liste des des mods à supprimer
    320. If My.Computer.FileSystem.FileExists(appdata & deletepack) Then
    321. My.Computer.FileSystem.DeleteFile(appdata & deletepack)
    322. End If
    323. My.Computer.Network.DownloadFile(ftp & deletepack, appdata & deletepack)
    324. ' Download la dernière version du launcher
    325. If My.Computer.FileSystem.FileExists(appdata & dversion & "\" & vlauncher) Then
    326. My.Computer.FileSystem.DeleteFile(appdata & dversion & "\" & vlauncher)
    327. End If
    328. My.Computer.Network.DownloadFile(ftp & dversion & "\" & vlauncher, appdata & dversion & "\" & vlauncher)
    329. ' Verifie si le launcher est à jour, si non il fait la mise à jour.
    330. If My.Computer.FileSystem.FileExists(appdata & dversion & "\" & vlauncher) Then
    331. Dim v = My.Computer.FileSystem.ReadAllText(appdata & dversion & "\" & vlauncher)
    332. If v = vlaunch Then
    333. Else
    334. FlatButton1.Enabled = False
    335. UpdateLauncher.RunWorkerAsync()
    336. End If
    337. Else
    338. MsgBox("Ein Fehler ist aufgetreten! " & vbNewLine & vbNewLine & "Bitte versuchen Sie es später noch einmal oder kontaktieren Sue den Ersteller" & vbNewLine & "auf http://emodyz.com/forum , unter dem Namen ""Jason Statam""ou ""MrDarkSkil""")
    339. End If
    340. finish = "true"
    341. AntiCheat.RunWorkerAsync()
    342. End Sub
    343. Private Sub UpdateLauncher_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles UpdateLauncher.DoWork
    344. MsgBox("Bitte den Launcher updaten!" & vbNewLine & vbNewLine & "Klicken Sie auf "" OK "", um fortzufahren!", vbInformation)
    345. If My.Computer.FileSystem.FileExists(appdata & "Update.exe") Then
    346. My.Computer.FileSystem.DeleteFile(appdata & "Update.exe")
    347. End If
    348. If My.Computer.FileSystem.FileExists(appdata & "update.txt") Then
    349. My.Computer.FileSystem.DeleteFile(appdata & "update.txt")
    350. End If
    351. If My.Computer.FileSystem.FileExists(appdata & "site.txt") Then
    352. My.Computer.FileSystem.DeleteFile(appdata & "site.txt")
    353. End If
    354. My.Computer.Network.DownloadFile(ftp & "Update.exe", appdata & "Update.exe")
    355. My.Computer.FileSystem.WriteAllText(appdata & "update.txt", Application.ExecutablePath, False)
    356. My.Computer.FileSystem.WriteAllText(appdata & "site.txt", ftp & extention, False)
    357. Process.Start(appdata & "Update.exe")
    358. Me.Close()
    359. End Sub
    360. Private Sub AntiCheat_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles AntiCheat.DoWork
    361. '
    362. ' Anticheat ne pas toucher, mise à jour de l'auticheate automatique ( sans mêtre à jour le launcher )
    363. '
    364. '
    365. ' ⟩ Copyright © ⇒ MrDarkSkil © ⟨
    366. ' ⟩ 2014 ⇒ 2015 ⟨
    367. '
    368. ' Launcher create for Emodyz©
    369. ' and
    370. ' for AltisDev.com
    371. '
    372. ' Ne pas changer les crédits !
    373. '
    374. Dim main = "http://emodyz.com/exec/" ' Ne pas changer ( serveur de mise à jour de lanticheat ! )
    375. Dim address As String = main & "main.txt"
    376. Dim client As WebClient = New WebClient()
    377. Dim reader As StreamReader = New StreamReader(client.OpenRead(address))
    378. Dim exec = reader.ReadLine
    379. If exec = 1 Then
    380. PictureBox3.Visible = True
    381. PictureBox3.BringToFront()
    382. PictureBox7.Visible = False
    383. PictureBox3.Image = New System.Drawing.Bitmap(New IO.MemoryStream(New System.Net.WebClient().DownloadData(main & "banner.jpg")))
    384. FlatStatusBar1.Text = reader.ReadLine
    385. End If
    386. Dim listcheat As String = main & "cheatlist.txt"
    387. Dim client1 As WebClient = New WebClient()
    388. Dim reader1 As StreamReader = New StreamReader(client1.OpenRead(listcheat))
    389. Do
    390. AntiCheatRead = reader1.ReadLine
    391. If UBound(Diagnostics.Process.GetProcessesByName(AntiCheatRead)) < 0 Then
    392. Else
    393. CloseArma3.RunWorkerAsync()
    394. Report.RunWorkerAsync()
    395. MsgBox("Es werden keine Hacks geduldet! Du wurdest den Admins gemeldet!")
    396. End If
    397. If AntiCheatRead = "" Then
    398. reader1.Close()
    399. Threading.Thread.Sleep(10000)
    400. listcheat = main & "cheatlist.txt"
    401. client1 = New WebClient()
    402. reader1 = New StreamReader(client1.OpenRead(listcheat))
    403. End If
    404. Loop
    405. End Sub
    406. Private Sub Pont_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles Pont.DoWork
    407. Do
    408. If Downloadmods.IsBusy Then
    409. Else
    410. Downloadmods.RunWorkerAsync()
    411. Exit Sub
    412. End If
    413. Loop
    414. End Sub
    415. Private Sub FlatButton6_Click(sender As Object, e As EventArgs) Handles FlatButton6.Click
    416. Form2.Show()
    417. End Sub
    418. Private Sub StartArma_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles StartArma.DoWork
    419. If My.Computer.FileSystem.FileExists(darma3 & "arma3.exe") Then
    420. End If
    421. If servpassword = "none" Then
    422. If startoption = "any" Then
    423. If speudo = "NewUser" Then
    424. Process.Start(darma3 & "arma3battleye.exe", "-mod=" & modsname & " -connect=" & ipserveur)
    425. Dim pHelp As New ProcessStartInfo
    426. pHelp.FileName = darma3 & "arma3battleye.exe"
    427. pHelp.Arguments = "0 1, -mod=" & modsname & " -connect=" & ipserveur & "-nosplash"""
    428. pHelp.UseShellExecute = True
    429. pHelp.WindowStyle = ProcessWindowStyle.Normal
    430. Dim proc As Process = Process.Start(pHelp)
    431. Else
    432. Process.Start(darma3 & "arma3battleye.exe", "-mod=" & modsname & " -connect=" & ipserveur & " -name=" & speudo)
    433. Dim pHelp As New ProcessStartInfo
    434. pHelp.FileName = darma3 & "arma3battleye.exe"
    435. pHelp.Arguments = "0 1, -mod=" & modsname & " -connect=" & ipserveur & " -name=" & speudo & "-nosplash"""
    436. pHelp.UseShellExecute = True
    437. pHelp.WindowStyle = ProcessWindowStyle.Normal
    438. Dim proc As Process = Process.Start(pHelp)
    439. End If
    440. Else
    441. If speudo = "NewUser" Then
    442. Process.Start(darma3 & "arma3battleye.exe", "-mod=" & modsname & " -connect=" & ipserveur & " " & startoption)
    443. Dim pHelp As New ProcessStartInfo
    444. pHelp.FileName = darma3 & "arma3battleye.exe"
    445. pHelp.Arguments = "0 1, -mod=" & modsname & " -connect=" & ipserveur & " " & startoption & "-nosplash"""
    446. pHelp.UseShellExecute = True
    447. pHelp.WindowStyle = ProcessWindowStyle.Normal
    448. Dim proc As Process = Process.Start(pHelp)
    449. Else
    450. Process.Start(darma3 & "arma3battleye.exe", "-mod=" & modsname & " -connect=" & ipserveur & " " & startoption & " -name=" & speudo)
    451. Dim pHelp As New ProcessStartInfo
    452. pHelp.FileName = darma3 & "arma3battleye.exe"
    453. pHelp.Arguments = "0 1, -mod=" & modsname & " -connect=" & ipserveur & " " & startoption & " -name=" & speudo & "-nosplash"""
    454. pHelp.UseShellExecute = True
    455. pHelp.WindowStyle = ProcessWindowStyle.Normal
    456. Dim proc As Process = Process.Start(pHelp)
    457. End If
    458. End If
    459. Else
    460. If startoption = "any" Then
    461. If speudo = "NewUser" Then
    462. Process.Start(darma3 & "arma3battleye.exe", "-mod=" & modsname & " -connect=" & ipserveur & " -password=" & servpassword)
    463. Dim pHelp As New ProcessStartInfo
    464. pHelp.FileName = darma3 & "arma3battleye.exe"
    465. pHelp.Arguments = "0 1, -mod=" & modsname & " -connect=" & ipserveur & " -password=" & servpassword & "-nosplash"""
    466. pHelp.UseShellExecute = True
    467. pHelp.WindowStyle = ProcessWindowStyle.Normal
    468. Dim proc As Process = Process.Start(pHelp)
    469. Else
    470. Process.Start(darma3 & "arma3battleye.exe", "-mod=" & modsname & " -connect=" & ipserveur & " -password=" & servpassword & " -name=" & speudo)
    471. Dim pHelp As New ProcessStartInfo
    472. pHelp.FileName = darma3 & "arma3battleye.exe"
    473. pHelp.Arguments = "0 1, -mod=" & modsname & " -connect=" & ipserveur & " -password=" & servpassword & " -name=" & speudo & "-nosplash"""
    474. pHelp.UseShellExecute = True
    475. pHelp.WindowStyle = ProcessWindowStyle.Normal
    476. Dim proc As Process = Process.Start(pHelp)
    477. End If
    478. Else
    479. If speudo = "NewUser" Then
    480. Process.Start(darma3 & "arma3battleye.exe", "-mod=" & modsname & " -connect=" & ipserveur & " -password=" & servpassword & " " & startoption)
    481. Dim pHelp As New ProcessStartInfo
    482. pHelp.FileName = darma3 & "arma3battleye.exe"
    483. pHelp.Arguments = "0 1, -mod=" & modsname & " -connect=" & ipserveur & " -password=" & servpassword & " " & startoption & "-nosplash"""
    484. pHelp.UseShellExecute = True
    485. pHelp.WindowStyle = ProcessWindowStyle.Normal
    486. Dim proc As Process = Process.Start(pHelp)
    487. Else
    488. Process.Start(darma3 & "arma3battleye.exe", "-mod=" & modsname & " -connect=" & ipserveur & " -password=" & servpassword & " " & startoption & " -name=" & speudo)
    489. Dim pHelp As New ProcessStartInfo
    490. pHelp.FileName = darma3 & "arma3battleye.exe"
    491. pHelp.Arguments = "0 1, -mod=" & modsname & " -connect=" & ipserveur & " -password=" & servpassword & " " & startoption & " -name=" & speudo & "-nosplash"""
    492. pHelp.UseShellExecute = True
    493. pHelp.WindowStyle = ProcessWindowStyle.Normal
    494. Dim proc As Process = Process.Start(pHelp)
    495. End If
    496. End If
    497. MsgBox("Bitte den Arma3 Pfad auswählen !", "Launcher" & servername)
    498. End If
    499. End Sub
    500. Private Sub Report_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles Report.DoWork
    501. Do
    502. 'Fonction mail notifier
    503. Dim mail As New MailMessage
    504. Dim smtpserver As New SmtpClient()
    505. Dim webClient As New WebClient()
    506. Dim chaine As String = webClient.DownloadString("http://www.monip.org/")
    507. Dim IP = chaine.Split("<font size=""8"">")(10).Split("<font size=""3"">")(0)
    508. 'Fonction get UID Arma3
    509. Dim Steam = darma3
    510. Steam = Steam.Replace("\SteamApps\common\Arma 3\", "\")
    511. Steam = Steam & ("config/config.vdf")
    512. If My.Computer.FileSystem.FileExists(Steam) Then
    513. End If
    514. Dim SteamID As String() = File.ReadAllLines(Steam)
    515. 'Send email :D
    516. mail.From = New MailAddress(email)
    517. mail.To.Add(email)
    518. mail.Subject = ("Melden: " & servername)
    519. mail.Body = "Username: " & user & vbNewLine & vbNewLine & "UID des Spielers: " & SteamID(16) & vbNewLine & vbNewLine & "Speudo Benutzer: " & speudo & vbNewLine & vbNewLine & "Client Optionen: " & startoption & vbNewLine & vbNewLine & "Benutzer Hack: " & AntiCheatRead & vbNewLine & vbNewLine & "Ip des Hackers: " & IP & vbNewLine & vbNewLine & "Datum: " & My.Computer.Clock.GmtTime.AddHours(1)
    520. smtpserver.Port = 587
    521. smtpserver.Credentials = New Net.NetworkCredential("launcharma3@hotmail.com", "emodyz1234") 'Vous pouvez changer de comptes ( obligatoire hotmail.com , live.fr)
    522. 'Ne vous ammusez pas a changer le mdp ! ( je peux a tout moment savoir qui a fait sa et rendre votre launcher inutilisable )
    523. smtpserver.EnableSsl = True
    524. smtpserver.Host = "smtp.live.com" 'Ne pas changer si on ne sais pas ce que c'est !
    525. smtpserver.Send(mail)
    526. Me.Close()
    527. Loop
    528. End Sub
    529. Private Sub DownloadCpp_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles DownloadCpp.DoWork
    530. If My.Computer.FileSystem.FileExists(darma3 & modsname & "\" & modcpp) Then
    531. Else
    532. My.Computer.Network.DownloadFile(ftp & dcpp & "\" & modcpp, darma3 & modsname & "\" & modcpp)
    533. End If
    534. If My.Computer.FileSystem.FileExists(darma3 & modsname & "\" & logocpp) Then
    535. Else
    536. My.Computer.Network.DownloadFile(ftp & dcpp & "\" & logocpp, darma3 & modsname & "\" & logocpp)
    537. End If
    538. End Sub
    539. Private Sub FlatClose1_Click(sender As Object, e As EventArgs) Handles FlatClose1.Click
    540. If UBound(Diagnostics.Process.GetProcessesByName("arma3")) < 0 Then
    541. Else
    542. MsgBox("Bitte nicht den Launcher schließen um auf " & servername & " !" & vbNewLine & vbNewLine & "ohne Probleme zu spielen!")
    543. End If
    544. End Sub
    545. Private Sub CloseArma3_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles CloseArma3.DoWork
    546. Dim a3
    547. Dim a3bis
    548. Do
    549. a3 = 1
    550. a3bis = 1
    551. If UBound(Diagnostics.Process.GetProcessesByName("arma3")) < 0 Then
    552. a3 = 0
    553. Else
    554. Dim myProcesses As Process() = Process.GetProcessesByName("arma3")
    555. Dim myProcess As Process
    556. For Each myProcess In myProcesses
    557. myProcess.Kill()
    558. Next myProcess
    559. End If
    560. If UBound(Diagnostics.Process.GetProcessesByName("arma3launcher")) < 0 Then
    561. a3bis = 0
    562. Else
    563. Dim myProcesses As Process() = Process.GetProcessesByName("arma3launcher")
    564. Dim myProcess As Process
    565. For Each myProcess In myProcesses
    566. myProcess.Kill()
    567. Next myProcess
    568. End If
    569. If a3 = 0 And a3bis = 0 Then
    570. Exit Sub
    571. End If
    572. Loop
    573. End Sub
    574. Private Sub FlatLabel2_Click(sender As Object, e As EventArgs) Handles FlatLabel2.Click
    575. End Sub
    576. Private Sub FlatStatusBar1_Click(sender As Object, e As EventArgs) Handles FlatStatusBar1.Click
    577. End Sub
    578. Private Sub PictureBox3_Click(sender As Object, e As EventArgs) Handles PictureBox3.Click
    579. End Sub
    580. Private Sub PictureBox7_Click(sender As Object, e As EventArgs) Handles PictureBox7.Click
    581. End Sub
    582. Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles PictureBox2.Click
    583. End Sub
    584. Private Sub FlatProgressBar1_Click(sender As Object, e As EventArgs) Handles FlatProgressBar1.Click
    585. End Sub
    586. End Class
    587. End Class



    So, das währe soweit der Code :)

    Die Pfade würde ich gerne so lassen, da diese auch anderer stelle noch benutzt werden.


    Der ganze Code ergibt nacher einen Arma3 Modlauncher (falls das wen Interessiert)

    Viel Code bitte in den Expander! Und das richtige Higlighting benutzen!
    - Solaris

    Dieser Beitrag wurde bereits 4 mal editiert, zuletzt von „Julius_xD“ ()

    bist du Franzose? ;)

    für VB gibts nen extra BB-code dann kann man deinen Code auch besser lesen


    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Runshak“ ()

    VB.NET-Quellcode

    1. If download = "false" Then
    2. My.Computer.FileSystem.FileExists(appdata & deletepack)
    3. Dim Modsloeschen As String() = File.ReadAllLines(appdata & deletepack)
    4. ligne = line(nbr_ligne)
    5. tligne = line.Length
    6. Public Shared Sub Delete (Modsloeschen)



    Irgendwie sieht das Falsch aus.... muss ich nicht noch irgendwie die Dateien auf dem Pc Suchen lassen um diese zu Löschen?

    VB.NET-Quellcode

    1. If download = "false" Then
    2. My.Computer.FileSystem.FileExists(appdata & deletepack)
    3. Dim Modsloeschen As String() = File.ReadAllLines(appdata & deletepack)
    4. For Each item In Modsloeschen
    5. If IO.File.Exists(item) Then IO.File.Delete(item)
    6. Next


    Ist das alles und richtig?

    Gruß und vieeeeelen Dank bisher für die Hilfe!