-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOffsetHandler.cs
More file actions
69 lines (57 loc) · 2.25 KB
/
OffsetHandler.cs
File metadata and controls
69 lines (57 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using System.Net;
using System.Windows.Forms;
using Newtonsoft.Json;
namespace AIO
{
class OffsetHandler
{
public static string rawJSON;
public static int aLocalPlayer;
public static int Health;
public static int oFlags;
public static int aJump;
public static void getOffsets()
{
// Download files from https://github.com/frk1/hazedumper
using (WebClient wc = new WebClient())
{
Uri url = new Uri("https://raw.githubusercontent.com/frk1/hazedumper/master/csgo.json");
Form1._Form1.offsetsProgressbar.Maximum = 100;
wc.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChanged);
wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(DownloadStringCompleted);
Debug.Log("Downloading offsets...", "Yellow");
wc.DownloadStringAsync(url);
}
}
#region Download Progressbar Handlers
static void DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
Debug.Log("Done!", "Lime");
rawJSON = e.Result;
deserializeJSON();
}
static void DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
Form1._Form1.offsetsProgressbar.Value = Form1._Form1.offsetsProgressbar.Maximum * e.ProgressPercentage / 100;
}
#endregion
public static void deserializeJSON()
{
try
{
var csgoJson = JsonConvert.DeserializeObject<dynamic>(rawJSON);
aLocalPlayer = csgoJson.signatures.dwLocalPlayer;
Health = csgoJson.netvars.m_iHealth;
oFlags = csgoJson.netvars.m_fFlags;
aJump = csgoJson.signatures.dwForceJump;
Debug.Log($"Timestamp -> {csgoJson.timestamp}");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
Debug.Log("Deserialized and parsed raw offsets from https://github.com/frk1/hazedumper/blob/master/csgo.json");
}
}
}