aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Viruses/Shifticide.cs
blob: 2efa7437a46d1d617367c557863590f15de54a8b (plain) (blame)
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
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("shifticide", "Shifticide",  "Extremely deadly virus. This will delete your Home directory, and cannot be recovered.")]
    public class Shifticide : IVirus
    {
        private Timer _virusTimer = null;
        void IVirus.Disinfect()
        {
            _virusTimer.Stop();
            _virusTimer = null;
            if (ShiftOS.Objects.ShiftFS.Utils.DirectoryExists("0:/home"))
                ShiftOS.Objects.ShiftFS.Utils.CreateDirectory("0:/home");
            
        }

        void IVirus.Infect(int threatlevel)
        {
            _virusTimer = new Timer();
            _virusTimer.Interval = 5000 / threatlevel;
            if (ShiftOS.Objects.ShiftFS.Utils.DirectoryExists("0:/home"))
            ShiftOS.Objects.ShiftFS.Utils.Delete("0:/home");
        }
    }
}