Hey guys, I wrote this for Bombsaway707 a little while ago and figured I may as well share it with everyone. All I ask is that if you use this code, please have the consideration to credit me for it when you use it.
Here you go:
[php]
'~~~~~~~CBL STAT CHECKER BY JASON OF MPGH~~~~~~~'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
'\\\\\\ Any member of MPGH is entitled to \\\\\\'
'\\\\\\ make use of the following source \\\\\\'
'\\\\\\ code on the condition that credit \\\\\\'
'\\\\\\ is given to me for the original. \\\\\\'
'\\\\\\ I hope you enjoy. - Jason of MPGH \\\\\\'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
Imports System.Text.RegularExpressions
Public Class Form1
'for this particular code, you will first need to create a DataGridView, with two "TextBoxCell" columns'
'set their "HeaderText" property to something you feel is appropriate (it makes no difference) and your'
'ready to compile!'
'create a list to store all the stats.'
Private StatList As New List(Of Stats)
'this is the RegEx pattern to extract a block of stats'
Private Const Pattern As String = _
"<tr>" & "[\s\S]" & _
" <td class=""item"">.+</td>" & "[\s\S]" & _
" <td class=""value"">.+</td>" & "[\s\S]" & _
"[\s\S]" & _
" <td class=""item"">.+</td>" & "[\s\S]" & _
" <td class=""value"">.+</td>" & "[\s\S]" & _
" </tr>"
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'get the stats of the specified player.'
GetPlayerStats("JR_Pwnage")
End Sub
'the following is the sub procedure that will obtain the stats of a certain player and display them in'
'a datagridview.'
Private Sub GetPlayerStats(ByVal playerName As String)
'clear the current player'
DataGridView1. Rows.Clear()
'define pagesource'
Dim PageSource As String
'download the pagesource of the specific player'
Using wc As New Net.WebClient
PageSource = wc.DownloadString("https://player.thecaconline.net/" & playerName & ".html")
End Using
'get all the stats from the pagesource in a big block!'
Dim statCollection As MatchCollection = Regex.Matches(PageSource, Pattern)
'work through each big block and get what we want!'
For Each m As Match In statCollection
'split the block into lines, and then use the indexes to specific lines to get what we want'
Dim intoArray() As String = m.Value.Split(ChrW(10))
Dim header1 As String = Regex.Match(intoArray(1), "(?<=<td class=""item"">).+(?=</td>)").Value
Dim header2 As String = Regex.Match(intoArray(4), "(?<=<td class=""item"">).+(?=</td>)").Value
Dim content1 As String = Regex.Match(intoArray(2), "(?<=<td class=""value"">).+(?=</td>)").Value
Dim content2 As String = Regex.Match(intoArray(5), "(?<=<td class=""value"">).+(?=</td>)").Value
'this is for the equipment, which doesnt follow the exact pattern of the previous entries'
If content1.StartsWith("<a href") Then
content1 = Regex.Match(content1, "(?<=<a href="".+"" data-tooltip="".+"">).+(?=</a>)").Value
End If
If content2.StartsWith("<a href") Then
content2 = Regex.Match(content2, "(?<=<a href="".+"" data-tooltip="".+"">).+(?=</a>)").Value
End If
'add the two new stats to the statlist!'
StatList.Add(New Stats With {.Stat = header1, .Value = content1})
StatList.Add(New Stats With {.Stat = header2, .Value = content2})
Next
'add each entry to the datagridview. Alternatively you can just set the datasource of the '
'DGV to "StatList", but that means changing the property names to what you want the column'
'headers to be, so I figured this would be easier to follow'
For Each s As Stats In StatList
Dim row As New DataGridViewRow
row.Cells.AddRange(New DataGridViewTextBoxCell() {New DataGridViewTextBoxCell With {.Value = s.Stat}, New DataGridViewTextBoxCell With {.Value = s.Value}})
DataGridView1. Rows.Add(row)
Next
End Sub
End Class
'the class I created for the stats.'
Public Class Stats
Private HeaderName As String = ""
Private Contents As String = ""
'this holds the stat name (i.e Backpack A...etc)'
Public Property Stat() As String
Get
Return HeaderName
End Get
Set(ByVal value As String)
HeaderName = value
End Set
End Property
'The value of the stat above (i.e L96A1...etc)'
Public Property Value() As String
Get
Return Contents
End Get
Set(ByVal value As String)
Contents = value
End Set
End Property
End Class
[/php]
Enjoy guys, hope someone gets something out of this!
Jason
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
Thanks man.
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
Wow, thanks man. I'll be sure to credit you if I use this!
Advanced CBL Checker . Nice , will use this.
Last edited by Jason; 12-04-2010 at 11:07 AM.
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
Nice.. + thanked for post (Might make something out've this)
Thanks for the comments guys.
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
he is vb expert
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)