godzcheater

GamerPicture Grabber

Sep 11th, 2011
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.46 KB | None | 0 0
  1.     Public Sub FindGamerPictures(ByVal sender As System.Object, ByVal e As DoWorkEventArgs)
  2.         Dim BackgroundWorker As BackgroundWorker = sender
  3.  
  4.         Dim GameID As UInt32 = &H41560855
  5.         Dim MaxFails As Integer = 50
  6.         For i As Integer = 0 To 3
  7.             Dim Fails As Integer = 0
  8.             Dim ImageID As Integer = 0
  9.             Select Case i
  10.                 Case 0
  11.                     ImageID = &H20000
  12.                 Case 1
  13.                     ImageID = &H20400
  14.                 Case 2
  15.                     ImageID = &H21000
  16.                 Case 3
  17.                     ImageID = &H28000
  18.             End Select
  19.             Do
  20.                 Try
  21.                     Dim URL As String = "http://image.xboxlive.com/global/t." & GameID.ToString("x") & "/tile/0/" & ImageID.ToString("x")
  22.                     Dim WEBClient As New WebClient
  23.                     WEBClient.DownloadData(URL)'this errors = not a valid gamerpic
  24.  
  25.                     BackgroundWorker.ReportProgress(0, New GamerPicture(GameID, ImageID))
  26.                 Catch ex As Exception
  27.                     Fails += 1
  28.                 End Try
  29.                 ImageID += 1
  30.             Loop While Fails < MaxFails
  31.         Next
  32.     End Sub
  33.     Public Sub UpdateGamerPictures(ByVal sender As System.Object, ByVal e As ProgressChangedEventArgs)
  34.         Dim GamerPicture As GamerPicture = e.UserState
  35.         GamerPictures.Add(GamerPicture)
  36.  
  37.         Dim LVI As New ListViewItem
  38.         LVI.Text = GamerPicture.PNGURL64
  39.         LVI.SubItems.Add(GamerPicture.PNGURL32)
  40.         ListView2.Items.Add(LVI)
  41.     End Sub
  42.     Public Sub FoundGamerPictures(ByVal sender As System.Object, ByVal e As RunWorkerCompletedEventArgs)
  43.         MsgBox("Found " & GamerPictures.Count & " Gamerpics")
  44.     End Sub
  45.  
  46.     Private Sub FindPicsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FindPicsToolStripMenuItem.Click
  47.         Dim BackgroundWorker As New BackgroundWorker
  48.         BackgroundWorker.WorkerReportsProgress = True
  49.         BackgroundWorker.WorkerSupportsCancellation = False
  50.         AddHandler BackgroundWorker.DoWork, New DoWorkEventHandler(AddressOf FindGamerPictures)
  51.         AddHandler BackgroundWorker.ProgressChanged, New ProgressChangedEventHandler(AddressOf UpdateGamerPictures)
  52.         AddHandler BackgroundWorker.RunWorkerCompleted, New RunWorkerCompletedEventHandler(AddressOf FoundGamerPictures)
  53.         BackgroundWorker.RunWorkerAsync()
  54.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment