From 22f94867ba365ec2dd56026684a72905dbe5f5d3 Mon Sep 17 00:00:00 2001 From: lempamo Date: Sun, 29 Oct 2017 12:04:18 -0400 Subject: [PATCH] random virus labels work! --- Histacom2.Engine/Histacom2.Engine.csproj | 1 + Histacom2/OS/WinXPBad/Story/Hack4.cs | 19 ++++++++++++++++++ Histacom2/OS/WinXPBad/VirusLabel.Designer.cs | 4 +--- .../OS/WinXPBad/WinClassicIE6Bad.Designer.cs | 8 -------- Histacom2/OS/WinXPBad/WinClassicIE6Bad.cs | 20 +++++-------------- Histacom2/OS/WinXPBad/WinClassicIE6Bad.resx | 6 ------ 6 files changed, 26 insertions(+), 32 deletions(-) diff --git a/Histacom2.Engine/Histacom2.Engine.csproj b/Histacom2.Engine/Histacom2.Engine.csproj index 6f852ed..b10bd1c 100644 --- a/Histacom2.Engine/Histacom2.Engine.csproj +++ b/Histacom2.Engine/Histacom2.Engine.csproj @@ -49,6 +49,7 @@ + diff --git a/Histacom2/OS/WinXPBad/Story/Hack4.cs b/Histacom2/OS/WinXPBad/Story/Hack4.cs index 3ed2244..ced4a13 100644 --- a/Histacom2/OS/WinXPBad/Story/Hack4.cs +++ b/Histacom2/OS/WinXPBad/Story/Hack4.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Forms; namespace Histacom2.OS.WinXPBad.Story { @@ -14,6 +15,8 @@ public class Hack4 : object { public static Win95.Win95Apps.WinClassicTerminal Console = new Win95.Win95Apps.WinClassicTerminal(true); static WindowManager wm = new WindowManager(); + public static bool Stop = false; + static Random Rnd = new Random(); public static async void StartObjective() { @@ -73,6 +76,7 @@ public static async void StartObjective() public static async void VirusDestruction(WinClassicIE6Bad ie) { + LabelMaker(); Console.ParentForm.Close(); await Task.Delay(10000); ((WinXP)ie.ParentForm).maximizebutton.Image = ((WinXP)ie.ParentForm).closebutton.Image; await Task.Delay(1000); ((WinXP)ie.ParentForm).minimizebutton.Image = ((WinXP)ie.ParentForm).closebutton.Image; @@ -96,6 +100,21 @@ public static async void VirusDestruction(WinClassicIE6Bad ie) await Task.Delay(1000); ie.backToolStripMenuItem.Visible = false; ie.panel1.Hide(); ie.label1.BackColor = Color.Black; await Task.Delay(1000); ie.label1.BackColor = Color.White; await Task.Delay(1000); ie.Hide(); + Stop = true; + } + + public static async void LabelMaker() + { + while (!Stop) + { + await Task.Delay(1000); + VirusLabel v = new VirusLabel(); + v.WindowState = FormWindowState.Maximized; + v.label1.Location = new Point(Rnd.Next(Screen.PrimaryScreen.Bounds.Width), Rnd.Next(Screen.PrimaryScreen.Bounds.Height)); + v.Show(); + v.TopMost = true; + v.BringToFront(); + } } } } diff --git a/Histacom2/OS/WinXPBad/VirusLabel.Designer.cs b/Histacom2/OS/WinXPBad/VirusLabel.Designer.cs index 34922ed..d711758 100644 --- a/Histacom2/OS/WinXPBad/VirusLabel.Designer.cs +++ b/Histacom2/OS/WinXPBad/VirusLabel.Designer.cs @@ -35,7 +35,6 @@ private void InitializeComponent() // // label1 // - this.label1.Dock = System.Windows.Forms.DockStyle.Fill; this.label1.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.ForeColor = System.Drawing.Color.PaleGreen; this.label1.Location = new System.Drawing.Point(0, 0); @@ -66,8 +65,7 @@ private void InitializeComponent() } #endregion - - private System.Windows.Forms.Label label1; private System.Windows.Forms.Timer timer1; + public System.Windows.Forms.Label label1; } } \ No newline at end of file diff --git a/Histacom2/OS/WinXPBad/WinClassicIE6Bad.Designer.cs b/Histacom2/OS/WinXPBad/WinClassicIE6Bad.Designer.cs index 1f51c7d..ca106d0 100644 --- a/Histacom2/OS/WinXPBad/WinClassicIE6Bad.Designer.cs +++ b/Histacom2/OS/WinXPBad/WinClassicIE6Bad.Designer.cs @@ -57,7 +57,6 @@ private void InitializeComponent() this.panel3 = new System.Windows.Forms.Panel(); this.label1 = new System.Windows.Forms.Label(); this.originalTimer = new System.Windows.Forms.Timer(this.components); - this.labelTimer = new System.Windows.Forms.Timer(this.components); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.menuStrip1.SuspendLayout(); @@ -318,12 +317,6 @@ private void InitializeComponent() this.originalTimer.Enabled = true; this.originalTimer.Tick += new System.EventHandler(this.originalTimer_Tick); // - // labelTimer - // - this.labelTimer.Enabled = true; - this.labelTimer.Interval = 1000; - this.labelTimer.Tick += new System.EventHandler(this.labelTimer_Tick); - // // WinClassicIE6Bad // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -366,7 +359,6 @@ private void InitializeComponent() private System.Windows.Forms.PictureBox pictureBox3; private System.Windows.Forms.Panel panel3; private System.Windows.Forms.Timer originalTimer; - private System.Windows.Forms.Timer labelTimer; public System.Windows.Forms.ToolStripMenuItem backToolStripMenuItem; public System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2; public System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3; diff --git a/Histacom2/OS/WinXPBad/WinClassicIE6Bad.cs b/Histacom2/OS/WinXPBad/WinClassicIE6Bad.cs index c4740fc..dfce481 100644 --- a/Histacom2/OS/WinXPBad/WinClassicIE6Bad.cs +++ b/Histacom2/OS/WinXPBad/WinClassicIE6Bad.cs @@ -15,11 +15,10 @@ namespace Histacom2.OS.WinXPBad public partial class WinClassicIE6Bad : UserControl { private bool light = true; - private Random r = new Random(); - private Random r2 = new Random(); + private static readonly Random Rnd = new Random(); - private int maxX; - private int maxY; + private int maxX = Screen.PrimaryScreen.Bounds.Width; + private int maxY = Screen.PrimaryScreen.Bounds.Height; public WinClassicIE6Bad() { @@ -40,19 +39,10 @@ private void originalTimer_Tick(object sender, EventArgs e) } } - private void labelTimer_Tick(object sender, EventArgs e) - { - VirusLabel v = new VirusLabel(); - v.Location = new Point(r.Next(0, maxX), r2.Next(0, maxY)); - v.Show(); - v.TopMost = true; - v.BringToFront(); - } - private void WinClassicIE6Bad_Load(object sender, EventArgs e) { - maxX = Screen.PrimaryScreen.Bounds.Width; - maxY = Screen.PrimaryScreen.Bounds.Height; + Console.WriteLine($"{maxX}, {maxY}."); + Hack4.VirusDestruction(this); ((WinXP)ParentForm).closeDisabled = true; } diff --git a/Histacom2/OS/WinXPBad/WinClassicIE6Bad.resx b/Histacom2/OS/WinXPBad/WinClassicIE6Bad.resx index 7ce63c0..1f5eeb4 100644 --- a/Histacom2/OS/WinXPBad/WinClassicIE6Bad.resx +++ b/Histacom2/OS/WinXPBad/WinClassicIE6Bad.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 17, 17 - @@ -310,7 +307,4 @@ 247, 17 - - 370, 17 - \ No newline at end of file