diff options
9 files changed, 487 insertions, 166 deletions
diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs index 3483dd6..e8ea655 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.Designer.cs @@ -28,6 +28,7 @@ /// </summary> private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.program = new System.Windows.Forms.Panel(); this.mainView = new System.Windows.Forms.ListView(); this.diskView = new System.Windows.Forms.TreeView(); @@ -42,7 +43,6 @@ this.RenameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.CloseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.EditToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.UndoCtrlZToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.CutCtrlXToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.CopyCtrlCToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.PasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -60,6 +60,7 @@ this.Button1 = new System.Windows.Forms.Button(); this.Label1 = new System.Windows.Forms.Label(); this.txtSave = new System.Windows.Forms.TextBox(); + this.refresh = new System.Windows.Forms.Timer(this.components); this.program.SuspendLayout(); this.MenuStrip1.SuspendLayout(); this.pnlSave.SuspendLayout(); @@ -189,7 +190,6 @@ // EditToolStripMenuItem // this.EditToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.UndoCtrlZToolStripMenuItem, this.CutCtrlXToolStripMenuItem, this.CopyCtrlCToolStripMenuItem, this.PasteToolStripMenuItem, @@ -198,35 +198,33 @@ this.EditToolStripMenuItem.Size = new System.Drawing.Size(39, 20); this.EditToolStripMenuItem.Text = "Edit"; // - // UndoCtrlZToolStripMenuItem - // - this.UndoCtrlZToolStripMenuItem.Name = "UndoCtrlZToolStripMenuItem"; - this.UndoCtrlZToolStripMenuItem.Size = new System.Drawing.Size(197, 22); - this.UndoCtrlZToolStripMenuItem.Text = "Undo Ctrl+Z"; - // // CutCtrlXToolStripMenuItem // this.CutCtrlXToolStripMenuItem.Name = "CutCtrlXToolStripMenuItem"; this.CutCtrlXToolStripMenuItem.Size = new System.Drawing.Size(197, 22); this.CutCtrlXToolStripMenuItem.Text = "Cut Ctrl+X"; + this.CutCtrlXToolStripMenuItem.Click += new System.EventHandler(this.CutCtrlXToolStripMenuItem_Click); // // CopyCtrlCToolStripMenuItem // this.CopyCtrlCToolStripMenuItem.Name = "CopyCtrlCToolStripMenuItem"; this.CopyCtrlCToolStripMenuItem.Size = new System.Drawing.Size(197, 22); this.CopyCtrlCToolStripMenuItem.Text = "Copy Ctrl+C"; + this.CopyCtrlCToolStripMenuItem.Click += new System.EventHandler(this.CopyCtrlCToolStripMenuItem_Click); // // PasteToolStripMenuItem // this.PasteToolStripMenuItem.Name = "PasteToolStripMenuItem"; this.PasteToolStripMenuItem.Size = new System.Drawing.Size(197, 22); this.PasteToolStripMenuItem.Text = "Paste Ctrl+V"; + this.PasteToolStripMenuItem.Click += new System.EventHandler(this.PasteToolStripMenuItem_Click); // // SellectAllCtrlAToolStripMenuItem // this.SellectAllCtrlAToolStripMenuItem.Name = "SellectAllCtrlAToolStripMenuItem"; this.SellectAllCtrlAToolStripMenuItem.Size = new System.Drawing.Size(197, 22); this.SellectAllCtrlAToolStripMenuItem.Text = "Select All Ctrl+A"; + this.SellectAllCtrlAToolStripMenuItem.Click += new System.EventHandler(this.SellectAllCtrlAToolStripMenuItem_Click); // // ViewToolStripMenuItem // @@ -239,7 +237,7 @@ // RefreshToolStripMenuItem // this.RefreshToolStripMenuItem.Name = "RefreshToolStripMenuItem"; - this.RefreshToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.RefreshToolStripMenuItem.Size = new System.Drawing.Size(113, 22); this.RefreshToolStripMenuItem.Text = "Refresh"; this.RefreshToolStripMenuItem.Click += new System.EventHandler(this.RefreshToolStripMenuItem_Click); // @@ -338,6 +336,11 @@ this.txtSave.Size = new System.Drawing.Size(542, 20); this.txtSave.TabIndex = 15; // + // refresh + // + this.refresh.Interval = 15000; + this.refresh.Tick += new System.EventHandler(this.refresh_Tick); + // // Win95WindowsExplorer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -371,7 +374,6 @@ internal System.Windows.Forms.ToolStripMenuItem RenameToolStripMenuItem; internal System.Windows.Forms.ToolStripMenuItem CloseToolStripMenuItem; internal System.Windows.Forms.ToolStripMenuItem EditToolStripMenuItem; - internal System.Windows.Forms.ToolStripMenuItem UndoCtrlZToolStripMenuItem; internal System.Windows.Forms.ToolStripMenuItem CutCtrlXToolStripMenuItem; internal System.Windows.Forms.ToolStripMenuItem CopyCtrlCToolStripMenuItem; internal System.Windows.Forms.ToolStripMenuItem PasteToolStripMenuItem; @@ -390,5 +392,6 @@ internal System.Windows.Forms.Button Button1; internal System.Windows.Forms.Label Label1; internal System.Windows.Forms.TextBox txtSave; + private System.Windows.Forms.Timer refresh; } } diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs index e85b39f..44cf08f 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.cs @@ -24,6 +24,8 @@ namespace TimeHACK.OS.Win95.Win95Apps string ToReplaceWith = ProfileDirectory; string CurrentDirectory = ProfileMyComputerDirectory; string OldLabelText; + string CurrentCopyFile; + int fileType = 6; //string attemptedDirectory = ""; WindowManager wm = new WindowManager(); @@ -49,40 +51,12 @@ namespace TimeHACK.OS.Win95.Win95Apps program.BringToFront(); - int loc = 0; - TreeNode[] folders = new TreeNode[new DirectoryInfo(CurrentDirectory).GetDirectories().Length]; - foreach (DirectoryInfo folder in new DirectoryInfo(CurrentDirectory).GetDirectories()) - { - if (folder.GetDirectories().Length > 0) - { - string label = ReadDataFile(folder.FullName, false); - TreeNode[] tn = createSubDirNodes(folder); - folders[loc] = new TreeNode(label ?? folder.Name, 2, 3, tn); - folders[loc].Tag = folder.FullName; - } - else - { - string label = ReadDataFile(folder.FullName, false); - folders[loc] = new TreeNode(label ?? folder.Name, 2, 3); - folders[loc].Tag = folder.FullName; - } - loc++; - } - TreeNode[] mypcarray = new TreeNode[3]; - mypcarray[0] = new TreeNode("(C:)", 1, 1, folders); - mypcarray[1] = new TreeNode("Control Panel", 4, 4); - mypcarray[2] = new TreeNode("Printers", 5, 5); - TreeNode[] desktoparray = new TreeNode[3]; - desktoparray[0] = new TreeNode("My Computer", 6, 6, mypcarray); - desktoparray[1] = new TreeNode("Network Neighborhood", 7, 7); - desktoparray[2] = new TreeNode("Recycle Bin", 8, 8); - diskView.Nodes.Add(new TreeNode("Desktop", 0, 0, desktoparray)); - //diskView.Items.Add("My Computer", 0); Application.DoEvents(); RefreshAll(); + RefreshTreeNode(); if (FileDialogBoxManager.IsInOpenDialog) { @@ -133,13 +107,8 @@ namespace TimeHACK.OS.Win95.Win95Apps void RefreshAll() { try { - // Refresh the right listview this.mainView.Items.Clear(); - // For Each drive As string In My.Computer.FileSystem.GetDirectories(GameMain.MyDocuments & "\HistacomVB\" & GameMain.SaveProfile & "\HistacomVB\Folders") - // If GetPropetiesForDir(drive)(4) = "isMyDocuments" Then - // diskView.Items.Add("", 0) - // End If - //Next + foreach (string str in Directory.GetDirectories(CurrentDirectory)) { string label = ReadDataFile(str, false); @@ -196,6 +165,41 @@ namespace TimeHACK.OS.Win95.Win95Apps } } + void RefreshTreeNode() + { + // Refresh the TreeView + + diskView.Nodes.Clear(); + int loc = 0; + TreeNode[] folders = new TreeNode[new DirectoryInfo(ProfileMyComputerDirectory).GetDirectories().Length]; + foreach (DirectoryInfo folder in new DirectoryInfo(ProfileMyComputerDirectory).GetDirectories()) + { + if (folder.GetDirectories().Length > 0) + { + string label = ReadDataFile(folder.FullName, false); + TreeNode[] tn = createSubDirNodes(folder); + folders[loc] = new TreeNode(label ?? folder.Name, 2, 3, tn); + folders[loc].Tag = folder.FullName; + } + else + { + string label = ReadDataFile(folder.FullName, false); + folders[loc] = new TreeNode(label ?? folder.Name, 2, 3); + folders[loc].Tag = folder.FullName; + } + loc++; + } + TreeNode[] mypcarray = new TreeNode[3]; + mypcarray[0] = new TreeNode("(C:)", 1, 1, folders); + mypcarray[1] = new TreeNode("Control Panel", 4, 4); + mypcarray[2] = new TreeNode("Printers", 5, 5); + TreeNode[] desktoparray = new TreeNode[3]; + desktoparray[0] = new TreeNode("My Computer", 6, 6, mypcarray); + desktoparray[1] = new TreeNode("Network Neighborhood", 7, 7); + desktoparray[2] = new TreeNode("Recycle Bin", 8, 8); + diskView.Nodes.Add(new TreeNode("Desktop", 0, 0, desktoparray)); + } + void OpenFile(string fileDir) { try @@ -621,14 +625,19 @@ namespace TimeHACK.OS.Win95.Win95Apps private void FolderToolStripMenuItem_Click(object sender, EventArgs e) { - if (File.Exists(CurrentDirectory + "\\New Folder")) { + if (File.Exists(CurrentDirectory + "\\New Folder")) + { wm.StartInfobox95("Windows Explorer", "This directory already exists", Properties.Resources.Win95Info); - } else { - Directory.CreateDirectory(CurrentDirectory + "\\New Folder"); - SaveDirectoryInfo(CurrentDirectory + "\\New Folder", false, "New Folder", true); - + } + else + { + Directory.CreateDirectory(Path.Combine(CurrentDirectory, "New Folder")); + SaveDirectoryInfo(Path.Combine(CurrentDirectory, "New Folder"), false, "New Folder", true); + RefreshAll(); } + + RefreshTreeNode(); } private void Button1_Click(object sender, EventArgs e) @@ -638,7 +647,7 @@ namespace TimeHACK.OS.Win95.Win95Apps bool OpenFile = false; if (mainView.FocusedItem != null) { - if ((string)mainView.FocusedItem.Tag == "") + if (mainView.FocusedItem.Tag.ToString() == "") { // If it isn't a file GoToDir(Path.Combine(CurrentDirectory, mainView.FocusedItem.Tag.ToString())); } @@ -691,7 +700,8 @@ namespace TimeHACK.OS.Win95.Win95Apps { RefreshAll(); } - + + RefreshTreeNode(); } internal static bool FileOrDirectoryExists(string path) @@ -726,43 +736,55 @@ namespace TimeHACK.OS.Win95.Win95Apps private void mainView_AfterLabelEdit(object sender, LabelEditEventArgs e) { - string setText; - setText = mainView.FocusedItem.Text; - if (setText == "") - { - wm.StartInfobox95("Windows Explorer", "Please enter a new directory name", Properties.Resources.Win95Info); - } - else + try { - if (Directory.Exists(setText)) + string setText; + setText = e.Label; + if (setText == "") { - wm.StartInfobox95("Windows Explorer", "That directory already exists.", Properties.Resources.Win95Info); + wm.StartInfobox95("Windows Explorer", "Please enter a new directory name", Properties.Resources.Win95Info); } else { - if (File.Exists(setText)) + if (Directory.Exists(setText)) { - wm.StartInfobox95("Windows Explorer", "That file already exists.", Properties.Resources.Win95Info); - } else { - if (File.Exists(OldLabelText)) + wm.StartInfobox95("Windows Explorer", "That directory already exists.", Properties.Resources.Win95Info); + } + else + { + if (File.Exists(setText)) { - // It was a file + wm.StartInfobox95("Windows Explorer", "That file already exists.", Properties.Resources.Win95Info); + } + else + { + if (Directory.Exists(mainView.FocusedItem.ImageKey)) + { + // It was a directory - File.Copy(Path.Combine(CurrentDirectory, OldLabelText), Path.Combine(CurrentDirectory, setText)); - File.Delete(Path.Combine(CurrentDirectory, OldLabelText)); - - } else { - // It was a directory + Directory.Move(mainView.FocusedItem.ImageKey, Path.Combine(CurrentDirectory, setText)); - Directory.CreateDirectory(Path.Combine(CurrentDirectory, setText)); - //File.Copy(Path.Combine(CurrentDirectory, OldLabelText, "*"), Path.Combine(CurrentDirectory, setText)); - Directory.Delete(Path.Combine(CurrentDirectory, OldLabelText)); + File.Delete(Path.Combine(CurrentDirectory, setText, "_data.info")); + + SaveDirectoryInfo(Path.Combine(CurrentDirectory, setText), false, $"{setText}", true); + } + else + { + // It was a file + + File.Copy(mainView.FocusedItem.ImageKey, Path.Combine(CurrentDirectory, setText)); + File.Delete(mainView.FocusedItem.ImageKey); + } } + } - } + RefreshAll(); + RefreshTreeNode(); + } + catch + { } - RefreshAll(); } private TreeNode[] createSubDirNodes(DirectoryInfo folder) @@ -793,5 +815,145 @@ namespace TimeHACK.OS.Win95.Win95Apps { RefreshAll(); } + + private void CutCtrlXToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + if (mainView.FocusedItem != null && mainView.FocusedItem.ImageKey != "") + { + + // It is a directory + string oldLocation; + oldLocation = mainView.FocusedItem.ImageKey; + + CurrentCopyFile = Path.Combine(GameDirectory, "Data", Path.GetFileName(mainView.FocusedItem.ImageKey)); + + if (Directory.Exists(CurrentCopyFile)) Directory.Delete(CurrentCopyFile); + if (File.Exists(CurrentCopyFile)) File.Delete(CurrentCopyFile); + + Directory.Move(mainView.FocusedItem.ImageKey, Path.Combine(GameDirectory, "Data", Path.GetDirectoryName(mainView.FocusedItem.ImageKey))); + + + DirectoryCopy(CurrentCopyFile, oldLocation, true); + } + else if (mainView.FocusedItem != null) + { + // It is a file + + CurrentCopyFile = Path.Combine(GameDirectory, "Data", Path.GetFileName(mainView.FocusedItem.Tag.ToString())); + + if (Directory.Exists(CurrentCopyFile)) Directory.Delete(CurrentCopyFile); + if (File.Exists(CurrentCopyFile)) File.Delete(CurrentCopyFile); + + File.Move(mainView.FocusedItem.Tag.ToString(), Path.Combine(GameDirectory, "Data", Path.GetFileName(mainView.FocusedItem.Tag.ToString()))); + + + } + RefreshAll(); + } + catch + { + } + } + + private void CopyCtrlCToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + if (mainView.FocusedItem != null && mainView.FocusedItem.ImageKey != "") + { + // It is a directory + string oldLocation; + oldLocation = mainView.FocusedItem.ImageKey; + CurrentCopyFile = Path.Combine(GameDirectory, "Data", Path.GetFileName(mainView.FocusedItem.ImageKey)); + + if (Directory.Exists(CurrentCopyFile)) Directory.Delete(CurrentCopyFile); + if (File.Exists(CurrentCopyFile)) File.Delete(CurrentCopyFile); + + DirectoryCopy(CurrentCopyFile, oldLocation, true); + } + else if (mainView.FocusedItem != null) + { + // It is a file + + CurrentCopyFile = Path.Combine(GameDirectory, "Data", Path.GetFileName(mainView.FocusedItem.Tag.ToString())); + + if (Directory.Exists(CurrentCopyFile)) Directory.Delete(CurrentCopyFile); + if (File.Exists(CurrentCopyFile)) File.Delete(CurrentCopyFile); + + File.Copy(mainView.FocusedItem.Tag.ToString(), Path.Combine(GameDirectory, "Data", Path.GetFileName(mainView.FocusedItem.Tag.ToString()))); + + } + RefreshAll(); + } + catch + { + } + } + + private void PasteToolStripMenuItem_Click(object sender, EventArgs e) + { + if (Directory.Exists(CurrentCopyFile)) + { + // It is a directory + + DirectoryCopy(CurrentCopyFile, CurrentDirectory, true); + } + else if (File.Exists(CurrentCopyFile)) + { + // It is a file + + File.Copy(CurrentCopyFile, Path.Combine(CurrentDirectory, Path.GetFileName(CurrentCopyFile))); + } + RefreshAll(); + } + + private static void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs) + { + // Get the subdirectories for the specified directory. + DirectoryInfo dir = new DirectoryInfo(sourceDirName); + + if (dir.Exists) + { + DirectoryInfo[] dirs = dir.GetDirectories(); + // If the destination directory doesn't exist, create it. + if (!Directory.Exists(destDirName)) + { + Directory.CreateDirectory(destDirName); + } + + // Get the files in the directory and copy them to the new location. + FileInfo[] files = dir.GetFiles(); + foreach (FileInfo file in files) + { + string temppath = Path.Combine(destDirName, file.Name); + file.CopyTo(temppath, false); + } + + // If copying subdirectories, copy them and their contents to new location. + if (copySubDirs) + { + foreach (DirectoryInfo subdir in dirs) + { + string temppath = Path.Combine(destDirName, subdir.Name); + DirectoryCopy(subdir.FullName, temppath, copySubDirs); + } + } + } + } + + private void refresh_Tick(object sender, EventArgs e) + { + RefreshAll(); + } + + private void SellectAllCtrlAToolStripMenuItem_Click(object sender, EventArgs e) + { + foreach (ListViewItem item in mainView.Items) + { + item.Selected = true; + } + } } } diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.resx b/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.resx index bb70361..e423ac1 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.resx +++ b/TimeHACK.Main/OS/Win95/Win95Apps/Win95WindowsExplorer.resx @@ -120,4 +120,10 @@ <metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> + <metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> + <metadata name="refresh.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>132, 17</value> + </metadata> </root>
\ No newline at end of file diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicNotepad.cs b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicNotepad.cs index db49c53..3117d9c 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicNotepad.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicNotepad.cs @@ -111,7 +111,6 @@ namespace TimeHACK.OS.Win95.Win95Apps ActivateSaveFileDialog(".txt"); string selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath(); - MessageBox.Show(selectedPath); if (selectedPath != "") { File.WriteAllText(selectedPath, mainText.Text); diff --git a/TimeHACK.Main/OS/Win98/Win98.cs b/TimeHACK.Main/OS/Win98/Win98.cs index 5585e7d..2fe4e3c 100644 --- a/TimeHACK.Main/OS/Win98/Win98.cs +++ b/TimeHACK.Main/OS/Win98/Win98.cs @@ -110,25 +110,6 @@ namespace TimeHACK.OS.Win98 // Bring to this the front this.BringToFront(); - //Check if it is the first time - if (CurrentSave.FTime95 == false) - { - CurrentSave.FTime95 = true; - SaveSystem.SaveGame(); - WinClassicWelcome welcome = new WinClassicWelcome(); - WinClassic app = wm.StartWin95(welcome, "Welcome", null, false, false); - AddTaskBarItem(app, app.Tag.ToString(), "Welcome", null); - - nonimportantapps.Add(app); - nonimportantapps[nonimportantapps.Count - 1].BringToFront(); - nonimportantapps[nonimportantapps.Count - 1].FormClosing += new FormClosingEventHandler(NonImportantApp_Closing); - - - - app.BringToFront(); - - } - } private void fontLoad() diff --git a/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.Designer.cs b/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.Designer.cs index a7e5bf1..16ee161 100644 --- a/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.Designer.cs +++ b/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.Designer.cs @@ -28,6 +28,7 @@ /// </summary> private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WinClassicWindowsExplorer)); this.program = new System.Windows.Forms.Panel(); this.mainView = new System.Windows.Forms.ListView(); @@ -76,6 +77,7 @@ this.HelpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.HelpToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.AboutWindows95ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.refresh = new System.Windows.Forms.Timer(this.components); this.program.SuspendLayout(); this.pnlInfo.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); @@ -116,6 +118,7 @@ this.mainView.TabIndex = 10; this.mainView.UseCompatibleStateImageBehavior = false; this.mainView.View = System.Windows.Forms.View.List; + this.mainView.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.mainView_AfterLabelEdit); this.mainView.SelectedIndexChanged += new System.EventHandler(this.mainView_SelectedIndexChanged); this.mainView.DoubleClick += new System.EventHandler(this.mainView_DoubleClick); // @@ -462,24 +465,28 @@ this.CutCtrlXToolStripMenuItem.Name = "CutCtrlXToolStripMenuItem"; this.CutCtrlXToolStripMenuItem.Size = new System.Drawing.Size(197, 22); this.CutCtrlXToolStripMenuItem.Text = "Cut Ctrl+X"; + this.CutCtrlXToolStripMenuItem.Click += new System.EventHandler(this.CutCtrlXToolStripMenuItem_Click); // // CopyCtrlCToolStripMenuItem // this.CopyCtrlCToolStripMenuItem.Name = "CopyCtrlCToolStripMenuItem"; this.CopyCtrlCToolStripMenuItem.Size = new System.Drawing.Size(197, 22); this.CopyCtrlCToolStripMenuItem.Text = "Copy Ctrl+C"; + this.CopyCtrlCToolStripMenuItem.Click += new System.EventHandler(this.CopyCtrlCToolStripMenuItem_Click); // // PasteToolStripMenuItem // this.PasteToolStripMenuItem.Name = "PasteToolStripMenuItem"; this.PasteToolStripMenuItem.Size = new System.Drawing.Size(197, 22); this.PasteToolStripMenuItem.Text = "Paste Ctrl+V"; + this.PasteToolStripMenuItem.Click += new System.EventHandler(this.PasteToolStripMenuItem_Click); // // SellectAllCtrlAToolStripMenuItem // this.SellectAllCtrlAToolStripMenuItem.Name = "SellectAllCtrlAToolStripMenuItem"; this.SellectAllCtrlAToolStripMenuItem.Size = new System.Drawing.Size(197, 22); - this.SellectAllCtrlAToolStripMenuItem.Text = "Select All Ctrl+A"; + this.SellectAllCtrlAToolStripMenuItem.Text = "Select All Ctrl+A"; + this.SellectAllCtrlAToolStripMenuItem.Click += new System.EventHandler(this.SellectAllCtrlAToolStripMenuItem_Click); // // ViewToolStripMenuItem // @@ -528,6 +535,12 @@ this.AboutWindows95ToolStripMenuItem.Text = "About Windows 95"; this.AboutWindows95ToolStripMenuItem.Click += new System.EventHandler(this.AboutWindows95ToolStripMenuItem_Click); // + // refresh + // + this.refresh.Enabled = true; + this.refresh.Interval = 15000; + this.refresh.Tick += new System.EventHandler(this.refresh_Tick); + // // WinClassicWindowsExplorer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -605,5 +618,6 @@ private System.Windows.Forms.Label txtInfoDescType; private System.Windows.Forms.Label txtInfoDescName; private System.Windows.Forms.Label txtInfoDescSize; + private System.Windows.Forms.Timer refresh; } } diff --git a/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs b/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs index e97276d..35d8cd3 100644 --- a/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs +++ b/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs @@ -24,6 +24,7 @@ namespace TimeHACK.OS.Win95.Win95Apps string ToReplaceWith = ProfileDirectory; string CurrentDirectory = ProfileMyComputerDirectory; string OldLabelText; + string CurrentCopyFile; int fileType = 6; //string attemptedDirectory = ""; WindowManager wm = new WindowManager(); @@ -55,40 +56,11 @@ namespace TimeHACK.OS.Win95.Win95Apps program.BringToFront(); - int loc = 0; - TreeNode[] folders = new TreeNode[new DirectoryInfo(CurrentDirectory).GetDirectories().Length]; - foreach (DirectoryInfo folder in new DirectoryInfo(CurrentDirectory).GetDirectories()) - { - if (folder.GetDirectories().Length > 0) - { - string label = ReadDataFile(folder.FullName, false); - TreeNode[] tn = createSubDirNodes(folder); - folders[loc] = new TreeNode(label ?? folder.Name, 2, 3, tn); - folders[loc].Tag = folder.FullName; - } - else - { - string label = ReadDataFile(folder.FullName, false); - folders[loc] = new TreeNode(label ?? folder.Name, 2, 3); - folders[loc].Tag = folder.FullName; - } - loc++; - } - TreeNode[] mypcarray = new TreeNode[3]; - mypcarray[0] = new TreeNode("(C:)", 1, 1, folders); - mypcarray[1] = new TreeNode("Control Panel", 4, 4); - mypcarray[2] = new TreeNode("Printers", 5, 5); - TreeNode[] desktoparray = new TreeNode[3]; - desktoparray[0] = new TreeNode("My Computer", 6, 6, mypcarray); - desktoparray[1] = new TreeNode("Network Neighborhood", 7, 7); - desktoparray[2] = new TreeNode("Recycle Bin", 8, 8); - diskView.Nodes.Add(new TreeNode("Desktop", 0, 0, desktoparray)); - - //diskView.Items.Add("My Computer", 0); Application.DoEvents(); RefreshAll(); + RefreshTreeNode(); if (FileDialogBoxManager.IsInOpenDialog) { @@ -152,13 +124,8 @@ namespace TimeHACK.OS.Win95.Win95Apps void RefreshAll() { try { - // Refresh the right listview + this.mainView.Items.Clear(); - // For Each drive As string In My.Computer.FileSystem.GetDirectories(GameMain.MyDocuments & "\HistacomVB\" & GameMain.SaveProfile & "\HistacomVB\Folders") - // If GetPropetiesForDir(drive)(4) = "isMyDocuments" Then - // diskView.Items.Add("", 0) - // End If - //Next // Update the WebView @@ -233,6 +200,42 @@ namespace TimeHACK.OS.Win95.Win95Apps } } + void RefreshTreeNode() + { + // Refresh the TreeView + + diskView.Nodes.Clear(); + + int loc = 0; + TreeNode[] folders = new TreeNode[new DirectoryInfo(ProfileMyComputerDirectory).GetDirectories().Length]; + foreach (DirectoryInfo folder in new DirectoryInfo(ProfileMyComputerDirectory).GetDirectories()) + { + if (folder.GetDirectories().Length > 0) + { + string label = ReadDataFile(folder.FullName, false); + TreeNode[] tn = createSubDirNodes(folder); + folders[loc] = new TreeNode(label ?? folder.Name, 2, 3, tn); + folders[loc].Tag = folder.FullName; + } + else + { + string label = ReadDataFile(folder.FullName, false); + folders[loc] = new TreeNode(label ?? folder.Name, 2, 3); + folders[loc].Tag = folder.FullName; + } + loc++; + } + TreeNode[] mypcarray = new TreeNode[3]; + mypcarray[0] = new TreeNode("(C:)", 1, 1, folders); + mypcarray[1] = new TreeNode("Control Panel", 4, 4); + mypcarray[2] = new TreeNode("Printers", 5, 5); + TreeNode[] desktoparray = new TreeNode[3]; + desktoparray[0] = new TreeNode("My Computer", 6, 6, mypcarray); + desktoparray[1] = new TreeNode("Network Neighborhood", 7, 7); + desktoparray[2] = new TreeNode("Recycle Bin", 8, 8); + diskView.Nodes.Add(new TreeNode("Desktop", 0, 0, desktoparray)); + } + void OpenFile(string fileDir) { try @@ -669,11 +672,13 @@ namespace TimeHACK.OS.Win95.Win95Apps if (File.Exists(CurrentDirectory + "\\New Folder")) { wm.StartInfobox95("Windows Explorer", "This directory already exists", Properties.Resources.Win95Info); } else { - Directory.CreateDirectory(CurrentDirectory + "\\New Folder"); - SaveDirectoryInfo(CurrentDirectory + "\\New Folder", false, "New Folder", true); + Directory.CreateDirectory(Path.Combine(CurrentDirectory, "New Folder")); + SaveDirectoryInfo(Path.Combine(CurrentDirectory, "New Folder"), false, "New Folder", true); RefreshAll(); } + + RefreshTreeNode(); } private void Button1_Click(object sender, EventArgs e) @@ -721,16 +726,17 @@ namespace TimeHACK.OS.Win95.Win95Apps { try { - if (!FileOrDirectoryExists(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text))) + if (!FileOrDirectoryExists(mainView.FocusedItem.ImageKey)) { wm.StartInfobox95("Windows Explorer", "This directory doesn't exist", Properties.Resources.Win95Info); } else { - if (Directory.Exists(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text))) Directory.Delete(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text), true); - else File.Delete(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text)); + if (Directory.Exists(mainView.FocusedItem.ImageKey)) Directory.Delete(mainView.FocusedItem.ImageKey, true); + else File.Delete(mainView.FocusedItem.ImageKey); RefreshAll(); + RefreshTreeNode(); } } catch { @@ -770,48 +776,53 @@ namespace TimeHACK.OS.Win95.Win95Apps private void mainView_AfterLabelEdit(object sender, LabelEditEventArgs e) { - - string setText; - setText = mainView.FocusedItem.Text; - if (setText == "") - { - wm.StartInfobox95("Windows Explorer", "Please enter a new directory name", Properties.Resources.Win95Info); - } - else - { - if (Directory.Exists(setText)) + try { + string setText; + setText = e.Label; + if (setText == "") { - wm.StartInfobox95("Windows Explorer", "That directory already exists.", Properties.Resources.Win95Info); + wm.StartInfobox95("Windows Explorer", "Please enter a new directory name", Properties.Resources.Win95Info); } else { - if (File.Exists(setText)) + if (Directory.Exists(setText)) { - wm.StartInfobox95("Windows Explorer", "That file already exists.", Properties.Resources.Win95Info); + wm.StartInfobox95("Windows Explorer", "That directory already exists.", Properties.Resources.Win95Info); } else { - if (File.Exists(OldLabelText)) + if (File.Exists(setText)) { - // It was a file - - File.Copy(Path.Combine(CurrentDirectory, OldLabelText), Path.Combine(CurrentDirectory, setText)); - File.Delete(Path.Combine(CurrentDirectory, OldLabelText)); - + wm.StartInfobox95("Windows Explorer", "That file already exists.", Properties.Resources.Win95Info); } else { - // It was a directory + if (Directory.Exists(mainView.FocusedItem.ImageKey)) + { + // It was a directory + + Directory.Move(mainView.FocusedItem.ImageKey, Path.Combine(CurrentDirectory, setText)); - Directory.CreateDirectory(Path.Combine(CurrentDirectory, setText)); - //File.Copy(Path.Combine(CurrentDirectory, OldLabelText, "*"), Path.Combine(CurrentDirectory, setText)); - Directory.Delete(Path.Combine(CurrentDirectory, OldLabelText)); + File.Delete(Path.Combine(CurrentDirectory, setText, "_data.info")); + + SaveDirectoryInfo(Path.Combine(CurrentDirectory, setText), false, $"{setText}", true); + } + else + { + // It was a file + + File.Copy(mainView.FocusedItem.ImageKey, Path.Combine(CurrentDirectory, setText)); + File.Delete(mainView.FocusedItem.ImageKey); + } } - } + } } + RefreshAll(); + RefreshTreeNode(); + } catch { } - RefreshAll(); + } private TreeNode[] createSubDirNodes(DirectoryInfo folder) @@ -929,5 +940,140 @@ namespace TimeHACK.OS.Win95.Win95Apps } } } + + private void CutCtrlXToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + if (mainView.FocusedItem != null && mainView.FocusedItem.ImageKey != "") + { + + // It is a directory + string oldLocation; + oldLocation = mainView.FocusedItem.ImageKey; + + CurrentCopyFile = Path.Combine(GameDirectory, "Data", Path.GetFileName(mainView.FocusedItem.ImageKey)); + + if (Directory.Exists(CurrentCopyFile)) Directory.Delete(CurrentCopyFile); + if (File.Exists(CurrentCopyFile)) File.Delete(CurrentCopyFile); + + Directory.Move(mainView.FocusedItem.ImageKey, Path.Combine(GameDirectory, "Data", Path.GetDirectoryName(mainView.FocusedItem.ImageKey))); + + + DirectoryCopy(CurrentCopyFile, oldLocation, true); + } + else if (mainView.FocusedItem != null) + { + // It is a file + + CurrentCopyFile = Path.Combine(GameDirectory, "Data", Path.GetFileName(mainView.FocusedItem.Tag.ToString())); + + if (Directory.Exists(CurrentCopyFile)) Directory.Delete(CurrentCopyFile); + if (File.Exists(CurrentCopyFile)) File.Delete(CurrentCopyFile); + + File.Move(mainView.FocusedItem.Tag.ToString(), Path.Combine(GameDirectory, "Data", Path.GetFileName(mainView.FocusedItem.Tag.ToString()))); + + + } + RefreshAll(); + } catch { + } + } + + private void CopyCtrlCToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + if (mainView.FocusedItem != null && mainView.FocusedItem.ImageKey != "") + { + // It is a directory + string oldLocation; + oldLocation = mainView.FocusedItem.ImageKey; + CurrentCopyFile = Path.Combine(GameDirectory, "Data", Path.GetFileName(mainView.FocusedItem.ImageKey)); + + if (Directory.Exists(CurrentCopyFile)) Directory.Delete(CurrentCopyFile); + if (File.Exists(CurrentCopyFile)) File.Delete(CurrentCopyFile); + + DirectoryCopy(CurrentCopyFile, oldLocation, true); + } + else if (mainView.FocusedItem != null) + { + // It is a file + + CurrentCopyFile = Path.Combine(GameDirectory, "Data", Path.GetFileName(mainView.FocusedItem.Tag.ToString())); + + if (Directory.Exists(CurrentCopyFile)) Directory.Delete(CurrentCopyFile); + if (File.Exists(CurrentCopyFile)) File.Delete(CurrentCopyFile); + + File.Copy(mainView.FocusedItem.Tag.ToString(), Path.Combine(GameDirectory, "Data", Path.GetFileName(mainView.FocusedItem.Tag.ToString()))); + + + } + RefreshAll(); + } catch { + } + } + + private void PasteToolStripMenuItem_Click(object sender, EventArgs e) + { + if (Directory.Exists(CurrentCopyFile)) + { + // It is a directory + + DirectoryCopy(CurrentCopyFile, CurrentDirectory, true); + } else if (File.Exists(CurrentCopyFile)) { + // It is a file + + File.Copy(CurrentCopyFile, Path.Combine(CurrentDirectory, Path.GetFileName(CurrentCopyFile))); + } + RefreshAll(); + } + + private static void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs) + { + // Get the subdirectories for the specified directory. + DirectoryInfo dir = new DirectoryInfo(sourceDirName); + + if (dir.Exists) + { + DirectoryInfo[] dirs = dir.GetDirectories(); + // If the destination directory doesn't exist, create it. + if (!Directory.Exists(destDirName)) + { + Directory.CreateDirectory(destDirName); + } + + // Get the files in the directory and copy them to the new location. + FileInfo[] files = dir.GetFiles(); + foreach (FileInfo file in files) + { + string temppath = Path.Combine(destDirName, file.Name); + file.CopyTo(temppath, false); + } + + // If copying subdirectories, copy them and their contents to new location. + if (copySubDirs) + { + foreach (DirectoryInfo subdir in dirs) + { + string temppath = Path.Combine(destDirName, subdir.Name); + DirectoryCopy(subdir.FullName, temppath, copySubDirs); + } + } + } + } + + private void refresh_Tick(object sender, EventArgs e) + { + RefreshAll(); + } + + private void SellectAllCtrlAToolStripMenuItem_Click(object sender, EventArgs e) + { + foreach (ListViewItem item in mainView.Items) + { + item.Selected = true; + } + } } } diff --git a/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.resx b/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.resx index 521f476..d9ff80c 100644 --- a/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.resx +++ b/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.resx @@ -117,6 +117,9 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> + <metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <data name="btnFolderClose.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> @@ -129,4 +132,7 @@ <metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> + <metadata name="refresh.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>132, 17</value> + </metadata> </root>
\ No newline at end of file diff --git a/TimeHACK.Main/Program.cs b/TimeHACK.Main/Program.cs index 86f1a54..cba20d6 100644 --- a/TimeHACK.Main/Program.cs +++ b/TimeHACK.Main/Program.cs @@ -67,9 +67,13 @@ namespace TimeHACK public static string OpenFileExplorerAsDialogAndReturnGivenPath() { - Win95WindowsExplorer we = new Win95WindowsExplorer(); - - WinClassic app = wm.StartWin95(we, "Windows Explorer", Properties.Resources.WinClassicFileExplorer, true, true, true); + if (SaveSystem.CurrentSave.CurrentOS == "95") + { + WinClassic app = wm.StartWin95(new Win95WindowsExplorer(), "Windows Explorer", Properties.Resources.WinClassicFileExplorer, true, true, true); + } else { + WinClassic app = wm.StartWin95(new WinClassicWindowsExplorer(), "Windows Explorer", Properties.Resources.WinClassicFileExplorer, true, true, true); + } + try { return WindowsExplorerReturnPath; |
