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 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