-
Notifications
You must be signed in to change notification settings - Fork 2
/
ForkBombExe.cs
136 lines (122 loc) · 3.51 KB
/
ForkBombExe.cs
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
using System;
using Microsoft.Xna.Framework;
namespace Hacknet
{
// Token: 0x02000114 RID: 276
internal class ForkBombExe : ExeModule
{
// Token: 0x06000689 RID: 1673 RVA: 0x0006BF04 File Offset: 0x0006A104
public ForkBombExe(Rectangle location, OS operatingSystem) : base(location, operatingSystem)
{
this.ramCost = 10;
this.runnerIP = "UNKNOWN";
this.IdentifierName = "ForkBomb";
}
// Token: 0x0600068A RID: 1674 RVA: 0x0006BF68 File Offset: 0x0006A168
public ForkBombExe(Rectangle location, OS operatingSystem, string ipFrom) : base(location, operatingSystem)
{
this.ramCost = 10;
this.runnerIP = ipFrom;
this.IdentifierName = "ForkBomb";
}
// Token: 0x0600068B RID: 1675 RVA: 0x0006BFC8 File Offset: 0x0006A1C8
public override void LoadContent()
{
base.LoadContent();
if (ForkBombExe.binary.Equals(""))
{
ForkBombExe.binary = Computer.generateBinaryString(5064);
}
float num = GuiData.detailfont.MeasureString("0").X - 0.15f;
this.charsWide = (int)((float)this.bounds.Width / num + 0.5f);
}
// Token: 0x0600068C RID: 1676 RVA: 0x0006C041 File Offset: 0x0006A241
public override void Killed()
{
TrackerCompleteSequence.NextCompleteForkbombShouldTrace = false;
base.Killed();
}
// Token: 0x0600068D RID: 1677 RVA: 0x0006C054 File Offset: 0x0006A254
public override void Update(float t)
{
base.Update(t);
if (this.frameSwitch)
{
this.binaryScroll++;
if (this.binaryScroll >= ForkBombExe.binary.Length - (this.charsWide + 1))
{
this.binaryScroll = 0;
}
}
this.frameSwitch = !this.frameSwitch;
if (this.targetRamUse != this.ramCost)
{
int num = (int)(t * ForkBombExe.RAM_CHANGE_PS);
if (this.os.ramAvaliable < num)
{
this.Completed();
}
else
{
this.ramCost += num;
if (this.ramCost > this.targetRamUse)
{
this.ramCost = this.targetRamUse;
}
}
}
}
// Token: 0x0600068E RID: 1678 RVA: 0x0006C12C File Offset: 0x0006A32C
public override void Draw(float t)
{
base.Draw(t);
this.drawOutline();
float num = 8f;
int num2 = this.binaryScroll;
if (num2 >= ForkBombExe.binary.Length - (this.charsWide + 1))
{
num2 = 0;
}
Vector2 position = new Vector2((float)this.bounds.X, (float)this.bounds.Y);
while (position.Y < (float)(this.bounds.Y + this.bounds.Height) - num)
{
this.spriteBatch.DrawString(GuiData.detailfont, ForkBombExe.binary.Substring(num2, this.charsWide), position, Color.White);
num2 += this.charsWide;
if (num2 >= ForkBombExe.binary.Length - (this.charsWide + 1))
{
num2 = 0;
}
position.Y += num;
}
}
// Token: 0x0600068F RID: 1679 RVA: 0x0006C21C File Offset: 0x0006A41C
public override void Completed()
{
base.Completed();
if (TrackerCompleteSequence.NextCompleteForkbombShouldTrace)
{
TrackerCompleteSequence.NextCompleteForkbombShouldTrace = false;
TrackerCompleteSequence.TriggerETAS(this.os);
this.os.exes.Remove(this);
}
else
{
this.os.thisComputer.crash(this.runnerIP);
}
}
// Token: 0x04000746 RID: 1862
public static float RAM_CHANGE_PS = 150f;
// Token: 0x04000747 RID: 1863
private int targetRamUse = 999999999;
// Token: 0x04000748 RID: 1864
public string runnerIP = "";
// Token: 0x04000749 RID: 1865
public static string binary = "";
// Token: 0x0400074A RID: 1866
public int binaryScroll = 0;
// Token: 0x0400074B RID: 1867
public int charsWide = 0;
// Token: 0x0400074C RID: 1868
public bool frameSwitch = false;
}
}