Jump to content

Converter vb.net para c#


Recommended Posts

Boas amigos, gostaria de saber se alguém me pode ajudar a converter este código para c#...

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
		Dim aroras As Process = Process.Start(Environment.CurrentDirectory & "\Script1.bat")

		If File.Exists("user.ini") Then
			Dim words() = {"BSSID", "pin", "(SSID)"}

			For Each str As String In File.ReadAllLines("user.ini")

				Dim bssidInt As Integer = str.IndexOf(words(0), StringComparison.Ordinal)

				If bssidInt <> -1 Then
					str = str.Remove(bssidInt, words(0).Length)
					TextBox2.Text = (str.Trim.Remove(0, 2))
				End If

				Dim pinInt As Integer
				pinInt = str.IndexOf(words(1), StringComparison.Ordinal)

				If pinInt <> -1 Then
					pinInt += words(1).Length + 2
					TextBox3.Text = (str.Substring(pinInt, 8))
				End If

				Dim SSIDInt As Integer
				SSIDInt = str.IndexOf(words(2), StringComparison.Ordinal)

				If SSIDInt <> -1 Then
					str = str.Remove(SSIDInt, words(2).Length)
					TextBox1.Text = (str.Trim.Remove(0, 20))
				End If
			If TextBox1.Text = "" Then
				MsgBox("Erro: Usuario não é valido!" + vbNewLine + "Dica: Use outro usuario. Exemplo: (Administrator)")
			End If
		End If
	Catch ex As Exception
		MsgBox("Erro: Verifique a sua ligação ao Router!" + vbNewLine + "Dica: Use outro usuario. Exemplo: (Administrator)")
	End Try
End Sub
Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.