In vb6 we could simply do Join(sourcearray, delimiter)
But I cant find the equivalent in vb.net, Is there?
----
Also, I'm writing a FireFox proxy changer, and Im looking for input on how I could improve my code:
VB Code:
Option Strict On Option Explicit On Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Path As String = String.Empty Dim js_Prefs() As String Dim RndProxy As New Random Dim Proxies() As String = (My.Computer.FileSystem.ReadAllText(Application.StartupPath & "\Proxies.txt")).Split(CChar(Environment.NewLine)) For Each FxUserName As String In IO.Directory.GetDirectories("C:\Documents and Settings\" & Environment.UserName & "\Application Data\Mozilla\Firefox\Profiles\") Path = FxUserName Next js_Prefs = My.Computer.FileSystem.ReadAllText(Path & "\prefs.js").Split(CChar(Environment.NewLine)) Dim IP As String = Proxies(RndProxy.Next(0, Proxies.GetUpperBound(0))).Trim For I As Int32 = 0 To js_Prefs.GetUpperBound(0) If js_Prefs(I).Contains("network.proxy.http_port") Then js_Prefs(I) = js_Prefs(I).Substring(1, js_Prefs(I).LastIndexOf(",") + 1) js_Prefs(I) += IP.Substring(IP.IndexOf(":") + 1) & ");" Exit For ElseIf js_Prefs(I).Contains("network.proxy.http") Then js_Prefs(I) = js_Prefs(I).Substring(1, js_Prefs(I).IndexOf(",") + 1) js_Prefs(I) += Convert.ToChar(34) & IP.Substring(1, IP.IndexOf(":") - 1) & Convert.ToChar(34) & ");" End If Next End Sub End Class





Reply With Quote