diff options
| author | Michael <[email protected]> | 2017-06-30 11:04:27 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-06-30 11:04:27 -0400 |
| commit | c7061e8e457a04a9dcecfd7eeb0db7d9e753ee31 (patch) | |
| tree | b552d89f675e605aed3f86f57b188c1676dc900c /ShiftOS_TheReturn | |
| parent | a1eb4b66997c6852b1629d592af8208a22fea219 (diff) | |
| download | shiftos_thereturn-c7061e8e457a04a9dcecfd7eeb0db7d9e753ee31.tar.gz shiftos_thereturn-c7061e8e457a04a9dcecfd7eeb0db7d9e753ee31.tar.bz2 shiftos_thereturn-c7061e8e457a04a9dcecfd7eeb0db7d9e753ee31.zip | |
file-infecting viruses
Diffstat (limited to 'ShiftOS_TheReturn')
| -rw-r--r-- | ShiftOS_TheReturn/VirusManager.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ShiftOS_TheReturn/VirusManager.cs b/ShiftOS_TheReturn/VirusManager.cs index 31152cc..b5c50b7 100644 --- a/ShiftOS_TheReturn/VirusManager.cs +++ b/ShiftOS_TheReturn/VirusManager.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Newtonsoft.Json; using ShiftOS.Objects; namespace ShiftOS.Engine @@ -13,8 +14,28 @@ namespace ShiftOS.Engine public static void Init() { + Desktop.InvokeOnWorkerThread(() => { + ShiftOS.Objects.ShiftFS.Utils.FileRead += (path) => + { + Desktop.InvokeOnWorkerThread(() => + { + var headerData = Objects.ShiftFS.Utils.GetHeaderText(path); + if(headerData != null) + { + try + { + var viruses = JsonConvert.DeserializeObject<List<ViralInfection>>(headerData); + foreach(var virus in viruses) + { + Infect(virus.ID, virus.ThreatLevel); + } + } + catch { } + } + }); + }; ActiveInfections = new List<IVirus>(); if (SaveSystem.CurrentSave.ViralInfections == null) SaveSystem.CurrentSave.ViralInfections = new List<ViralInfection>(); |
