Wiem mój problem polega na tym że po uruchomieniu aplikacji wyswietla mi się błąd “Indeks wykraczał poza granice tablicy.”
Nie wiem jak go usunąć (ale bardzo mi na tym zależy gdyż chcę zrobić aplikacje która nie bedzie miała żadnych błędów)
Mój kod:
Imports System.Net
Imports System.IO
Imports System.Environment
Imports System.ComponentModel
Imports System.Windows.Forms
Public Class Form1
Public patch(0) As String
Dim failed As Boolean = False
Dim wrong As Boolean = False
Private Sub From1_load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If System.IO.File.Exists("log.txt") Then
CheckBox1.Checked = True
Dim lol As New System.IO.StreamReader("log.txt")
TextBox1.Text = lol.ReadLine
TextBox2.Text = lol.ReadLine
lol.Close()
End If
Me.Text = Me.Text + " " + version
loadList()
End Sub
Private version As String = " "
Private Function verifyUser(ByVal username As String, ByVal password As String)
Dim response As HttpWebResponse
Dim request As HttpWebRequest = WebRequest.Create("https://login.minecraft.net/?user=" + username + "&password=" + password + "&version=12")
Try
response = request.GetResponse()
Catch
failed = True
Return Nothing
End Try
Dim reader As StreamReader = New StreamReader(response.GetResponseStream())
Dim result As String = reader.ReadToEnd
If result.Contains("Błędny login") Then
wrong = True
End If
failed = False
Return result.Split(":")
End Function
Private Sub loadList()
If Not Directory.Exists(GetFolderPath(SpecialFolder.ApplicationData) & "\.playcraft1") Then
Directory.CreateDirectory(GetFolderPath(SpecialFolder.ApplicationData) & "\.playcraft1")
End If
If Not File.Exists(GetFolderPath(SpecialFolder.ApplicationData) & "\.playcraft1\jars.ini") Then
File.WriteAllText(GetFolderPath(SpecialFolder.ApplicationData) & "\.playcraft1\jars.ini", "")
Exit Sub
End If
Dim stream As FileStream = File.OpenRead(GetFolderPath(SpecialFolder.ApplicationData) & "\.playcraft1\jars.ini")
Dim reader As StreamReader = New StreamReader(stream)
While Not reader.EndOfStream
Dim s As String = reader.ReadLine
Dim a As String() = s.Split("=")
Dim name As String = a(0)
Dim path As String = a(1)
ListView1.Items.Add(name).SubItems.Add(path)
End While
reader.Close()
reader.Dispose()
stream.Close()
stream.Dispose()
End Sub
Wszystko jest napisane w Visual Basic 2010
A aplikacją jest launcher minecrafta
PS Proszę o szybką odpowiedź
Za każdą serdecznie dziękuje:)