diff options
| author | Michael <[email protected]> | 2017-06-29 09:39:45 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-06-29 09:39:45 -0400 |
| commit | 07b2e388817ae50731808c1870bf74ccbda855ba (patch) | |
| tree | 683124af69845e229754f3b8c68527e6be16a8f6 /ShiftOS.WinForms/Viruses/BeeperVirus.cs | |
| parent | e65e99578d8f434d83412d4d5130f18c474ab40d (diff) | |
| download | shiftos_thereturn-07b2e388817ae50731808c1870bf74ccbda855ba.tar.gz shiftos_thereturn-07b2e388817ae50731808c1870bf74ccbda855ba.tar.bz2 shiftos_thereturn-07b2e388817ae50731808c1870bf74ccbda855ba.zip | |
Beeper virus
Diffstat (limited to 'ShiftOS.WinForms/Viruses/BeeperVirus.cs')
| -rw-r--r-- | ShiftOS.WinForms/Viruses/BeeperVirus.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/ShiftOS.WinForms/Viruses/BeeperVirus.cs b/ShiftOS.WinForms/Viruses/BeeperVirus.cs new file mode 100644 index 0000000..79299c9 --- /dev/null +++ b/ShiftOS.WinForms/Viruses/BeeperVirus.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ShiftOS.Engine; +using System.Windows.Forms; + +namespace ShiftOS.WinForms.Viruses +{ + [Virus("beeper", "Beeper", "Sends a few annoying beeps through the speaker repeatedly on a set interval. The threatlevel determines the interval.")] + public class BeeperVirus : IVirus + { + private Timer _virusTimer = null; + + public void Disinfect() + { + _virusTimer.Stop(); + _virusTimer = null; + } + + public void Infect(int threatlevel) + { + _virusTimer = new Timer(); + _virusTimer.Interval = 5000 / threatlevel; + _virusTimer.Tick += (o, a) => + { + Engine.AudioManager.PlayStream(Properties.Resources._3beepvirus); + }; + _virusTimer.Start(); + } + } +} |
