Minecraft验证了mojang

时间:2015-12-21 20:45:47

标签: vb.net minecraft

我在mojang上遇到了一个Minecraft溢价验证帐户的问题, 皮肤没有加载在picturebox中,是程序中最重要的部分,请帮忙!!!!! 维基百科:http://wiki.vg/Authentication 我的代码:

If CheckBox1.Checked = True Then
            Dim site As String = "https://authserver.mojang.com/validate"
            Dim username As String = Form2.TextBox1.Text
            Dim password As String = Form2.TextBox2.Text
            Dim usernamenick2 As String
            Dim result As String
            Dim appData As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

            If My.Computer.FileSystem.FileExists(appData & "\.xerosfiles\launcher files\lastlogin.json") = True Then

                Dim result2 As String = My.Computer.FileSystem.ReadAllText(appData & "\.xerosfiles\launcher files\lastlogin.json")

                Dim fileReader As String

                fileReader = My.Computer.FileSystem.ReadAllText(appData & "\.xerosfiles\launcher files\lastlogin.json")
                Dim json2 As JObject = JObject.Parse(fileReader)
                UpdateTextBox(fileReader)
                Dim items2 As String() = fileReader.Split(New Char() {":"c})

                Dim at As String = json2.SelectToken("accessToken")
                Dim ct As String = json2.SelectToken("clientToken")

                Dim message As String = "{""accessToken"": """ & at & """clientToken"": """ & ct & """}"

                Dim request As WebRequest
                request = WebRequest.Create(site)
                Dim response As WebResponse
                Dim postData As String = message
                Dim data As Byte() = Encoding.UTF8.GetBytes(postData)

                request.Method = "POST"
                request.ContentLength = data.Length
                Dim stream As Stream = request.GetRequestStream()
                Try
                    stream.Write(data, 0, data.Length)
                    stream.Close()
                Catch
                End Try

                Try
                    response = request.GetResponse()
                    Dim sr As New StreamReader(response.GetResponseStream())
                    result = (sr.ReadToEnd)

                    If result = "" Then
                        Form2.hiddencb.Checked = True
                        Dim json As JObject = JObject.Parse(result2)

                        usernamenick2 = json.SelectToken("selectedProfile").SelectToken("name")
                        PictureBox2.Load("https://minotar.net/body/" & usernamenick2 & "/150.png")
                    Else

                    End If
                    Form2.hiddencb.Checked = True
                Catch ex As Exception
                    Form2.hiddencb.Checked = False

                    If My.Settings.cb1 = "true" Then
                        MsgBox("Wylogowano z konta, proszę się zalogować!")
                    End If
                End Try



            End If
        End If

0 个答案:

没有答案