From 554fc5e2b3027f104fceda0421fed4352749d0f8 Mon Sep 17 00:00:00 2001 From: lempamo Date: Tue, 1 Aug 2017 10:28:47 -0400 Subject: fixed up moving to dirs --- TimeHACK.Engine/SaveSystem.cs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'TimeHACK.Engine/SaveSystem.cs') diff --git a/TimeHACK.Engine/SaveSystem.cs b/TimeHACK.Engine/SaveSystem.cs index e374ba9..f328144 100644 --- a/TimeHACK.Engine/SaveSystem.cs +++ b/TimeHACK.Engine/SaveSystem.cs @@ -89,7 +89,7 @@ namespace TimeHACK.Engine { get { - return Path.Combine(ProfileMyComputerDirectory, "Settings"); + return Path.Combine(ProfileMyComputerDirectory, "Documents and Settings"); } } @@ -97,7 +97,7 @@ namespace TimeHACK.Engine { get { - return Path.Combine(ProfileMyComputerDirectory, "Doc"); + return Path.Combine(ProfileMyComputerDirectory, "My Documents"); } } @@ -105,7 +105,7 @@ namespace TimeHACK.Engine { get { - return Path.Combine(ProfileMyComputerDirectory, "Prog"); + return Path.Combine(ProfileMyComputerDirectory, "Program Files"); } } @@ -113,7 +113,7 @@ namespace TimeHACK.Engine { get { - return Path.Combine(ProfileMyComputerDirectory, "Win"); + return Path.Combine(ProfileMyComputerDirectory, "Windows"); } } @@ -160,13 +160,13 @@ namespace TimeHACK.Engine SaveDirectoryInfo(ProfileDirectory, "folders", false, "My Computer", false); SaveDirectoryInfo(ProfileFileSystemDirectory, "CDrive", false, "C:", true); - if (CurrentSave.CurrentOS == "95" || CurrentSave.CurrentOS == "98") SaveDirectoryInfo(ProfileMyComputerDirectory, "Doc", false, "My Documents", true); - if (CurrentSave.CurrentOS == "2000" || CurrentSave.CurrentOS == "ME") SaveDirectoryInfo(ProfileMyComputerDirectory, "Settings", false, "Documents and Settings", true); - SaveDirectoryInfo(ProfileMyComputerDirectory, "Prog", true, "Program Files", true); + if (CurrentSave.CurrentOS == "95" || CurrentSave.CurrentOS == "98") SaveDirectoryInfo(ProfileMyComputerDirectory, "My Documents", false, "My Documents", true); + if (CurrentSave.CurrentOS == "2000" || CurrentSave.CurrentOS == "ME") SaveDirectoryInfo(ProfileMyComputerDirectory, "Documents and Settings", false, "Documents and Settings", true); + SaveDirectoryInfo(ProfileMyComputerDirectory, "Program Files", true, "Program Files", true); SaveDirectoryInfo(ProfileProgramsDirectory, "Accessories", false, "Accessories", true); SaveDirectoryInfo(ProfileProgramsDirectory, "Internet Explorer", true, "Internet Explorer", true); SaveDirectoryInfo(ProfileProgramsDirectory, "The Microsoft Network", true, "The Microsoft Network", true); - SaveDirectoryInfo(ProfileMyComputerDirectory, "Win", true, "Windows", true); + SaveDirectoryInfo(ProfileMyComputerDirectory, "Windows", true, "Windows", true); CreateWindowsFile(Path.Combine(ProfileProgramsDirectory, "Accessories"), "wordpad.exe", "wordpad"); CreateWindowsFile(Path.Combine(ProfileProgramsDirectory, "Internet Explorer"), "ie20.exe", "ie"); @@ -186,9 +186,10 @@ namespace TimeHACK.Engine SaveDirectoryInfo(ProfileWindowsDirectory, "Temp", true, "Temp", true); SaveDirectoryInfo(ProfileWindowsDirectory, "Desktop", true, "Desktop", true); - CreateWindowsFile(ProfileWindowsDirectory, "calc.exe", "calc", 10, 59392); - CreateWindowsFile(ProfileWindowsDirectory, "explorer.exe", "explorer", 10, 204288); - CreateWindowsFile(ProfileWindowsDirectory, "notepad.exe", "notepad", 12, 34034); + CreateWindowsFile(ProfileWindowsDirectory, "calc.exe", "calc", 13, 59392); + CreateWindowsFile(ProfileWindowsDirectory, "explorer.exe", "explorer", 0, 204288); + CreateWindowsFile(ProfileWindowsDirectory, "notepad.exe", "notepad", 14, 34034); + CreateWindowsFile(ProfileWindowsDirectory, "regedit.exe", "regedit", 15, 120320); } public static void CreateWindowsFile(string filepath, string filename, string contents, int fileicon = 8, int bytes = 512) -- cgit v1.2.3 From c0fd6c4d1b176d44f05d2f20c4d4439f3278f632 Mon Sep 17 00:00:00 2001 From: lempamo Date: Tue, 1 Aug 2017 13:05:37 -0400 Subject: added more "files" --- TimeHACK.Engine/SaveSystem.cs | 28 ++++-- TimeHACK.Engine/Template/Infobox95.Designer.cs | 14 +-- .../OS/Win95/Win95Apps/Win95WindowsExplorer.cs | 106 ++++++--------------- TimeHACK.Main/TitleScreen.cs | 15 +-- 4 files changed, 55 insertions(+), 108 deletions(-) (limited to 'TimeHACK.Engine/SaveSystem.cs') diff --git a/TimeHACK.Engine/SaveSystem.cs b/TimeHACK.Engine/SaveSystem.cs index f328144..32e2661 100644 --- a/TimeHACK.Engine/SaveSystem.cs +++ b/TimeHACK.Engine/SaveSystem.cs @@ -186,10 +186,14 @@ namespace TimeHACK.Engine SaveDirectoryInfo(ProfileWindowsDirectory, "Temp", true, "Temp", true); SaveDirectoryInfo(ProfileWindowsDirectory, "Desktop", true, "Desktop", true); + CreateWindowsFile(ProfileWindowsDirectory, "c", "", 8, 515); CreateWindowsFile(ProfileWindowsDirectory, "calc.exe", "calc", 13, 59392); + CreateWindowsFile(ProfileWindowsDirectory, "emm386.exe", "emm386", 10, 125495); CreateWindowsFile(ProfileWindowsDirectory, "explorer.exe", "explorer", 0, 204288); CreateWindowsFile(ProfileWindowsDirectory, "notepad.exe", "notepad", 14, 34034); CreateWindowsFile(ProfileWindowsDirectory, "regedit.exe", "regedit", 15, 120320); + CreateWindowsFile(ProfileWindowsDirectory, "win.com", "", 10, 22679); + CreateWindowsFile(ProfileWindowsDirectory, "write.exe", "wordpad", 16, 5120); } public static void CreateWindowsFile(string filepath, string filename, string contents, int fileicon = 8, int bytes = 512) @@ -206,18 +210,22 @@ namespace TimeHACK.Engine public static void UpdateDirectoryInfo(string path, THFileInfo newfile) { newfile.DOSName = newfile.Name.ToUpper().Replace("*", "").Replace("+", "").Replace(":", "").Replace(";", "").Replace(" ", ""); - string[] dos = newfile.DOSName.Split('.'); - - if (dos.Count() > 2) + if (newfile.DOSName.Contains(".")) { - List dosb = dos.ToList(); - dosb.RemoveRange(1, dos.Count() - 2); - dos = dosb.ToArray(); - } - dos[1] = dos[1].Substring(0, 3); - if (dos[0].Length > 8) dos[0] = dos[0].Substring(0, 6) + "~1"; + string[] dos = newfile.DOSName.Split('.'); + + if (dos.Count() > 2) + { + List dosb = dos.ToList(); + dosb.RemoveRange(1, dos.Count() - 2); + dos = dosb.ToArray(); + } + dos[1] = dos[1].Substring(0, 3); + if (dos[0].Length > 8) dos[0] = dos[0].Substring(0, 6) + "~1"; - newfile.DOSName = dos[0] + "." + dos[1]; + newfile.DOSName = dos[0] + "." + dos[1]; + } + else if (newfile.DOSName.Length > 8) newfile.DOSName = newfile.DOSName.Substring(0, 6) + "~1"; if (File.ReadAllText(Path.Combine(path, "_data.info")).Contains(newfile.DOSName)) return; FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject(File.ReadAllText(Path.Combine(path, "_data.info"))); diff --git a/TimeHACK.Engine/Template/Infobox95.Designer.cs b/TimeHACK.Engine/Template/Infobox95.Designer.cs index 56d6568..f9d89c7 100644 --- a/TimeHACK.Engine/Template/Infobox95.Designer.cs +++ b/TimeHACK.Engine/Template/Infobox95.Designer.cs @@ -51,7 +51,7 @@ this.programContent.Dock = System.Windows.Forms.DockStyle.Fill; this.programContent.Location = new System.Drawing.Point(0, 0); this.programContent.Name = "programContent"; - this.programContent.Size = new System.Drawing.Size(413, 138); + this.programContent.Size = new System.Drawing.Size(413, 118); this.programContent.TabIndex = 10; this.programContent.Tag = "gnoreFormOnTaskbar"; // @@ -61,7 +61,7 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button1.Location = new System.Drawing.Point(150, 104); + this.button1.Location = new System.Drawing.Point(150, 84); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(80, 23); this.button1.TabIndex = 5; @@ -75,7 +75,7 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button3.Location = new System.Drawing.Point(323, 104); + this.button3.Location = new System.Drawing.Point(323, 84); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(80, 23); this.button3.TabIndex = 4; @@ -99,7 +99,7 @@ this.panel1.Controls.Add(this.infoText); this.panel1.Location = new System.Drawing.Point(62, 16); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(341, 82); + this.panel1.Size = new System.Drawing.Size(341, 62); this.panel1.TabIndex = 2; // // infoText @@ -107,7 +107,7 @@ this.infoText.Dock = System.Windows.Forms.DockStyle.Fill; this.infoText.Location = new System.Drawing.Point(0, 0); this.infoText.Name = "infoText"; - this.infoText.Size = new System.Drawing.Size(341, 82); + this.infoText.Size = new System.Drawing.Size(341, 62); this.infoText.TabIndex = 0; this.infoText.Text = "label1"; // @@ -117,7 +117,7 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.button2.Location = new System.Drawing.Point(236, 104); + this.button2.Location = new System.Drawing.Point(236, 84); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(80, 23); this.button2.TabIndex = 1; @@ -131,7 +131,7 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.programContent); this.Name = "Infobox95"; - this.Size = new System.Drawing.Size(413, 138); + this.Size = new System.Drawing.Size(413, 118); this.programContent.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.panel1.ResumeLayout(false); diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs index c27f6a4..3debce7 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs @@ -12,6 +12,7 @@ using System.IO; using TimeHACK.Engine; using Newtonsoft.Json; using TimeHACK.Engine.Template; +using System.Diagnostics; namespace TimeHACK.OS.Win95.Win95Apps { @@ -52,22 +53,23 @@ namespace TimeHACK.OS.Win95.Win95Apps mainView.LargeImageList = new ImageList(); mainView.LargeImageList.ImageSize = new Size(32, 32); - mainView.LargeImageList.Images.Add(Properties.Resources.Win95Computer); - mainView.LargeImageList.Images.Add(Properties.Resources.WinClassicFolder); - mainView.LargeImageList.Images.Add(Properties.Resources.WinClassicIE4); - mainView.LargeImageList.Images.Add(Properties.Resources.WinClassicInbox); - mainView.LargeImageList.Images.Add(Properties.Resources.WinClassicMSN); - mainView.LargeImageList.Images.Add(Properties.Resources.WinClassicNetworking); - mainView.LargeImageList.Images.Add(Properties.Resources.WinClassicOutlook); - mainView.LargeImageList.Images.Add(Properties.Resources.WinClassicRecycle); - mainView.LargeImageList.Images.Add(Properties.Resources.Win95File); - mainView.LargeImageList.Images.Add(Properties.Resources.WinClassicFolder); - mainView.LargeImageList.Images.Add(Properties.Resources.WinClassicApp); - mainView.LargeImageList.Images.Add(Properties.Resources.WinClassicSetup); - mainView.LargeImageList.Images.Add(Properties.Resources.WinClassicNotepad); - mainView.LargeImageList.Images.Add(Properties.Resources.WinClassicCalcBig); - mainView.LargeImageList.Images.Add(Properties.Resources.WinClassicNotepadBig); - mainView.LargeImageList.Images.Add(Properties.Resources.WinClassicRegedit); + mainView.LargeImageList.Images.AddRange(new Bitmap[] { Properties.Resources.Win95Computer, // 0 + Properties.Resources.WinClassicFolder, + Properties.Resources.WinClassicIE4, + Properties.Resources.WinClassicInbox, + Properties.Resources.WinClassicMSN, + Properties.Resources.WinClassicNetworking, // 5 + Properties.Resources.WinClassicOutlook, + Properties.Resources.WinClassicRecycle, + Properties.Resources.Win95File, + Properties.Resources.WinClassicFolder, + Properties.Resources.WinClassicApp, // 10 + Properties.Resources.WinClassicSetup, + Properties.Resources.WinClassicNotepad, + Properties.Resources.WinClassicCalcBig, + Properties.Resources.WinClassicNotepadBig, + Properties.Resources.WinClassicRegedit, // 15 + Properties.Resources.WinClassicWordpad }); program.BringToFront(); @@ -162,39 +164,10 @@ namespace TimeHACK.OS.Win95.Win95Apps FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info"))); foreach(var item in fsfi.Files) { - if (item.Name == Path.GetFileName(str)) { itm.ImageIndex = item.FileIcon; break; } + Debug.Print(item.Name + " " + Path.GetFileName(str)); + if (item.Name == Path.GetFileName(str)) { itm.ImageIndex = item.FileIcon; return; } } - - /*switch (new FileInfo(str).Extension) - { - case ".exe": - string contents; - - contents = File.ReadAllText(str); - - switch (contents.ToLower()) - { - case "calc": - itm.ImageIndex = 13; - break; - case "explorer": - itm.ImageIndex = 0; - break; - case "notepad": - itm.ImageIndex = 12; - break; - default: - itm.ImageIndex = 10; - break; - } - break; - case ".txt": - itm.ImageIndex = 12; - break; - default: - itm.ImageIndex = 8; - break; - }*/ + itm.ImageIndex = 8; } } catch (Exception ex) { //wm.StartInfobox95("Exploring - C:", "Error with the file explorer \n" + ex.Message, Properties.Resources.Win95Info); add illegal operation dialog here later @@ -331,8 +304,8 @@ namespace TimeHACK.OS.Win95.Win95Apps } string ReturnType(string extension) { - string returnVal = ""; - fileType = 1; + string returnVal = "File"; + fileType = 0; switch (extension) { case ".txt": fileType = 1; @@ -725,19 +698,10 @@ namespace TimeHACK.OS.Win95.Win95Apps else OpenFile = true; if (OpenFile == true) { - if (txtSave.Text == "") - { - wm.StartInfobox95("Windows Explorer", "Please enter a filename", InfoboxType.Info, InfoboxButtons.OK); - } + if (txtSave.Text == "") wm.StartInfobox95("Windows Explorer", "Please enter a filename", InfoboxType.Info, InfoboxButtons.OK); else { - if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension) - { - - Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text); - - } - + if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension) Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text); FileDialogBoxManager.IsInOpenDialog = false; FileDialogBoxManager.IsInSaveDialog = false; @@ -809,22 +773,13 @@ namespace TimeHACK.OS.Win95.Win95Apps { string setText; setText = e.Label; - if (setText == "") - { - wm.StartInfobox95("Windows Explorer", "Please enter a new directory name", InfoboxType.Info, InfoboxButtons.OK); - } + if (setText == "") wm.StartInfobox95("Windows Explorer", "Please enter a new directory name", InfoboxType.Info, InfoboxButtons.OK); else { - if (Directory.Exists(setText)) - { - wm.StartInfobox95("Windows Explorer", "That directory already exists.", InfoboxType.Info, InfoboxButtons.OK); - } + if (Directory.Exists(setText)) wm.StartInfobox95("Windows Explorer", "That directory already exists.", InfoboxType.Info, InfoboxButtons.OK); else { - if (File.Exists(setText)) - { - wm.StartInfobox95("Windows Explorer", "That file already exists.", InfoboxType.Info, InfoboxButtons.OK); - } + if (File.Exists(setText)) wm.StartInfobox95("Windows Explorer", "That file already exists.", InfoboxType.Info, InfoboxButtons.OK); else { if (Directory.Exists(mainView.FocusedItem.ImageKey)) @@ -1019,10 +974,7 @@ namespace TimeHACK.OS.Win95.Win95Apps private void SellectAllCtrlAToolStripMenuItem_Click(object sender, EventArgs e) { - foreach (ListViewItem item in mainView.Items) - { - item.Selected = true; - } + foreach (ListViewItem item in mainView.Items) item.Selected = true; } } } diff --git a/TimeHACK.Main/TitleScreen.cs b/TimeHACK.Main/TitleScreen.cs index 6ee2ef1..90cd0af 100644 --- a/TimeHACK.Main/TitleScreen.cs +++ b/TimeHACK.Main/TitleScreen.cs @@ -56,10 +56,7 @@ namespace TimeHACK public void StartGame() { //TODO: You may want to handle story stuff to decide what OS to boot here. - if (Convert.ToInt32(VM_Width.Text) == 1337 && Convert.ToInt32(VM_Height.Text) == 1337) - { - leet(); - } + if (Convert.ToInt32(VM_Width.Text) == 1337 && Convert.ToInt32(VM_Height.Text) == 1337) leet(); else { // Time to decide which OS to start up! @@ -107,16 +104,6 @@ namespace TimeHACK } } - void closeButton(object sender, MouseEventArgs e) - { - Close(); - } - - private void closebutton_Click(object sender, EventArgs e) - { - Close(); - } - private void VM_WidthHeight_KeyPress(object sender, KeyPressEventArgs e) { if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && -- cgit v1.2.3