-
Notifications
You must be signed in to change notification settings - Fork 2
/
HeartMonitorDaemon.cs
1281 lines (1194 loc) · 49.3 KB
/
HeartMonitorDaemon.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
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Collections.Generic;
using Hacknet.Daemons.Helpers;
using Hacknet.Gui;
using Hacknet.UIUtils;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Graphics;
namespace Hacknet
{
// Token: 0x02000099 RID: 153
internal class HeartMonitorDaemon : Daemon
{
// Token: 0x060002FE RID: 766 RVA: 0x0002AC64 File Offset: 0x00028E64
public HeartMonitorDaemon(Computer c, OS os) : base(c, LocaleTerms.Loc("Remote Monitor"), os)
{
this.blufEffect = os.content.Load<Effect>("Shaders/DOFBlur");
this.blufEffect.CurrentTechnique = this.blufEffect.Techniques["SmoothGaussBlur"];
this.Heart = os.content.Load<Texture2D>("Sprites/Icons/Heart");
this.OxyIcon = os.content.Load<Texture2D>("Sprites/Icons/O2Img");
this.WarnIcon = os.content.Load<Texture2D>("Sprites/Icons/CautionIcon");
this.beepSound = os.content.Load<SoundEffect>("SFX/HeartMonitorBeep");
this.beepSustainSound = os.content.Load<SoundEffect>("SFX/HeartMonitorSustain").CreateInstance();
this.beepSustainSound.IsLooped = true;
this.beepSustainSound.Volume = this.volume;
this.SetUpMonitors();
}
// Token: 0x060002FF RID: 767 RVA: 0x0002AEAC File Offset: 0x000290AC
public override string getSaveString()
{
return "<HeartMonitor patient=\"" + this.PatientID + "\" />";
}
// Token: 0x06000300 RID: 768 RVA: 0x0002AED4 File Offset: 0x000290D4
public override void initFiles()
{
base.initFiles();
Folder folder = this.comp.files.root.searchForFolder("KBT_Pacemaker");
if (folder == null)
{
folder = new Folder("KBT_Pacemaker");
this.comp.files.root.folders.Add(folder);
}
Folder folder2 = folder.searchForFolder("Active");
if (folder2 == null)
{
folder2 = new Folder("Active");
}
folder.folders.Add(folder2);
FileEntry item = new FileEntry(PortExploits.ValidPacemakerFirmware, "KBT_Firmware_v1.2.dll");
folder.files.Add(item);
FileEntry fileEntry = new FileEntry(PortExploits.ValidPacemakerFirmware, "LiveFirmware.dll");
folder2.files.Add(item);
}
// Token: 0x06000301 RID: 769 RVA: 0x0002B478 File Offset: 0x00029678
private void SetUpMonitors()
{
this.HeartMonitor = new BasicMedicalMonitor(delegate(float lastVal, float dt)
{
List<BasicMedicalMonitor.MonitorRecordKeypoint> list = new List<BasicMedicalMonitor.MonitorRecordKeypoint>();
BasicMedicalMonitor.MonitorRecordKeypoint item = default(BasicMedicalMonitor.MonitorRecordKeypoint);
item.timeOffset = dt;
item.value = lastVal;
float num = this.PatientDead ? 0.05f : 0.25f;
if (lastVal > num)
{
item.value -= dt * 0.5f;
}
else if (lastVal < -1f * num)
{
item.value += dt * 0.5f * (this.PatientDead ? (0.5f * Math.Max(1f - this.timeDead / 16f, 0f)) : 1f);
}
else
{
item.value += (Utils.randm(0.2f) - 0.1f) * 0.3f;
}
list.Add(item);
return list;
}, delegate(float lastVal, float dt)
{
List<BasicMedicalMonitor.MonitorRecordKeypoint> list = new List<BasicMedicalMonitor.MonitorRecordKeypoint>();
if (!this.PatientDead)
{
list.Add(new BasicMedicalMonitor.MonitorRecordKeypoint
{
timeOffset = dt / 3f,
value = -0.8f + (Utils.randm(0.2f) - 0.1f)
});
list.Add(new BasicMedicalMonitor.MonitorRecordKeypoint
{
timeOffset = dt / 3f,
value = 0.9f + (Utils.randm(0.1f) - 0.05f)
});
list.Add(new BasicMedicalMonitor.MonitorRecordKeypoint
{
timeOffset = dt / 3f,
value = Utils.randm(0.1f * dt) - 0.05f
});
}
return list;
});
this.Monitors.Add(this.HeartMonitor);
this.BPMonitor = new BasicMedicalMonitor(delegate(float lastVal, float dt)
{
List<BasicMedicalMonitor.MonitorRecordKeypoint> list = new List<BasicMedicalMonitor.MonitorRecordKeypoint>();
BasicMedicalMonitor.MonitorRecordKeypoint item = default(BasicMedicalMonitor.MonitorRecordKeypoint);
item.timeOffset = dt;
item.value = lastVal;
if (lastVal > 0.25f)
{
item.value -= dt * 0.5f;
}
else if (lastVal < -0.25f)
{
item.value += dt * 0.5f;
}
else
{
item.value += (Utils.randm(0.2f) - 0.1f) * 0.3f * (this.PatientDead ? (0.5f * Math.Max(1f - this.timeDead / 16f, 0f)) : 1f);
}
list.Add(item);
return list;
}, (float lastVal, float dt) => new List<BasicMedicalMonitor.MonitorRecordKeypoint>
{
new BasicMedicalMonitor.MonitorRecordKeypoint
{
timeOffset = dt / 3f,
value = -0.8f + (Utils.randm(0.2f) - 0.1f)
},
new BasicMedicalMonitor.MonitorRecordKeypoint
{
timeOffset = dt / 3f,
value = 0.9f + (Utils.randm(0.1f) - 0.05f)
},
new BasicMedicalMonitor.MonitorRecordKeypoint
{
timeOffset = dt / 3f,
value = Utils.randm(0.1f * dt) - 0.05f
}
});
this.Monitors.Add(this.BPMonitor);
this.SPMonitor = new BasicMedicalMonitor(delegate(float lastVal, float dt)
{
List<BasicMedicalMonitor.MonitorRecordKeypoint> list = new List<BasicMedicalMonitor.MonitorRecordKeypoint>();
BasicMedicalMonitor.MonitorRecordKeypoint item = default(BasicMedicalMonitor.MonitorRecordKeypoint);
item.timeOffset = dt;
item.value = lastVal;
if (lastVal > 0.8f)
{
item.value += (Utils.randm(0.2f) - 0.1f) * 0.3f;
}
else
{
item.value += 0.15f * (float)(Utils.random.NextDouble() * Utils.random.NextDouble()) * (this.PatientDead ? (0.5f * Math.Max(1f - this.timeDead / 16f, 0f)) : 1f);
}
list.Add(item);
return list;
}, delegate(float lastVal, float dt)
{
List<BasicMedicalMonitor.MonitorRecordKeypoint> list = new List<BasicMedicalMonitor.MonitorRecordKeypoint>();
BasicMedicalMonitor.MonitorRecordKeypoint item = new BasicMedicalMonitor.MonitorRecordKeypoint
{
timeOffset = dt * 0.7f,
value = -0.6f - Utils.randm(0.4f)
};
list.Add(item);
list.Add(new BasicMedicalMonitor.MonitorRecordKeypoint
{
timeOffset = dt * 0.3f,
value = item.value - Utils.randm(0.15f) - 0.05f
});
return list;
});
this.Monitors.Add(this.SPMonitor);
}
// Token: 0x06000302 RID: 770 RVA: 0x0002B54C File Offset: 0x0002974C
private void UpdateReports(float dt)
{
this.timeSinceLastHeartBeat += dt;
this.currentSPO2 = 1f - this.SPMonitor.GetCurrentValue(this.projectionFowardsTime);
this.averageSPO2 = this.averageSPO2 * 0.96f + this.currentSPO2 * 0.04f;
this.reportedSP02 = Math.Min(100, 90 + (int)(5f * this.averageSPO2 + 0.5f));
if (this.HeartRate > 120 || this.HeartRate < 50)
{
this.timeSinceNormalHeartRate += dt;
}
else
{
this.alarmHeartOKTimer += dt;
if (this.alarmHeartOKTimer > 10f)
{
this.timeSinceNormalHeartRate = 0f;
this.alarmHeartOKTimer = 0f;
}
}
}
// Token: 0x06000303 RID: 771 RVA: 0x0002B632 File Offset: 0x00029832
private void UpdateReportsForHeartbeat()
{
this.HeartRate = (int)(60f / this.timeSinceLastHeartBeat + 0.5f);
this.timeSinceLastHeartBeat = 0f;
}
// Token: 0x06000304 RID: 772 RVA: 0x0002B65C File Offset: 0x0002985C
private void ChangeState(HeartMonitorDaemon.HeartMonitorState newState)
{
if (this.State != HeartMonitorDaemon.HeartMonitorState.MainDisplay || newState != HeartMonitorDaemon.HeartMonitorState.MainDisplay)
{
if (newState != HeartMonitorDaemon.HeartMonitorState.MainDisplay)
{
if (this.State == HeartMonitorDaemon.HeartMonitorState.MainDisplay)
{
this.opOpening = true;
this.opTransition = 0f;
}
}
else if (this.State != HeartMonitorDaemon.HeartMonitorState.Welcome)
{
this.opOpening = false;
this.opTransition = 0f;
}
else
{
this.opOpening = false;
this.opTransition = 2f;
}
this.State = newState;
this.timeThisState = 0f;
}
}
// Token: 0x06000305 RID: 773 RVA: 0x0002B700 File Offset: 0x00029900
public override void navigatedTo()
{
base.navigatedTo();
this.ChangeState(HeartMonitorDaemon.HeartMonitorState.Welcome);
if (this.os.Flags.HasFlag(this.PatientID + ":DEAD"))
{
this.PatientDead = true;
}
}
// Token: 0x06000306 RID: 774 RVA: 0x0002B74C File Offset: 0x0002994C
private void UpdateStates(float dt)
{
this.timeThisState += dt;
switch (this.State)
{
case HeartMonitorDaemon.HeartMonitorState.MainDisplay:
this.opTransition += (this.opOpening ? 1f : 2f) * dt;
break;
case HeartMonitorDaemon.HeartMonitorState.SecondaryLogin:
case HeartMonitorDaemon.HeartMonitorState.SecondaryLoginRunning:
case HeartMonitorDaemon.HeartMonitorState.Error:
case HeartMonitorDaemon.HeartMonitorState.FirmwareScreen:
case HeartMonitorDaemon.HeartMonitorState.FirmwareScreenConfirm:
this.opTransition += dt;
break;
case HeartMonitorDaemon.HeartMonitorState.FirmwareScreenLoading:
this.opTransition += dt;
this.firmwareLoadTime += (float)((double)dt * Utils.random.NextDouble());
if (this.firmwareLoadTime > 10f)
{
this.EnactFirmwareChange();
this.ChangeState(HeartMonitorDaemon.HeartMonitorState.FirmwareScreenComplete);
this.firmwareLoadTime = 0f;
}
break;
case HeartMonitorDaemon.HeartMonitorState.FirmwareScreenComplete:
this.opTransition += dt;
this.firmwareLoadTime += dt;
if (this.firmwareLoadTime > 3.3333333f)
{
this.ChangeState(HeartMonitorDaemon.HeartMonitorState.MainDisplay);
}
break;
}
}
// Token: 0x06000307 RID: 775 RVA: 0x0002B870 File Offset: 0x00029A70
public void ForceStopBeepSustainSound()
{
if (this.beepSustainSound != null)
{
this.beepSustainSound.Stop();
}
}
// Token: 0x06000308 RID: 776 RVA: 0x0002B908 File Offset: 0x00029B08
private void Update(float dt)
{
this.os.delayer.Post(ActionDelayer.Wait(this.os.lastGameTime.ElapsedGameTime.TotalSeconds * 1.999), delegate
{
if (this.os.display.command != this.name)
{
if (this.PatientDead)
{
this.beepSustainSound.Stop(true);
}
}
});
if (this.PatientInCardiacArrest)
{
this.PatientTimeInDanger += dt;
if (this.PatientTimeInDanger > 21f)
{
this.PatientDead = true;
this.HeartRate = 0;
this.os.Flags.AddFlag(this.PatientID + ":DEAD");
this.beepSustainSound.Play();
}
else
{
float num = 3.5f;
if (this.PatientTimeInDanger - dt < num && this.PatientTimeInDanger >= num)
{
if (this.os.currentMission.postingTitle == "Project Junebug")
{
MusicManager.FADE_TIME = 10f;
MusicManager.transitionToSong("Music/Ambient/dark_drone_008");
}
}
}
}
else
{
this.PatientTimeInDanger = 0f;
}
this.timeTillNextHeartbeat -= dt;
if (this.timeTillNextHeartbeat <= 0f && !this.PatientDead)
{
this.timeTillNextHeartbeat = this.timeBetweenHeartbeats + (Utils.randm(0.1f) - 0.05f);
if (this.PatientInCardiacArrest)
{
if (this.PatientTimeInDanger > 15f)
{
this.timeTillNextHeartbeat = 0.36f - 0.25f * (this.PatientTimeInDanger / 21f);
}
else
{
this.timeTillNextHeartbeat = Utils.randm(this.timeBetweenHeartbeats * 2f);
}
}
this.projectionFowardsTime += this.beatTime + dt;
for (int i = 0; i < this.Monitors.Count; i++)
{
this.Monitors[i].HeartBeat(this.beatTime);
}
this.UpdateReportsForHeartbeat();
if (this.State != HeartMonitorDaemon.HeartMonitorState.Welcome)
{
this.os.delayer.Post(ActionDelayer.Wait((double)(this.projectionFowardsTime + this.beatTime / 4f)), delegate
{
this.beepSound.Play(this.volume, 0f, 0f);
});
}
}
else if (this.projectionFowardsTime > 0.3f)
{
this.projectionFowardsTime -= dt;
}
else
{
for (int i = 0; i < this.Monitors.Count; i++)
{
this.Monitors[i].Update(dt);
}
}
if (this.PatientDead)
{
this.timeDead += dt;
if (this.timeDead > 5f)
{
float num2 = 1f - (this.timeDead - 5f) / 16f;
num2 *= this.volume;
num2 = Math.Max(0f, num2);
this.beepSustainSound.Volume = num2;
}
}
this.UpdateStates(dt);
this.UpdateReports(dt);
}
// Token: 0x06000309 RID: 777 RVA: 0x0002BC74 File Offset: 0x00029E74
public override void draw(Rectangle bounds, SpriteBatch sb)
{
base.draw(bounds, sb);
this.Update((float)this.os.lastGameTime.ElapsedGameTime.TotalSeconds);
if (this.bloomTarget == null || this.bloomTarget.Width != bounds.Width || this.bloomTarget.Height != bounds.Height)
{
this.bloomTarget = new RenderTarget2D(sb.GraphicsDevice, bounds.Width, bounds.Height);
this.secondaryBloomTarget = new RenderTarget2D(sb.GraphicsDevice, bounds.Width, bounds.Height);
}
if (this.BlurContentSpritebatch == null)
{
this.BlurContentSpritebatch = new SpriteBatch(sb.GraphicsDevice);
}
bool drawShadow = TextItem.DrawShadow;
TextItem.DrawShadow = false;
this.PostBloomDrawCalls.Clear();
this.StartBloomDraw(this.BlurContentSpritebatch);
Rectangle rectangle = bounds;
rectangle.X = (rectangle.Y = 0);
SpriteBatch spriteBatch = GuiData.spriteBatch;
GuiData.spriteBatch = this.BlurContentSpritebatch;
this.DrawStates(rectangle, this.BlurContentSpritebatch);
GuiData.spriteBatch = spriteBatch;
this.EndBloomDraw(bounds, rectangle, sb, this.BlurContentSpritebatch);
for (int i = 0; i < this.PostBloomDrawCalls.Count; i++)
{
this.PostBloomDrawCalls[i](bounds.X, bounds.Y, sb);
}
TextItem.DrawShadow = drawShadow;
}
// Token: 0x0600030A RID: 778 RVA: 0x0002BE00 File Offset: 0x0002A000
private void DrawStates(Rectangle bounds, SpriteBatch sb)
{
switch (this.State)
{
case HeartMonitorDaemon.HeartMonitorState.Welcome:
this.DrawWelcomeScreen(bounds, sb);
goto IL_2E;
}
this.DrawSegments(bounds, sb);
IL_2E:
if (this.State != HeartMonitorDaemon.HeartMonitorState.Welcome)
{
this.DrawOptionsPanel(bounds, sb);
}
}
// Token: 0x0600030B RID: 779 RVA: 0x0002BE54 File Offset: 0x0002A054
private void StartBloomDraw(SpriteBatch sb)
{
this.priorTarget = (RenderTarget2D)sb.GraphicsDevice.GetRenderTargets()[0].RenderTarget;
sb.GraphicsDevice.SetRenderTarget(this.bloomTarget);
sb.GraphicsDevice.Clear(Color.Transparent);
sb.Begin();
}
// Token: 0x0600030C RID: 780 RVA: 0x0002BEB0 File Offset: 0x0002A0B0
private void EndBloomDraw(Rectangle bounds, Rectangle zeroedBounds, SpriteBatch mainSB, SpriteBatch bloomContentSpritebatch)
{
bloomContentSpritebatch.End();
mainSB.GraphicsDevice.SetRenderTarget(this.secondaryBloomTarget);
mainSB.GraphicsDevice.Clear(Color.Transparent);
bloomContentSpritebatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.AnisotropicClamp, DepthStencilState.Default, RasterizerState.CullNone, this.blufEffect);
zeroedBounds.X -= 2;
bloomContentSpritebatch.Draw(this.bloomTarget, zeroedBounds, this.bloomColor);
zeroedBounds.X += 4;
bloomContentSpritebatch.Draw(this.bloomTarget, zeroedBounds, this.bloomColor);
zeroedBounds.X -= 2;
zeroedBounds.Y -= 2;
bloomContentSpritebatch.Draw(this.bloomTarget, zeroedBounds, this.bloomColor);
zeroedBounds.Y += 4;
bloomContentSpritebatch.Draw(this.bloomTarget, zeroedBounds, this.bloomColor);
bloomContentSpritebatch.End();
mainSB.GraphicsDevice.SetRenderTarget(this.priorTarget);
mainSB.Draw(this.bloomTarget, bounds, Color.White);
mainSB.Draw(this.secondaryBloomTarget, bounds, Color.White);
}
// Token: 0x0600030D RID: 781 RVA: 0x0002C25C File Offset: 0x0002A45C
public void DrawSegments(Rectangle bounds, SpriteBatch sb)
{
HeartMonitorDaemon.<>c__DisplayClassf CS$<>8__locals1 = new HeartMonitorDaemon.<>c__DisplayClassf();
CS$<>8__locals1.<>4__this = this;
int num = 26;
Rectangle rectangle = bounds;
rectangle.Height = bounds.Height / 4 - 4;
this.DrawGraph(this.HeartMonitor, rectangle, this.heartColor, sb, true);
Rectangle rectangle2 = rectangle;
rectangle2.Y += rectangle2.Height + 2;
CS$<>8__locals1.HRM_DisplayBounds = rectangle2;
CS$<>8__locals1.HRM_DisplayBounds.Width = rectangle2.Width / 3;
CS$<>8__locals1.showingHeartIcon = (this.timeSinceLastHeartBeat > this.beatTime * 1.6f && this.timeSinceLastHeartBeat < 4f * this.beatTime);
this.PostBloomDrawCalls.Add(delegate(int x, int y, SpriteBatch sprBatch)
{
Rectangle hrm_DisplayBounds = CS$<>8__locals1.HRM_DisplayBounds;
hrm_DisplayBounds.X += x;
hrm_DisplayBounds.Y += y;
CS$<>8__locals1.<>4__this.DrawMonitorNumericalDisplay(hrm_DisplayBounds, "HR", string.Concat(CS$<>8__locals1.<>4__this.HeartRate), sprBatch, CS$<>8__locals1.<>4__this.heartColor, CS$<>8__locals1.showingHeartIcon ? CS$<>8__locals1.<>4__this.Heart : null);
});
CS$<>8__locals1.statusMonitorBounds = rectangle2;
HeartMonitorDaemon.<>c__DisplayClassf CS$<>8__locals2 = CS$<>8__locals1;
CS$<>8__locals2.statusMonitorBounds.Width = CS$<>8__locals2.statusMonitorBounds.Width - (CS$<>8__locals1.HRM_DisplayBounds.Width + 8 + num);
HeartMonitorDaemon.<>c__DisplayClassf CS$<>8__locals3 = CS$<>8__locals1;
CS$<>8__locals3.statusMonitorBounds.X = CS$<>8__locals3.statusMonitorBounds.X + (CS$<>8__locals1.HRM_DisplayBounds.Width + 4 + num);
this.PostBloomDrawCalls.Add(delegate(int x, int y, SpriteBatch sprBatch)
{
Rectangle statusMonitorBounds2 = CS$<>8__locals1.statusMonitorBounds;
statusMonitorBounds2.X += x;
statusMonitorBounds2.Y += y;
string value = "OK";
Color col = Color.Gray;
Texture2D icon = null;
if (CS$<>8__locals1.<>4__this.timeSinceNormalHeartRate > 0.5f)
{
if (CS$<>8__locals1.<>4__this.timeSinceNormalHeartRate > 4f)
{
value = "DANGER";
col = Color.Red;
if (CS$<>8__locals1.<>4__this.os.timer % 0.3f < 0.1f)
{
icon = CS$<>8__locals1.<>4__this.WarnIcon;
}
}
else
{
value = "WARN";
col = Color.Yellow;
if (CS$<>8__locals1.<>4__this.os.timer % 0.5f < 0.2f)
{
icon = CS$<>8__locals1.<>4__this.WarnIcon;
}
}
}
CS$<>8__locals1.<>4__this.DrawMonitorStatusPanelDisplay(statusMonitorBounds2, "ALARM", value, sprBatch, col, icon);
});
CS$<>8__locals1.BPColor = new Color(148, 231, 243);
CS$<>8__locals1.BP_DisplayBounds = CS$<>8__locals1.HRM_DisplayBounds;
HeartMonitorDaemon.<>c__DisplayClassf CS$<>8__locals4 = CS$<>8__locals1;
CS$<>8__locals4.BP_DisplayBounds.Y = CS$<>8__locals4.BP_DisplayBounds.Y + (CS$<>8__locals1.BP_DisplayBounds.Height + 4);
this.PostBloomDrawCalls.Add(delegate(int x, int y, SpriteBatch sprBatch)
{
Rectangle bp_DisplayBounds = CS$<>8__locals1.BP_DisplayBounds;
bp_DisplayBounds.X += x;
bp_DisplayBounds.Y += y;
CS$<>8__locals1.<>4__this.DrawMonitorNumericalDisplay(bp_DisplayBounds, "BP", "133 : 97\n\n (109)", sprBatch, CS$<>8__locals1.BPColor, null);
});
Rectangle statusMonitorBounds = CS$<>8__locals1.statusMonitorBounds;
statusMonitorBounds.Y += statusMonitorBounds.Height + 4;
this.DrawGraph(this.BPMonitor, statusMonitorBounds, CS$<>8__locals1.BPColor, sb, true);
CS$<>8__locals1.SPColor = new Color(165, 241, 138);
CS$<>8__locals1.SP_DisplayBounds = CS$<>8__locals1.BP_DisplayBounds;
HeartMonitorDaemon.<>c__DisplayClassf CS$<>8__locals5 = CS$<>8__locals1;
CS$<>8__locals5.SP_DisplayBounds.Y = CS$<>8__locals5.SP_DisplayBounds.Y + (CS$<>8__locals1.SP_DisplayBounds.Height + 4);
this.PostBloomDrawCalls.Add(delegate(int x, int y, SpriteBatch sprBatch)
{
Rectangle sp_DisplayBounds = CS$<>8__locals1.SP_DisplayBounds;
sp_DisplayBounds.X += x;
sp_DisplayBounds.Y += y;
CS$<>8__locals1.<>4__this.DrawMonitorNumericalDisplay(sp_DisplayBounds, "Sp02", string.Concat(CS$<>8__locals1.<>4__this.reportedSP02), sprBatch, CS$<>8__locals1.SPColor, (CS$<>8__locals1.<>4__this.reportedSP02 >= 91) ? CS$<>8__locals1.<>4__this.OxyIcon : null);
});
Rectangle dest = statusMonitorBounds;
dest.Y += dest.Height + 4;
this.DrawGraph(this.SPMonitor, dest, CS$<>8__locals1.SPColor, sb, true);
}
// Token: 0x0600030E RID: 782 RVA: 0x0002C4C8 File Offset: 0x0002A6C8
private void DrawMonitorNumericalDisplay(Rectangle bounds, string display, string value, SpriteBatch sb, Color col, Texture2D icon = null)
{
float num = 45f;
Vector2 vector = TextItem.doMeasuredFontLabel(new Vector2((float)bounds.X + 2f, (float)bounds.Y + 2f), display, GuiData.font, new Color?(col), (float)bounds.Width - 12f, num);
int num2 = 8;
Rectangle destinationRectangle = new Rectangle((int)((float)bounds.X + vector.X + 9f), bounds.Y + num2, 8, (int)num - 2 * num2);
sb.Draw(Utils.white, destinationRectangle, Color.DarkRed);
if (icon != null)
{
sb.Draw(icon, new Rectangle(bounds.X + 2, (int)((float)bounds.Y + vector.Y + 2f), (int)num, (int)num), col);
}
TextItem.doFontLabelToSize(new Rectangle(bounds.X + bounds.Width / 3, bounds.Y + bounds.Height / 3, (int)((double)bounds.Width * 0.6), (int)((double)bounds.Height * 0.6)), value, GuiData.titlefont, col, false, false);
Rectangle destinationRectangle2 = new Rectangle(bounds.X + 4, bounds.Y + bounds.Height + 2, bounds.Width - 8, 1);
sb.Draw(Utils.white, destinationRectangle2, Color.Gray);
}
// Token: 0x0600030F RID: 783 RVA: 0x0002C644 File Offset: 0x0002A844
private void DrawMonitorStatusPanelDisplay(Rectangle bounds, string display, string value, SpriteBatch sb, Color col, Texture2D icon = null)
{
float num = 45f;
Vector2 vector = TextItem.doMeasuredFontLabel(new Vector2((float)bounds.X + 2f, (float)bounds.Y + 2f), display, GuiData.font, new Color?(col), (float)bounds.Width - 12f, num);
int num2 = 8;
Rectangle destinationRectangle = new Rectangle((int)((float)bounds.X + vector.X + 9f), bounds.Y + num2, 8, (int)num - 2 * num2);
sb.Draw(Utils.white, destinationRectangle, Color.DarkRed);
if (icon != null)
{
sb.Draw(icon, new Rectangle(bounds.X + 2, (int)((float)bounds.Y + vector.Y + 2f), (int)num, (int)num), col);
}
TextItem.doFontLabelToSize(new Rectangle(bounds.X + (int)((double)num * 1.5), bounds.Y + bounds.Height / 3, (int)((double)bounds.Width * 0.3), (int)((double)bounds.Height * 0.3)), value, GuiData.titlefont, col, false, false);
Rectangle destinationRectangle2 = new Rectangle(bounds.X + 4, bounds.Y + bounds.Height + 2, bounds.Width - 8, 1);
sb.Draw(Utils.white, destinationRectangle2, Color.Gray);
}
// Token: 0x06000310 RID: 784 RVA: 0x0002C82C File Offset: 0x0002AA2C
private void DrawGraph(IMedicalMonitor monitor, Rectangle dest, Color col, SpriteBatch sb, bool drawUnderline = true)
{
monitor.Draw(dest, sb, col, this.projectionFowardsTime);
if (drawUnderline)
{
this.PostBloomDrawCalls.Add(delegate(int x, int y, SpriteBatch sprBatch)
{
Rectangle destinationRectangle = new Rectangle(dest.X + 4 + x, dest.Y + dest.Height + 2 + y, dest.Width - 8, 1);
sprBatch.Draw(Utils.white, destinationRectangle, Color.Gray);
});
}
}
// Token: 0x06000311 RID: 785 RVA: 0x0002C88A File Offset: 0x0002AA8A
private void EnactFirmwareChange()
{
this.PatientInCardiacArrest = (this.selectedFirmwareData == PortExploits.DangerousPacemakerFirmware || this.selectedFirmwareData == PortExploits.DangerousPacemakerFirmwareLRNG);
}
// Token: 0x06000312 RID: 786 RVA: 0x0002CBE0 File Offset: 0x0002ADE0
public void DrawWelcomeScreen(Rectangle bounds, SpriteBatch sb)
{
HeartMonitorDaemon.<>c__DisplayClass16 CS$<>8__locals1 = new HeartMonitorDaemon.<>c__DisplayClass16();
CS$<>8__locals1.<>4__this = this;
CS$<>8__locals1.hasAdmin = (this.comp.adminIP == this.os.thisComputer.ip);
CS$<>8__locals1.graphColor = Color.Red;
CS$<>8__locals1.graphColor.A = 100;
if (CS$<>8__locals1.hasAdmin)
{
CS$<>8__locals1.graphColor = new Color(20, 200, 20, 100);
}
CS$<>8__locals1.heartRateDisplay = new Rectangle(bounds.X + 10, bounds.Y + bounds.Height / 4, bounds.Width - 20, bounds.Height / 4);
this.DrawGraph(this.HeartMonitor, CS$<>8__locals1.heartRateDisplay, CS$<>8__locals1.graphColor, sb, false);
HeartMonitorDaemon.<>c__DisplayClass16 CS$<>8__locals2 = CS$<>8__locals1;
CS$<>8__locals2.heartRateDisplay.Y = CS$<>8__locals2.heartRateDisplay.Y + (CS$<>8__locals1.heartRateDisplay.Height + 10);
CS$<>8__locals1.adminMsg = (CS$<>8__locals1.hasAdmin ? LocaleTerms.Loc("Admin Access Granted") : LocaleTerms.Loc("Admin Access Required"));
CS$<>8__locals1.adminMsg = CS$<>8__locals1.adminMsg.ToUpper();
CS$<>8__locals1.heartRateDisplay.Height = 20;
this.DrawLinedMessage(CS$<>8__locals1.adminMsg, CS$<>8__locals1.graphColor * 0.2f, CS$<>8__locals1.heartRateDisplay, sb);
CS$<>8__locals1.nextToButonsLineThing = new Rectangle(CS$<>8__locals1.heartRateDisplay.X + CS$<>8__locals1.heartRateDisplay.Width / 4 - 18, CS$<>8__locals1.heartRateDisplay.Y + CS$<>8__locals1.heartRateDisplay.Height + 10, 14, bounds.Height / 3);
sb.Draw(Utils.white, CS$<>8__locals1.nextToButonsLineThing, CS$<>8__locals1.graphColor * 0.2f);
this.PostBloomDrawCalls.Add(delegate(int x, int y, SpriteBatch sprBatch)
{
Rectangle heartRateDisplay = CS$<>8__locals1.heartRateDisplay;
heartRateDisplay.X += x;
heartRateDisplay.Y += y;
CS$<>8__locals1.<>4__this.DrawLinedMessage(CS$<>8__locals1.adminMsg, CS$<>8__locals1.graphColor, heartRateDisplay, sprBatch);
CS$<>8__locals1.nextToButonsLineThing.X = CS$<>8__locals1.nextToButonsLineThing.X + x;
CS$<>8__locals1.nextToButonsLineThing.Y = CS$<>8__locals1.nextToButonsLineThing.Y + y;
sprBatch.Draw(Utils.white, CS$<>8__locals1.nextToButonsLineThing, CS$<>8__locals1.graphColor);
heartRateDisplay.Y += heartRateDisplay.Height + 10;
heartRateDisplay.Width /= 2;
heartRateDisplay.X += heartRateDisplay.Width / 2;
heartRateDisplay.Height = 28;
heartRateDisplay.Height *= 2;
sprBatch.DrawString(GuiData.font, CS$<>8__locals1.<>4__this.comp.name, new Vector2((float)heartRateDisplay.X, (float)heartRateDisplay.Y), Color.White);
sprBatch.DrawString(GuiData.detailfont, "Kellis Biotech\nB-Type Pacemaker v2.44", new Vector2((float)(heartRateDisplay.X + 2), (float)(heartRateDisplay.Y + 30)), Color.White, 0f, Vector2.Zero, 0.8f, SpriteEffects.None, 0.5f);
heartRateDisplay.Y += heartRateDisplay.Height + 6;
heartRateDisplay.Height /= 2;
if (Button.doButton(686868001, heartRateDisplay.X, heartRateDisplay.Y, heartRateDisplay.Width, heartRateDisplay.Height + 6, LocaleTerms.Loc("View Monitor"), new Color?(CS$<>8__locals1.hasAdmin ? CS$<>8__locals1.<>4__this.os.highlightColor : Color.Gray)))
{
if (CS$<>8__locals1.hasAdmin)
{
CS$<>8__locals1.<>4__this.ChangeState(HeartMonitorDaemon.HeartMonitorState.MainDisplay);
}
}
heartRateDisplay.Y += heartRateDisplay.Height + 10 + 6;
if (Button.doButton(686868003, heartRateDisplay.X, heartRateDisplay.Y, heartRateDisplay.Width, heartRateDisplay.Height, LocaleTerms.Loc("Admin Login"), new Color?((!CS$<>8__locals1.hasAdmin) ? CS$<>8__locals1.<>4__this.os.highlightColor : Color.Gray)))
{
if (!CS$<>8__locals1.hasAdmin)
{
CS$<>8__locals1.<>4__this.os.runCommand("login");
}
}
heartRateDisplay.Y += heartRateDisplay.Height + 10;
if (Button.doButton(686868005, heartRateDisplay.X, heartRateDisplay.Y, heartRateDisplay.Width, heartRateDisplay.Height, LocaleTerms.Loc("Exit"), new Color?(CS$<>8__locals1.<>4__this.os.brightLockedColor)))
{
CS$<>8__locals1.<>4__this.os.display.command = "connect";
}
});
}
// Token: 0x06000313 RID: 787 RVA: 0x0002CDD0 File Offset: 0x0002AFD0
private void DrawLinedMessage(string message, Color col, Rectangle dest, SpriteBatch sb)
{
int num = 16;
SpriteFont smallfont = GuiData.smallfont;
Vector2 vector = smallfont.MeasureString(message);
vector.X += (float)num;
dest.Height = (int)(vector.Y + 0.5f);
Rectangle destinationRectangle = new Rectangle(dest.X, dest.Y + dest.Height / 2 - 1, dest.Width / 2 - (int)(vector.X / 2f), 2);
sb.Draw(Utils.white, destinationRectangle, col);
sb.DrawString(smallfont, message, new Vector2((float)(destinationRectangle.X + destinationRectangle.Width + num / 2), (float)(destinationRectangle.Y - dest.Height / 2)), col);
destinationRectangle.X = dest.X + dest.Width - destinationRectangle.Width;
sb.Draw(Utils.white, destinationRectangle, col);
}
// Token: 0x06000314 RID: 788 RVA: 0x0002D2D8 File Offset: 0x0002B4D8
private void DrawOptionsPanel(Rectangle bounds, SpriteBatch spritebatch)
{
int buttonWidth = 120;
float num = (float)(bounds.Width - buttonWidth) * 0.7f;
float num2 = Math.Min(1f, this.opTransition);
if (!this.opOpening)
{
num2 = 1f - num2;
}
num2 = Utils.QuadraticOutCurve(num2);
bool ShowingContent = num2 >= 0.98f;
float contentFade = 0f;
float num3 = 0.5f;
if (ShowingContent)
{
contentFade = Math.Min(1f + num3, this.opTransition) - num3;
}
int num4 = (int)(num2 * num) + buttonWidth;
Rectangle panelArea = new Rectangle(bounds.X + bounds.Width - num4, bounds.Y + bounds.Height / 10, num4, bounds.Height - bounds.Height / 5);
Rectangle buttonSourceRect = panelArea;
this.PostBloomDrawCalls.Add(delegate(int x, int y, SpriteBatch sprBatch)
{
Rectangle buttonSourceRect = buttonSourceRect;
buttonSourceRect.X += x;
buttonSourceRect.Y += y;
int num5 = bounds.Height / 4 + 12;
buttonSourceRect.Y += num5 - bounds.Height / 10;
int num6 = 30;
Rectangle destinationRectangle = buttonSourceRect;
destinationRectangle.Width = buttonWidth;
destinationRectangle.Height = num6;
destinationRectangle.X -= 2;
sprBatch.Draw(Utils.white, destinationRectangle, Utils.VeryDarkGray);
if (Button.doButton(83838001, destinationRectangle.X, destinationRectangle.Y, buttonWidth, num6, LocaleTerms.Loc("Login"), new Color?((this.State != HeartMonitorDaemon.HeartMonitorState.SecondaryLogin) ? this.os.highlightColor : Color.Black)))
{
this.ChangeState(HeartMonitorDaemon.HeartMonitorState.SecondaryLogin);
}
destinationRectangle.Y += num6 + 2;
sprBatch.Draw(Utils.white, destinationRectangle, Utils.VeryDarkGray);
if (Button.doButton(83838003, destinationRectangle.X, destinationRectangle.Y, buttonWidth, num6, LocaleTerms.Loc("Firmware"), new Color?((this.State != HeartMonitorDaemon.HeartMonitorState.FirmwareScreen) ? this.os.highlightColor : Color.Black)))
{
this.ChangeState(HeartMonitorDaemon.HeartMonitorState.FirmwareScreen);
}
destinationRectangle.Y += num6 + 2;
sprBatch.Draw(Utils.white, destinationRectangle, Utils.VeryDarkGray);
if (Button.doButton(83838006, destinationRectangle.X, destinationRectangle.Y, buttonWidth, num6, LocaleTerms.Loc("Monitor"), new Color?((this.State != HeartMonitorDaemon.HeartMonitorState.MainDisplay) ? this.os.highlightColor : Color.Black)))
{
this.ChangeState(HeartMonitorDaemon.HeartMonitorState.MainDisplay);
}
destinationRectangle.Y += num6 + 2;
sprBatch.Draw(Utils.white, destinationRectangle, Utils.VeryDarkGray);
if (Button.doButton(83838009, destinationRectangle.X, destinationRectangle.Y, buttonWidth, num6, LocaleTerms.Loc("Exit"), new Color?(this.os.lockedColor)))
{
this.ChangeState(HeartMonitorDaemon.HeartMonitorState.Welcome);
}
destinationRectangle.Y += num6 + 2;
panelArea.X += x;
panelArea.Y += y;
panelArea.X += buttonWidth - 3;
panelArea.Width -= buttonWidth;
if (this.opOpening || this.opTransition < 1f)
{
panelArea.Width += 2;
}
sprBatch.Draw(Utils.white, panelArea, this.os.outlineColor);
int num7 = 3;
panelArea.X += num7;
panelArea.Width -= 2 * num7;
panelArea.Y += num7;
panelArea.Height -= 2 * num7;
sprBatch.Draw(Utils.white, panelArea, this.os.indentBackgroundColor);
if (ShowingContent)
{
this.DrawOptionsPanelContent(panelArea, sprBatch, contentFade);
}
});
}
// Token: 0x06000315 RID: 789 RVA: 0x0002D438 File Offset: 0x0002B638
private Rectangle DrawOptionsPanelHeaders(Rectangle bounds, SpriteBatch sb, float contentFade)
{
Rectangle rectangle = bounds;
rectangle.Height = 30;
rectangle.X += 2;
rectangle.Width -= 4;
rectangle.Y += 2;
string message = LocaleTerms.Loc("Firmware Config");
this.DrawLinedMessage(message, this.os.highlightColor * contentFade, rectangle, sb);
rectangle.X -= 2;
this.DrawLinedMessage(message, this.os.highlightColor * contentFade * 0.2f, rectangle, sb);
rectangle.X += 4;
this.DrawLinedMessage(message, this.os.highlightColor * contentFade * 0.2f, rectangle, sb);
rectangle.X -= 2;
rectangle.Y += rectangle.Height - 10;
rectangle.Height = 54;
string text = LocaleTerms.Loc("Firmware Administration") + "\n" + LocaleTerms.Loc("Access") + " : ";
Color color = this.os.brightLockedColor;
if (this.HasSecondaryLogin)
{
text = text + " " + LocaleTerms.Loc("GRANTED");
color = this.os.brightUnlockedColor;
}
else
{
text = text + " " + LocaleTerms.Loc("DENIED");
}
color *= contentFade;
sb.DrawString(GuiData.font, text, new Vector2((float)rectangle.X, (float)rectangle.Y), color, 0f, Vector2.Zero, 0.8f, SpriteEffects.None, 0.6f);
rectangle.Y += rectangle.Height;
sb.DrawString(GuiData.tinyfont, LocaleTerms.Loc("Secondary security layer for firmware read/write access"), new Vector2((float)rectangle.X, (float)rectangle.Y), color * 0.7f, 0f, Vector2.Zero, 0.9f, SpriteEffects.None, 0.6f);
rectangle.Y += 15;
rectangle.Height = 1;
sb.Draw(Utils.white, rectangle, Color.Gray * contentFade * (float)(Utils.random.NextDouble() * 0.15 + 0.2800000011920929));
Rectangle result = new Rectangle(bounds.X, rectangle.Y, bounds.Width, bounds.Y + bounds.Height - rectangle.Y - rectangle.Height);
return result;
}
// Token: 0x06000316 RID: 790 RVA: 0x0002D6F4 File Offset: 0x0002B8F4
private void DrawOptionsPanelContent(Rectangle bounds, SpriteBatch sb, float contentFade)
{
Rectangle bounds2 = this.DrawOptionsPanelHeaders(bounds, sb, contentFade);
switch (this.State)
{
default:
this.DrawOptionsPanelLoginContent(bounds2, sb, contentFade);
break;
case HeartMonitorDaemon.HeartMonitorState.Error:
break;
case HeartMonitorDaemon.HeartMonitorState.FirmwareScreen:
case HeartMonitorDaemon.HeartMonitorState.FirmwareScreenConfirm:
case HeartMonitorDaemon.HeartMonitorState.FirmwareScreenLoading:
case HeartMonitorDaemon.HeartMonitorState.FirmwareScreenComplete:
this.DrawOptionsPanelFirmwareContent(bounds2, sb, contentFade);
break;
}
}
// Token: 0x06000317 RID: 791 RVA: 0x0002D754 File Offset: 0x0002B954
private void DrawOptionsPanelFirmwareContent(Rectangle bounds, SpriteBatch sb, float contentFade)
{
Color color = this.heartColor;
color.A = 0;
if (!this.HasSecondaryLogin)
{
Rectangle dest = new Rectangle(bounds.X + bounds.Width / 4, bounds.Y, bounds.Width / 2, bounds.Height);
TextItem.doFontLabelToSize(dest, string.Concat(new string[]
{
LocaleTerms.Loc("Firmware Administration"),
"\n",
LocaleTerms.Loc("Access Required"),
"\n",
LocaleTerms.Loc("Log In First")
}), GuiData.font, color, false, false);
}
else
{
switch (this.State)
{
default:
{
Folder folder = this.comp.files.root.searchForFolder("KBT_Pacemaker");
int num = folder.files.Count + 1;
string[] array = new string[num];
array[0] = LocaleTerms.Loc("Currently Active Firmware");
if (folder.files.Count > 0)
{
for (int i = 0; i < folder.files.Count; i++)
{
array[i + 1] = folder.files[i].name;
}
}
this.selectedFirmwareIndex = SelectableTextList.doFancyList(8937001, bounds.X + 2, bounds.Y + 10, (int)((float)bounds.Width - 4f), bounds.Height / 3, array, this.selectedFirmwareIndex, new Color?(this.os.topBarColor), false);
Rectangle rectangle = new Rectangle(bounds.X + 2, bounds.Y + 10 + bounds.Height / 3 + 4, bounds.Width - 4, bounds.Height / 4);
string data = (this.selectedFirmwareIndex != 0) ? folder.files[this.selectedFirmwareIndex - 1].data : null;
string filename = (this.selectedFirmwareIndex != 0) ? folder.files[this.selectedFirmwareIndex - 1].name : LocaleTerms.Loc("Currently Active Firmware");
bool flag = this.DrawSelectedFirmwareFileDetails(rectangle, sb, data, filename);
rectangle.Y += rectangle.Height + 6;
if (flag && this.selectedFirmwareIndex != 0)
{
rectangle.Height = 30;
if (!this.isConfirmingSelection)
{
if (Button.doButton(8937004, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, LocaleTerms.Loc("Activate This Firmware"), new Color?(this.os.highlightColor)))
{
this.isConfirmingSelection = true;
}
}
else
{
this.DrawLinedMessage(LocaleTerms.Loc("Confirm Firmware Activation"), this.os.brightLockedColor, rectangle, sb);
rectangle.Y += rectangle.Height;
if (Button.doButton(8937008, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, LocaleTerms.Loc("Confirm Activation"), new Color?(this.os.highlightColor)))
{
this.selectedFirmwareName = filename;
this.selectedFirmwareData = data;
this.ChangeState(HeartMonitorDaemon.HeartMonitorState.FirmwareScreenLoading);
this.firmwareLoadTime = 0f;
this.isConfirmingSelection = false;
}
rectangle.Y += rectangle.Height + 4;
rectangle.Height = 20;
if (Button.doButton(8937009, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, LocaleTerms.Loc("Cancel"), new Color?(this.os.lockedColor)))
{
this.ChangeState(HeartMonitorDaemon.HeartMonitorState.FirmwareScreen);
this.isConfirmingSelection = false;
}
}
}
break;
}
case HeartMonitorDaemon.HeartMonitorState.FirmwareScreenConfirm:
break;
case HeartMonitorDaemon.HeartMonitorState.FirmwareScreenLoading:
{
Rectangle bounds2 = bounds;
bounds2.X++;
bounds2.Width -= 2;
bounds2.Height = 110;
this.DrawSelectedFirmwareFileDetails(bounds2, sb, this.selectedFirmwareData, this.selectedFirmwareName);
bounds2.Y += bounds2.Height + 2;
Rectangle rectangle2 = bounds;
int num2 = bounds2.Height + 10;
rectangle2.Height -= num2;
rectangle2.Y += num2;
Rectangle destinationRectangle = rectangle2;
destinationRectangle.Height = 1;
float num3 = this.firmwareLoadTime / 10f;
color.A = 0;
for (int i = 0; i < rectangle2.Height; i += 3)
{
float num4 = (float)i / (float)rectangle2.Height;
if (num3 > num4)
{
destinationRectangle.Y = rectangle2.Y + i;
sb.Draw(Utils.white, destinationRectangle, color);
}
}
break;
}
case HeartMonitorDaemon.HeartMonitorState.FirmwareScreenComplete:
{
Rectangle rectangle3 = bounds;
rectangle3.X += 2;
rectangle3.Width -= 4;
rectangle3.Y += 2;
rectangle3.Height -= 4;
sb.Draw(Utils.white, rectangle3, this.os.brightLockedColor * 0.3f * contentFade);
rectangle3.X += 40;
rectangle3.Width -= 80;
TextItem.doFontLabelToSize(rectangle3, LocaleTerms.Loc("FIRMWARE UPDATE COMPLETE"), GuiData.font, Color.White, false, false);
break;
}
}
}
}
// Token: 0x06000318 RID: 792 RVA: 0x0002DD40 File Offset: 0x0002BF40
private bool DrawSelectedFirmwareFileDetails(Rectangle bounds, SpriteBatch sb, string data, string filename)
{
bool flag = data == null || this.IsValidFirmwareData(data);
Rectangle dest = bounds;
dest.Height = 28;
this.DrawLinedMessage(flag ? LocaleTerms.Loc("Valid Firmware File") : LocaleTerms.Loc("Invalid Firmware File"), flag ? this.heartColor : this.os.brightLockedColor, dest, sb);
dest.Y += dest.Height - 4;
Color value = Color.White;
if (!flag)
{
value = Color.Gray;
}
TextItem.doFontLabel(new Vector2((float)dest.X + 6f, (float)dest.Y), filename, GuiData.font, new Color?(value), (float)dest.Width, (float)dest.Height, false);
dest.Y += dest.Height + 2;
dest.Height = 14;
string text = string.Concat(new string[]
{
LocaleTerms.Loc("Invalid binary package"),
"\n",
LocaleTerms.Loc("Valid firmware packages must be"),
"\n",
LocaleTerms.Loc("digitally signed by an authorized manufacturer")
});
if (flag)
{
text = string.Concat(new string[]
{
LocaleTerms.Loc("Valid binary package"),
"\n",
LocaleTerms.Loc("Signed by"),
" : KELLIS BIOTECH\n",
LocaleTerms.Loc("Compiled by"),
" : EIDOLON SOFT"
});
}
TextItem.doFontLabel(new Vector2((float)dest.X + 6f, (float)dest.Y), text, GuiData.detailfont, new Color?(value * 0.7f), (float)(dest.Width - 12), float.MaxValue, false);
Rectangle destinationRectangle = bounds;
destinationRectangle.Y += destinationRectangle.Height - 1;
destinationRectangle.Height = 1;
sb.Draw(Utils.white, destinationRectangle, Color.Gray);
return flag;
}
// Token: 0x06000319 RID: 793 RVA: 0x0002DF5C File Offset: 0x0002C15C
private bool IsValidFirmwareData(string data)
{
return data == PortExploits.DangerousPacemakerFirmware || data == PortExploits.ValidPacemakerFirmware;
}
// Token: 0x0600031A RID: 794 RVA: 0x0002DFD4 File Offset: 0x0002C1D4
private void DrawOptionsPanelLoginContent(Rectangle bounds, SpriteBatch sb, float contentFade)
{
string text = LocaleTerms.Loc("A secondary login is required to review and modify running firmware. Personal login details are provided for each chip. If you have lost your login details, connect your support program to our content server") + " (111.105.22.1)";
Rectangle rectangle = new Rectangle(bounds.X + 2, bounds.Y + 10, bounds.Width - 4, 24);
text = Utils.SuperSmartTwimForWidth(text, rectangle.Width, GuiData.detailfont);