diff options
| author | Michael <[email protected]> | 2017-06-29 09:14:39 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-06-29 09:14:39 -0400 |
| commit | e65e99578d8f434d83412d4d5130f18c474ab40d (patch) | |
| tree | 89f49d25576598479bb23d0ce355f021f0d96514 /ShiftOS_TheReturn/VirusManager.cs | |
| parent | 027788fa853aab3f41b1115ac68c6635f9975252 (diff) | |
| download | shiftos_thereturn-e65e99578d8f434d83412d4d5130f18c474ab40d.tar.gz shiftos_thereturn-e65e99578d8f434d83412d4d5130f18c474ab40d.tar.bz2 shiftos_thereturn-e65e99578d8f434d83412d4d5130f18c474ab40d.zip | |
Implement the Virus Scanner.
Diffstat (limited to 'ShiftOS_TheReturn/VirusManager.cs')
| -rw-r--r-- | ShiftOS_TheReturn/VirusManager.cs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ShiftOS_TheReturn/VirusManager.cs b/ShiftOS_TheReturn/VirusManager.cs index 56767e6..f4a7fc6 100644 --- a/ShiftOS_TheReturn/VirusManager.cs +++ b/ShiftOS_TheReturn/VirusManager.cs @@ -96,5 +96,25 @@ namespace ShiftOS.Engine throw new Exception("Cannot create virus."); } + + public static void Disinfect(string id) + { + foreach(var virus in ActiveInfections.ToArray()) + { + var type = virus.GetType(); + var attrib = type.GetCustomAttributes(false).FirstOrDefault(x => x is VirusAttribute) as VirusAttribute; + if(attrib != null) + { + if (attrib.ID == id) + { + ActiveInfections.Remove(virus); + var inf = SaveSystem.CurrentSave.ViralInfections.FirstOrDefault(x => x.ID == id); + if (inf != null) + SaveSystem.CurrentSave.ViralInfections.Remove(inf); + virus.Disinfect(); + } + } + } + } } } |
