aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Viruses
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS.WinForms/Viruses')
-rw-r--r--ShiftOS.WinForms/Viruses/BeeperVirus.cs33
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();
+ }
+ }
+}