From e1a0433b6bac1a0db985e40b8e94cd43d0f7302a Mon Sep 17 00:00:00 2001 From: lempamo Date: Wed, 26 Jul 2017 21:00:35 -0400 Subject: fixing alexcode in downloader, part 1 --- .../WinClassicDownloader.Designer.cs | 28 ++++++++---------- .../GlobalPrograms/WinClassicDownloader.cs | 33 ++++++++++++---------- 2 files changed, 30 insertions(+), 31 deletions(-) (limited to 'TimeHACK.Main/GlobalPrograms') diff --git a/TimeHACK.Main/GlobalPrograms/WinClassicDownloader.Designer.cs b/TimeHACK.Main/GlobalPrograms/WinClassicDownloader.Designer.cs index b0822c9..425466a 100644 --- a/TimeHACK.Main/GlobalPrograms/WinClassicDownloader.Designer.cs +++ b/TimeHACK.Main/GlobalPrograms/WinClassicDownloader.Designer.cs @@ -29,28 +29,15 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - this.progBar = new TimeHACK.UI.ProgressBar(); this.amountLbl = new System.Windows.Forms.Label(); this.appName = new System.Windows.Forms.Label(); this.locationLbl = new System.Windows.Forms.Label(); this.transferLbl = new System.Windows.Forms.Label(); this.dlTimer = new System.Windows.Forms.Timer(this.components); this.dlSpeed = new System.Windows.Forms.Timer(this.components); + this.progBar = new System.Windows.Forms.ProgressBar(); this.SuspendLayout(); // - // progBar - // - this.progBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.progBar.Location = new System.Drawing.Point(5, 29); - this.progBar.Name = "progBar"; - this.progBar.Size = new System.Drawing.Size(290, 23); - this.progBar.ProgressColor = System.Drawing.Color.FromArgb(19, 36, 105); - this.progBar.Style = System.Windows.Forms.ProgressBarStyle.Blocks; - this.progBar.BlockWidth = 14; - this.progBar.BlockSpacing = 2; - this.progBar.TabIndex = 15; - // // amountLbl // this.amountLbl.AutoSize = true; @@ -98,10 +85,20 @@ this.dlSpeed.Interval = 750; this.dlSpeed.Tick += new System.EventHandler(this.dlSpeed_Tick); // + // progBar + // + this.progBar.BackColor = System.Drawing.Color.Silver; + this.progBar.ForeColor = System.Drawing.Color.Navy; + this.progBar.Location = new System.Drawing.Point(6, 32); + this.progBar.Name = "progBar"; + this.progBar.Size = new System.Drawing.Size(399, 23); + this.progBar.TabIndex = 15; + // // WinClassicDownloader // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Silver; this.Controls.Add(this.progBar); this.Controls.Add(this.amountLbl); this.Controls.Add(this.appName); @@ -116,13 +113,12 @@ } #endregion - - internal TimeHACK.UI.ProgressBar progBar; internal System.Windows.Forms.Label amountLbl; internal System.Windows.Forms.Label appName; internal System.Windows.Forms.Label locationLbl; internal System.Windows.Forms.Label transferLbl; private System.Windows.Forms.Timer dlTimer; private System.Windows.Forms.Timer dlSpeed; + private System.Windows.Forms.ProgressBar progBar; } } diff --git a/TimeHACK.Main/GlobalPrograms/WinClassicDownloader.cs b/TimeHACK.Main/GlobalPrograms/WinClassicDownloader.cs index 276ca7f..ce71b40 100644 --- a/TimeHACK.Main/GlobalPrograms/WinClassicDownloader.cs +++ b/TimeHACK.Main/GlobalPrograms/WinClassicDownloader.cs @@ -10,23 +10,16 @@ namespace TimeHACK.OS.Win95.Win95Apps public WinClassicDownloader() { InitializeComponent(); - } - private string DownloadSpeed(string str) + private string downloadSpeed() { Random rnd = new Random(); - int dl1 = rnd.Next(7, 9); - int dl2 = rnd.Next(1, 9); - int dl3 = rnd.Next(1, 9); - string speed = dl1.ToString() + "." + dl2.ToString() + dl3.ToString(); - return speed; + return rnd.Next(7, 9).ToString() + "." + rnd.Next(7, 9).ToString() + rnd.Next(7, 9).ToString(); } int amountToDL = 100; int amountDLed = 0; - Windows95 Windows95 = new Windows95(); - private void WinClassicDownloader_Load(object sender, EventArgs e) { @@ -37,11 +30,21 @@ namespace TimeHACK.OS.Win95.Win95Apps private void dlTimer_Tick(object sender, EventArgs e) { amountDLed = amountDLed + 8; - if(8 > amountToDL - amountDLed){ + if (8 > amountToDL - amountDLed) + { progBar.Value = 100; - amountLbl.Text = ("Downloaded " + amountDLed + " KB out of " + amountToDL + " KB"); + amountLbl.Text = $"Downloaded {amountDLed} KB out of {amountToDL}"; - if (appName.Text == "Downloading: Guess The Number") + switch (appName.Text) + { + case "Downloading: FTP Client": + CreateWindowsFile(Path.Combine(ProfileWindowsDirectory, "Desktop", "FTP Client setup.exe"), "ftp client setup"); + break; + case "Downloading: Web Chat 1998": + CreateWindowsFile(Path.Combine(ProfileWindowsDirectory, "Desktop", "Web Chat Setup.exe"), "web chat setup"); + break; + } + /* if (appName.Text == "Downloading: Guess The Number") { CreateWindowsFile(Path.Combine(ProfileWindowsDirectory, "Desktop", "Guess The Number Setup.exe"), "GuessTheNumber"); } @@ -72,7 +75,7 @@ namespace TimeHACK.OS.Win95.Win95Apps if (appName.Text == "Downloading: FTP Client") { CreateWindowsFile(Path.Combine(ProfileWindowsDirectory, "Desktop", "FTP Client setup.exe"), "ftp client setup"); - } + } */ ((Form)this.TopLevelControl).Close(); dlTimer.Stop(); } @@ -81,12 +84,12 @@ namespace TimeHACK.OS.Win95.Win95Apps progBar.Maximum = amountToDL; progBar.Value = amountDLed; } - amountLbl.Text = ("Downloaded " + amountDLed + " KB out of " + amountToDL); + amountLbl.Text = $"Downloaded {amountDLed} KB out of {amountToDL}"; } private void dlSpeed_Tick(object sender, EventArgs e) { - transferLbl.Text = ("Transfer speed: " + DownloadSpeed("") + " KB/s"); + transferLbl.Text = $"Transfer speed: {downloadSpeed()} KB/s"; } } } -- cgit v1.2.3