1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles Button5.Click
If My.Computer.FileSystem.FileExists(Files) Then
Dim lines As List(Of String) = System.IO.File.ReadAllLines(Files).ToList
Dim list As New List(Of String) From {"user_pref(""network.proxy.backup.ftp"", """");", "user_pref(""network.proxy.backup.ftp_port"", 0);", "user_pref(""network.proxy.backup.socks"", """");", "user_pref(""network.proxy.backup.socks_port"", 0);", "user_pref(""network.proxy.backup.ssl"", """");", "user_pref(""network.proxy.backup.ssl_port"", " & "" & TextBox2.Text & ");"}
Dim index As Integer = lines.FindIndex(Function(value As String)
Return value.Contains("network.predictor.cleaned-up")
End Function)
For Each item As Integer In list
If Not InStr(lines.Count, item) = False Then
'Dans le fichier les mots de la list existe , il le renome dans le fichier
lines.RemoveAt(list.Count)
Else
'dans le fichier les mots existe pas, il ajoute dans le fichier
lines.InsertRange(index + 1, list)
End If
Next
File.WriteAllLines(Files, lines)
Process.Start("NOTEPAD.EXE", Files)
End If
End Sub |
Partager