From a476b1e977208cdac172da122603abad7c26d93d Mon Sep 17 00:00:00 2001 From: Alex-TIMEHACK Date: Sun, 23 Jul 2017 13:37:18 +0100 Subject: Fattened da file system Making it more realistic with more files that make sense --- .../OS/Win95/Win95Apps/Win95WindowsExplorer.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs') diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs index 44cf08f..91a44cc 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs @@ -250,13 +250,20 @@ namespace TimeHACK.OS.Win95.Win95Apps Program.nonimportantapps[Program.nonimportantapps.Count - 1].FormClosing += new FormClosingEventHandler(Program.NonImportantApp_Closing); break; - case "addressbook": - WinClassic appAdBk = wm.StartWin95(new WinClassicAddressBook(), "Address Book", Properties.Resources.WinClassicAddressBook, true, true); - Program.AddTaskbarItem(appAdBk, appAdBk.Tag.ToString(), "Address Book", Properties.Resources.WinClassicAddressBook); + case "ie": + if (TitleScreen.frm95.ie != null) { wm.StartInfobox95("Error Opening Internet Explorer", "An instance of Internet Explorer 4 is already open.", Properties.Resources.Win95Warning); return; } + TitleScreen.frm95.ie = wm.StartWin95(new WinClassicIE4(), "Internet Explorer 4", Properties.Resources.Win95IconIE4, true, true); + Program.AddTaskbarItem(TitleScreen.frm95.ie, TitleScreen.frm95.ie.Tag.ToString(), "Internet Explorer 4", Properties.Resources.Win95IconIE4); + TitleScreen.frm95.ie.BringToFront(); + TitleScreen.frm95.ie.FormClosing += new FormClosingEventHandler(TitleScreen.frm95.InternetExplorer4_Closing); - Program.nonimportantapps.Add(appAdBk); - Program.nonimportantapps[Program.nonimportantapps.Count - 1].BringToFront(); - Program.nonimportantapps[Program.nonimportantapps.Count - 1].FormClosing += new FormClosingEventHandler(Program.NonImportantApp_Closing); + break; + case "iebrokeninstaller": + wm.StartInfobox95("Internet Explorer Installation", "Installation Failed: The INF file was not found", Properties.Resources.Win95Error); + + break; + case "addressbook": + wm.StartInfobox95("Win32 Error", "This is not a valid Win32 Application.", Properties.Resources.Win95Error); break; } -- cgit v1.2.3 From 110089e0d7fcbc454dc55c0619ec4ccebc1a7e85 Mon Sep 17 00:00:00 2001 From: Alex-TIMEHACK Date: Sun, 23 Jul 2017 16:22:32 +0100 Subject: Realistic Desktop is finished! --- TimeHACK.Engine/DesktopController.cs | 36 ++++++- TimeHACK.Main/OS/Win95/Win95.Designer.cs | 4 +- TimeHACK.Main/OS/Win95/Win95.cs | 40 ++++--- .../OS/Win95/Win95Apps/Win95WindowsExplorer.cs | 20 +++- TimeHACK.Main/OS/Win95/Win95SaveAs.Designer.cs | 71 ------------ TimeHACK.Main/OS/Win95/Win95SaveAs.cs | 20 ---- TimeHACK.Main/OS/Win95/Win95SaveAs.resx | 120 --------------------- .../Win98/Win98Apps/WinClassicWindowsExplorer.cs | 4 +- TimeHACK.Main/TimeHACK.Main.csproj | 9 -- 9 files changed, 80 insertions(+), 244 deletions(-) delete mode 100644 TimeHACK.Main/OS/Win95/Win95SaveAs.Designer.cs delete mode 100644 TimeHACK.Main/OS/Win95/Win95SaveAs.cs delete mode 100644 TimeHACK.Main/OS/Win95/Win95SaveAs.resx (limited to 'TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs') diff --git a/TimeHACK.Engine/DesktopController.cs b/TimeHACK.Engine/DesktopController.cs index 6ccc4c1..a22df95 100644 --- a/TimeHACK.Engine/DesktopController.cs +++ b/TimeHACK.Engine/DesktopController.cs @@ -5,12 +5,34 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.IO; - +using Newtonsoft.Json; namespace TimeHACK.Engine { public static class DesktopController { + public static string ReadDataFile(string reqDirectory, bool returnYesIfProtected = false) + { + string Val = ""; + string directoryFileInfo; + directoryFileInfo = File.ReadAllText(Path.Combine(reqDirectory, "_data.info")); + FileSystemFolderInfo toRead = new FileSystemFolderInfo(); + toRead = JsonConvert.DeserializeObject(directoryFileInfo); + + if (returnYesIfProtected == true) + { + if (toRead.Isprotected == true) + { + return "yes"; + } + } + else + { + return toRead.label; + } + return Val; + } + public static void RefreshDesktopIcons(ListViewItem[] baseIcons, ref ListView theView, string theDirectory) { theView.Items.Clear(); // This resets it to it's default @@ -18,14 +40,18 @@ namespace TimeHACK.Engine foreach (string dir in Directory.GetDirectories(theDirectory)) { - theView.Items.Add(Path.GetFileName(dir)); - theView.FindItemWithText(Path.GetFileName(dir)).ImageIndex = 1; + string label = ReadDataFile(dir); + theView.Items.Add(label ?? Path.GetFileName(dir), 1); + theView.FindItemWithText(Path.GetFileName(dir)).Tag = dir; } foreach (string dir in Directory.GetFiles(theDirectory)) { - theView.Items.Add(Path.GetFileName(dir)); - theView.FindItemWithText(Path.GetFileName(dir)).ImageIndex = 12; + if (Path.GetFileName(dir) != "_data.info") + { + theView.Items.Add(Path.GetFileName(dir), 12); + theView.FindItemWithText(Path.GetFileName(dir)).Tag = dir; + } } } } diff --git a/TimeHACK.Main/OS/Win95/Win95.Designer.cs b/TimeHACK.Main/OS/Win95/Win95.Designer.cs index ffaad19..8c991c7 100644 --- a/TimeHACK.Main/OS/Win95/Win95.Designer.cs +++ b/TimeHACK.Main/OS/Win95/Win95.Designer.cs @@ -969,7 +969,7 @@ namespace TimeHACK.OS.Win95 this.desktopicons.Size = new System.Drawing.Size(640, 480); this.desktopicons.TabIndex = 6; this.desktopicons.UseCompatibleStateImageBehavior = false; - this.desktopicons.DoubleClick += new System.EventHandler(this.desktopicons_Click); + this.desktopicons.DoubleClick += new System.EventHandler(this.desktopicons_DoubleClick); this.desktopicons.MouseDown += new System.Windows.Forms.MouseEventHandler(this.desktop_mousedown); // // rightclickbackproperties @@ -1257,7 +1257,7 @@ namespace TimeHACK.OS.Win95 private System.Windows.Forms.ToolStripMenuItem installerTestToolStripMenuItem; private System.Windows.Forms.Panel taskbarItems; private System.Windows.Forms.ToolStripMenuItem storyTest1ToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem FTPClientToolStripMenuItem; + internal System.Windows.Forms.ToolStripMenuItem FTPClientToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem iE4TestToolStripMenuItem; private System.Windows.Forms.Timer desktopupdate; } diff --git a/TimeHACK.Main/OS/Win95/Win95.cs b/TimeHACK.Main/OS/Win95/Win95.cs index 7a2e9e1..d2f7507 100644 --- a/TimeHACK.Main/OS/Win95/Win95.cs +++ b/TimeHACK.Main/OS/Win95/Win95.cs @@ -259,7 +259,7 @@ namespace TimeHACK.OS.Win95 startmenu.Hide(); } - private void desktopicons_Click(object sender, EventArgs e) + private void desktopicons_DoubleClick(object sender, EventArgs e) { Point objDrawingPoint = desktopicons.PointToClient(Cursor.Position); ListViewItem objListViewItem; @@ -278,23 +278,37 @@ namespace TimeHACK.OS.Win95 ie.FormClosing += new FormClosingEventHandler(InternetExplorer4_Closing); startmenu.Hide(); } - else if (objListViewItem.Text == "Web Chat Setup") + else if (objListViewItem.Text == "My Computer") { - Win95Installer inst = new Win95Installer("Web Chat 1998"); - inst.InstallCompleted += (sendr, args) => WebChatToolStripMenuItem.Visible = true; - WinClassic app = wm.StartWin95(inst, "Web Chat Setup", null, true, true); - AddTaskBarItem(app, app.Tag.ToString(), "Web Chat Setup", null); + WinClassic app = wm.StartWin95(new Win95WindowsExplorer(), "Windows Explorer", Properties.Resources.WinClassicFileExplorer, true, true); + AddTaskBarItem(app, app.Tag.ToString(), "Windows Explorer", Properties.Resources.WinClassicFileExplorer); app.BringToFront(); startmenu.Hide(); } - else if (objListViewItem.Text == "FTP Client Setup") + else { - Win95Installer inst = new Win95Installer("FTP Client"); - inst.InstallCompleted += (sendr, args) => FTPClientToolStripMenuItem.Visible = true; - WinClassic app = wm.StartWin95(inst, "FTP Client Setup", null, true, true); - AddTaskBarItem(app, app.Tag.ToString(), "FTP Client Setup", null); - app.BringToFront(); - startmenu.Hide(); + // It is an actual file on the disk + + Win95WindowsExplorer we = new Win95WindowsExplorer(); + + // If it is a directory + + if (Directory.Exists(objListViewItem.Tag.ToString())) + { + we.CurrentDirectory = objListViewItem.Tag.ToString(); + + WinClassic app = wm.StartWin95(we, "Windows Explorer", Properties.Resources.WinClassicFileExplorer, true, true); + AddTaskBarItem(app, app.Tag.ToString(), "Windows Explorer", Properties.Resources.WinClassicFileExplorer); + app.BringToFront(); + startmenu.Hide(); + } + else + { + // Just open the file... + + we.OpenFile(objListViewItem.Tag.ToString()); + } + } } } diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs index 91a44cc..4777dae 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs @@ -22,7 +22,7 @@ namespace TimeHACK.OS.Win95.Win95Apps public string onlyViewExtension = ""; string ToReplaceWith = ProfileDirectory; - string CurrentDirectory = ProfileMyComputerDirectory; + public string CurrentDirectory = ProfileMyComputerDirectory; string OldLabelText; string CurrentCopyFile; @@ -200,7 +200,7 @@ namespace TimeHACK.OS.Win95.Win95Apps diskView.Nodes.Add(new TreeNode("Desktop", 0, 0, desktoparray)); } - void OpenFile(string fileDir) + public void OpenFile(string fileDir) { try { @@ -257,6 +257,22 @@ namespace TimeHACK.OS.Win95.Win95Apps TitleScreen.frm95.ie.BringToFront(); TitleScreen.frm95.ie.FormClosing += new FormClosingEventHandler(TitleScreen.frm95.InternetExplorer4_Closing); + break; + case "web chat setup": + Win95Installer inst = new Win95Installer("Web Chat 1998"); + inst.InstallCompleted += (sendr, args) => TitleScreen.frm95.WebChatToolStripMenuItem.Visible = true; + WinClassic appInstaller = wm.StartWin95(inst, "Web Chat Setup", null, true, true); + Program.AddTaskbarItem(appInstaller, appInstaller.Tag.ToString(), "Web Chat Setup", null); + appInstaller.BringToFront(); + + break; + case "ftp client setup": + Win95Installer instFtp = new Win95Installer("FTP Client"); + instFtp.InstallCompleted += (sendr, args) => TitleScreen.frm95.FTPClientToolStripMenuItem.Visible = true; + WinClassic appFtp = wm.StartWin95(instFtp, "FTP Client Setup", null, true, true); + Program.AddTaskbarItem(appFtp, appFtp.Tag.ToString(), "FTP Client Setup", null); + appFtp.BringToFront(); + break; case "iebrokeninstaller": wm.StartInfobox95("Internet Explorer Installation", "Installation Failed: The INF file was not found", Properties.Resources.Win95Error); diff --git a/TimeHACK.Main/OS/Win95/Win95SaveAs.Designer.cs b/TimeHACK.Main/OS/Win95/Win95SaveAs.Designer.cs deleted file mode 100644 index 980ddf3..0000000 --- a/TimeHACK.Main/OS/Win95/Win95SaveAs.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -namespace TimeHACK.OS.Win95 -{ - partial class Win95SaveAs - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.label1 = new System.Windows.Forms.Label(); - this.listView1 = new System.Windows.Forms.ListView(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(13, 10); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(47, 13); - this.label1.TabIndex = 0; - this.label1.Text = "Save In:"; - // - // listView1 - // - this.listView1.Location = new System.Drawing.Point(16, 35); - this.listView1.Name = "listView1"; - this.listView1.Size = new System.Drawing.Size(312, 110); - this.listView1.TabIndex = 1; - this.listView1.UseCompatibleStateImageBehavior = false; - this.listView1.View = System.Windows.Forms.View.List; - // - // Win95SaveAs - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.listView1); - this.Controls.Add(this.label1); - this.Name = "Win95SaveAs"; - this.Size = new System.Drawing.Size(348, 193); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.ListView listView1; - } -} diff --git a/TimeHACK.Main/OS/Win95/Win95SaveAs.cs b/TimeHACK.Main/OS/Win95/Win95SaveAs.cs deleted file mode 100644 index 96469e4..0000000 --- a/TimeHACK.Main/OS/Win95/Win95SaveAs.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace TimeHACK.OS.Win95 -{ - public partial class Win95SaveAs : UserControl - { - public Win95SaveAs() - { - InitializeComponent(); - } - } -} diff --git a/TimeHACK.Main/OS/Win95/Win95SaveAs.resx b/TimeHACK.Main/OS/Win95/Win95SaveAs.resx deleted file mode 100644 index 1af7de1..0000000 --- a/TimeHACK.Main/OS/Win95/Win95SaveAs.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs b/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs index 245d188..ef28bca 100644 --- a/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs +++ b/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs @@ -22,7 +22,7 @@ namespace TimeHACK.OS.Win95.Win95Apps public string onlyViewExtension = ""; string ToReplaceWith = ProfileDirectory; - string CurrentDirectory = ProfileMyComputerDirectory; + public string CurrentDirectory = ProfileMyComputerDirectory; string OldLabelText; string CurrentCopyFile; int fileType = 6; @@ -236,7 +236,7 @@ namespace TimeHACK.OS.Win95.Win95Apps diskView.Nodes.Add(new TreeNode("Desktop", 0, 0, desktoparray)); } - void OpenFile(string fileDir) + public void OpenFile(string fileDir) { try { diff --git a/TimeHACK.Main/TimeHACK.Main.csproj b/TimeHACK.Main/TimeHACK.Main.csproj index b9da71d..341090f 100644 --- a/TimeHACK.Main/TimeHACK.Main.csproj +++ b/TimeHACK.Main/TimeHACK.Main.csproj @@ -212,12 +212,6 @@ Win95WindowsExplorer.cs - - UserControl - - - Win95SaveAs.cs - UserControl @@ -383,9 +377,6 @@ Win95WindowsExplorer.cs Designer - - Win95SaveAs.cs - Win98.cs Designer -- cgit v1.2.3 From 2eac4232478d28e5bb2d93a60f17ba876680f045 Mon Sep 17 00:00:00 2001 From: Alex-TIMEHACK Date: Sun, 23 Jul 2017 18:19:09 +0100 Subject: Made the Downloader save .exe files to the Desktop These are then interpreted by the EXE file opening thing (For Windows 95 it's the Win95WindowsExplorer and for Windows 98/2000/ME it's really WinClassicWindowsExplorer --- TimeHACK.Engine/DesktopController.cs | 6 +++++- TimeHACK.Main/GlobalPrograms/WinClassicDownloader.cs | 18 ++++++++++-------- .../OS/Win95/Win95Apps/Win95WindowsExplorer.cs | 4 ++-- 3 files changed, 17 insertions(+), 11 deletions(-) (limited to 'TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs') diff --git a/TimeHACK.Engine/DesktopController.cs b/TimeHACK.Engine/DesktopController.cs index a22df95..f507ab8 100644 --- a/TimeHACK.Engine/DesktopController.cs +++ b/TimeHACK.Engine/DesktopController.cs @@ -49,7 +49,11 @@ namespace TimeHACK.Engine { if (Path.GetFileName(dir) != "_data.info") { - theView.Items.Add(Path.GetFileName(dir), 12); + int appIcon = 12; + + if (new FileInfo(dir).Extension == ".exe") appIcon = 8; + + theView.Items.Add(Path.GetFileName(dir), appIcon); theView.FindItemWithText(Path.GetFileName(dir)).Tag = dir; } } diff --git a/TimeHACK.Main/GlobalPrograms/WinClassicDownloader.cs b/TimeHACK.Main/GlobalPrograms/WinClassicDownloader.cs index c5d00a2..276ca7f 100644 --- a/TimeHACK.Main/GlobalPrograms/WinClassicDownloader.cs +++ b/TimeHACK.Main/GlobalPrograms/WinClassicDownloader.cs @@ -1,5 +1,7 @@ using System; +using System.IO; using System.Windows.Forms; +using static TimeHACK.Engine.SaveSystem; namespace TimeHACK.OS.Win95.Win95Apps { @@ -41,35 +43,35 @@ namespace TimeHACK.OS.Win95.Win95Apps if (appName.Text == "Downloading: Guess The Number") { - Windows95.desktopicons.Items.Add("Guess The Number Setup", imageIndex: 8); + CreateWindowsFile(Path.Combine(ProfileWindowsDirectory, "Desktop", "Guess The Number Setup.exe"), "GuessTheNumber"); } if (appName.Text == "Downloading: Start Runner") { - Windows95.desktopicons.Items.Add("Start Runner Setup", imageIndex: 9); + CreateWindowsFile(Path.Combine(ProfileWindowsDirectory, "Desktop", "Start Runner Setup.exe"), "StartRunner"); } if (appName.Text == "Downloading: Error Blaster") { - Windows95.desktopicons.Items.Add("Error Blaster Setup", imageIndex: 10); + CreateWindowsFile(Path.Combine(ProfileWindowsDirectory, "Desktop", "Error Blaster Setup.exe"), "ErrorBlaster"); } if (appName.Text == "Downloading: Skindows 95") { - Windows95.desktopicons.Items.Add("Skindows 95 Setup", imageIndex: 12); + CreateWindowsFile(Path.Combine(ProfileWindowsDirectory, "Desktop", "Skindows 95 Setup.exe"), "Skindows95Setup"); } if (appName.Text == "Downloading: Web Chat") { - TitleScreen.frm95.desktopicons.Items.Add("Web Chat Setup", imageIndex: 11); + CreateWindowsFile(Path.Combine(ProfileWindowsDirectory, "Desktop", "Web Chat Setup.exe"), "web chat setup"); } if (appName.Text == "Downloading: hwcv.exe") { - Windows95.desktopicons.Items.Add("hwcv.exe", imageIndex: 14); + CreateWindowsFile(Path.Combine(ProfileWindowsDirectory, "Desktop", "hwcv.exe"), "hwcv"); } if (appName.Text == "Downloading: Time Distorter") { - Windows95.desktopicons.Items.Add("Time Distorter Setup", imageIndex: 13); + CreateWindowsFile(Path.Combine(ProfileWindowsDirectory, "Desktop", "Time Distorter Setup.exe"), "time distorter setup"); } if (appName.Text == "Downloading: FTP Client") { - TitleScreen.frm95.desktopicons.Items.Add("FTP Client Setup", imageIndex: 11); + CreateWindowsFile(Path.Combine(ProfileWindowsDirectory, "Desktop", "FTP Client setup.exe"), "ftp client setup"); } ((Form)this.TopLevelControl).Close(); dlTimer.Stop(); diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs index 4777dae..4b0157e 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs @@ -227,7 +227,7 @@ namespace TimeHACK.OS.Win95.Win95Apps void OpenApplication(string appname) { switch (appname.ToLower()) - { + { case "explorer": Engine.Template.WinClassic app = wm.StartWin95(new Win95WindowsExplorer(), "Windows Explorer", Properties.Resources.WinClassicFileExplorer, true, true); Program.AddTaskbarItem(app, app.Tag.ToString(), "Windows Explorer", Properties.Resources.WinClassicFileExplorer); @@ -283,7 +283,7 @@ namespace TimeHACK.OS.Win95.Win95Apps break; } - } + } string ReturnType(string extension) { string returnVal = ""; -- cgit v1.2.3