Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Net
- Imports System.IO
- Public Class Form1
- Dim amb As Boolean
- Dim moderator As Boolean
- Public Shared uname As String
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Dim address As String = "http://openstudy.com/api/v1/users/" & uname & "/detailed"
- Dim client As WebClient = New WebClient()
- Dim reader As StreamReader = New StreamReader(client.OpenRead(address))
- Dim tClient As WebClient = New WebClient
- Dim url As String
- Dim u2 As String
- Dim smartcents As String
- Dim fans As Integer
- Dim sc As String
- Dim a() As String
- Dim summary As String
- url = reader.ReadLine
- u2 = "http:" & url.Substring(url.IndexOf("/"), url.IndexOf("?") - 1)
- url = u2
- u2 = url.Remove(url.IndexOf("?"))
- url = u2
- reader.Close()
- reader = New StreamReader(client.OpenRead(address))
- smartcents = reader.ReadLine
- sc = smartcents.Substring(smartcents.LastIndexOf("smartCents"))
- smartcents = sc.Substring(12)
- a = smartcents.Split(","c)
- smartcents = a(0)
- fans = a(1).Substring(11)
- summary = a(11).Substring(15, a(11).Substring(15).Length - 1)
- If a(2).Contains("Ambassador") Then
- amb = True
- moderator = False
- ElseIf a(2).Contains("Moderator") Then
- moderator = True
- amb = False
- Else
- amb = False
- moderator = False
- End If
- Dim tImage As Bitmap = Bitmap.FromStream(New MemoryStream(tClient.DownloadData(url)))
- PictureBox1.Image = tImage
- Label1.Text = smartcents & " SmartCents"
- If amb = True Then
- Label2.Text = "Ⓐ" & uname
- ElseIf moderator = True Then
- Label2.ForeColor = Color.FromArgb(135, 42, 240)
- Label2.Text = uname
- Else
- Label2.Text = uname
- End If
- Label3.Text = summary.Replace("\r", Environment.NewLine)
- Label3.Text = Label3.Text.Replace("\n", Environment.NewLine)
- Label4.Text = "Fans: " & fans
- End Sub
- Private Sub Panel1_Paint(sender As Object, e As PaintEventArgs) Handles Panel1.Paint
- If moderator = True Then
- e.Graphics.DrawRectangle(New System.Drawing.Pen(Color.FromArgb(135, 42, 240), 5), PictureBox1.Location.X - 3, PictureBox1.Location.Y - 3, PictureBox1.Width + 5, PictureBox1.Height + 5)
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment