Uh oh!
There was an error while loading. Please reload this page.
forked from forkification/OpenHacknet
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFastDelayableActionSystem.cs
More file actions
Latest commit
165 lines (154 loc) · 4.65 KB
/
Copy pathFastDelayableActionSystem.cs
File metadata and controls
165 lines (154 loc) · 4.65 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
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Globalization;
usingSystem.IO;
usingSystem.Xml;
namespaceHacknet
{
// Token: 0x02000021 RID: 33
publicclassFastDelayableActionSystem:DelayableActionSystem
{
// Token: 0x060000D6 RID: 214 RVA: 0x0000D978 File Offset: 0x0000BB78
publicFastDelayableActionSystem(FoldersourceFolder,objectosObj)
{
FastDelayableActionSystem<>4__this=this;
this.folder=sourceFolder;
OSos=(OS)osObj;
os.UpdateSubscriptions=(Action<float>)Delegate.Combine(os.UpdateSubscriptions,newAction<float>(delegate(floatt)
{
<>4__this.Update(t,(OS)osObj);
}));
}
// Token: 0x060000D7 RID: 215 RVA: 0x0000D9F0 File Offset: 0x0000BBF0
privatevoidUpdate(floatt,objectosObj)
{
for(inti=0;i<this.Actions.Count;i++)
{
try
{
floatnum=this.Actions[i].Key;
SerializableActionvalue=this.Actions[i].Value;
num-=t;
if(num<=0f)
{
try
{
value.Trigger((OS)osObj);
}
catch(Exceptionex)
{
((OS)osObj).write(Utils.GenerateReportFromException(ex));
Utils.AppendToErrorFile(Utils.GenerateReportFromException(ex));
}
this.Actions.RemoveAt(i);
i--;
}
else
{
this.Actions[i]=newKeyValuePair<float,SerializableAction>(num,value);
}
}
catch(Exception)
{
}
}
}
// Token: 0x060000D8 RID: 216 RVA: 0x0000DAE8 File Offset: 0x0000BCE8
publicoverridevoidInstantlyResolveAllActions(objectosObj)
{
for(inti=0;i<this.Actions.Count;i++)
{
try
{
this.Actions[i].Value.Trigger(osObj);
this.Actions.RemoveAt(i);
i--;
}
catch(Exceptionex)
{
((OS)osObj).write(Utils.GenerateReportFromException(ex));
Utils.AppendToErrorFile(Utils.GenerateReportFromException(ex));
}
}
}
// Token: 0x060000D9 RID: 217 RVA: 0x0000DB78 File Offset: 0x0000BD78
publicoverridevoidAddAction(SerializableActionaction,floatdelay)
{
this.Actions.Add(newKeyValuePair<float,SerializableAction>(delay,action));
}
// Token: 0x060000DA RID: 218 RVA: 0x0000DB90 File Offset: 0x0000BD90
privateFileEntryEncryptAction(SerializableActionaction,floatdelay)
{
stringstr=FileEncrypter.EncryptString(action.GetSaveString(),"das","UNKNOWN",FastDelayableActionSystem.EncryptionPass,null);
stringdataEntry=delay.ToString("0.0000000000",CultureInfo.InvariantCulture)+"\n"+str;
FileEntryresult=newFileEntry(dataEntry,this.SeqNum.ToString("000")+".act");
this.SeqNum++;
returnresult;
}
// Token: 0x060000DB RID: 219 RVA: 0x0000DC0C File Offset: 0x0000BE0C
publicList<FileEntry>GetAllFilesForActions()
{
this.SeqNum=0;
List<FileEntry>list=newList<FileEntry>();
for(inti=0;i<this.Actions.Count;i++)
{
list.Add(this.EncryptAction(this.Actions[i].Value,this.Actions[i].Key));
}
returnlist;
}
// Token: 0x060000DC RID: 220 RVA: 0x0000DC80 File Offset: 0x0000BE80
publicvoidDeserializeActions(List<FileEntry>files)
{
this.Actions.Clear();
for(inti=0;i<files.Count;i++)
{
try
{
stringdata=this.folder.files[i].data;
intnum=data.IndexOf('\n');
stringvalue=data.Substring(0,num);
stringdata2=data.Substring(num+1);
floatkey=(float)Convert.ToDouble(value,CultureInfo.InvariantCulture);
strings=FileEncrypter.DecryptString(data2,FastDelayableActionSystem.EncryptionPass)[2];
using(Streamstream=Utils.GenerateStreamFromString(s))
{
try
{
XmlReaderrdr=XmlReader.Create(stream);
SerializableActionvalue2=SerializableAction.Deserialize(rdr);
this.Actions.Add(newKeyValuePair<float,SerializableAction>(key,value2));
}
catch(Exceptionex)
{
if(OS.DEBUG_COMMANDS)
{
Utils.AppendToWarningsFile("Error deserializing action in fast action host :\n"+Utils.GenerateReportFromExceptionCompact(ex));
}
}
}
}
catch(Exceptionex)
{
if(OS.DEBUG_COMMANDS)
{
Utils.AppendToWarningsFile(string.Concat(newobject[]
{
"Error deserializing action ",
i,
" in fast action host :\n",
Utils.GenerateReportFromExceptionCompact(ex)
}));
}
}
}
}
// Token: 0x040000EA RID: 234
privatestaticstringEncryptionPass="dasencrypt";
// Token: 0x040000EB RID: 235
privateFolderfolder;
// Token: 0x040000EC RID: 236
internalList<KeyValuePair<float,SerializableAction>>Actions=newList<KeyValuePair<float,SerializableAction>>();
// Token: 0x040000ED RID: 237
privateintSeqNum=0;
}
}