aboutsummaryrefslogtreecommitdiff
path: root/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs
diff options
context:
space:
mode:
authorlempamo <[email protected]>2017-06-10 15:23:05 -0400
committerlempamo <[email protected]>2017-06-10 15:23:05 -0400
commit46cca8051d340398bcab1f18d76d1650a746a5b3 (patch)
tree34f2ef3902964b428a9ed9a1ee61f5f1d8b4b4b0 /TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs
parent0344f0f2ba9cc1dea9644c97b69f689e2e516c90 (diff)
parentf7a0abb9c8a8fb4235b185d8bf4ea725d53270fe (diff)
downloadhistacom2-46cca8051d340398bcab1f18d76d1650a746a5b3.tar.gz
histacom2-46cca8051d340398bcab1f18d76d1650a746a5b3.tar.bz2
histacom2-46cca8051d340398bcab1f18d76d1650a746a5b3.zip
Merge remote-tracking branch 'refs/remotes/TimeHACKDevs/master'
Diffstat (limited to 'TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs')
-rw-r--r--TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs159
1 files changed, 123 insertions, 36 deletions
diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs
index 6ad1bb1..2c84133 100644
--- a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs
+++ b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs
@@ -19,8 +19,10 @@ namespace TimeHACK.OS.Win95.Win95Apps
public Boolean IsFileOpenDialog = false;
public Boolean IsFileSaveDialog = false;
public String onlyViewExtension = "";
+
String ToReplaceWith = ProfileDirectory;
String currentDirectory = Path.Combine(ProfileDirectory, "folders");
+ String oldLabelText;
Int32 fileType = 6;
String attemptedDirectory = "";
WindowManager wm = new WindowManager();
@@ -64,11 +66,10 @@ namespace TimeHACK.OS.Win95.Win95Apps
String ReadDataFile(String reqDirectory, Boolean returnYesIfProtected = false) {
String Val = "";
String directoryFileInfo;
- directoryFileInfo = File.ReadAllText(reqDirectory);
+ directoryFileInfo = File.ReadAllText(Path.Combine(reqDirectory, "_data.info"));
FileSystemFolderInfo toRead = new FileSystemFolderInfo();
toRead = JsonConvert.DeserializeObject<FileSystemFolderInfo>(directoryFileInfo);
- MessageBox.Show(toRead.label);
if (returnYesIfProtected == true)
{
if (toRead.Isprotected == true)
@@ -100,10 +101,10 @@ namespace TimeHACK.OS.Win95.Win95Apps
String label = ReadDataFile(str, false);
if (label == "")
{
- this.mainView.Items.Add(Path.GetFileName(str), 1);
+ this.mainView.Items.Add(Path.GetFileName(str));
this.mainView.FindItemWithText(Path.GetFileName(str)).Tag = Path.GetFileName(str);
} else {
- this.mainView.Items.Add(label, 1);
+ this.mainView.Items.Add(label, 1).ImageIndex = 1;
this.mainView.FindItemWithText(label).Tag = Path.GetFileName(str);
}
}
@@ -115,19 +116,19 @@ namespace TimeHACK.OS.Win95.Win95Apps
{
if (new FileInfo(str).Extension == onlyViewExtension)
{
- this.mainView.Items.Add(Path.GetFileName(str), 0);
+ this.mainView.Items.Add(Path.GetFileName(str), 2);
}
}
} else {
if (!(Path.GetFileName(str) == "_data.info")) {
- this.mainView.Items.Add(Path.GetFileName(str));
+ this.mainView.Items.Add(Path.GetFileName(str), 2);
}
}
}
dirLbl.Text = currentDirectory;
CheckLbl();
} catch (Exception ex) {
- wm.startInfobox95("Windows Explorer", "Error with the file explorer \n" + ex.Message, Properties.Resources.Win95Info);
+ wm.startInfobox95("Exploring - C:", "Error with the file explorer \n" + ex.Message, Properties.Resources.Win95Info);
((Form)this.TopLevelControl).Close();
}
}
@@ -428,11 +429,13 @@ namespace TimeHACK.OS.Win95.Win95Apps
// IsFileDialog = False
//End Sub
void WinClassicWindowsExplorer_Load(object sender, EventArgs e) {
- icons.Images.Add(Properties.Resources.WinClassicFolder);
- icons.Images.Add(Properties.Resources.WinClassicComputer);
+
+ //icons.Images.Add(Properties.Resources.WinClassicFolder);
+ //icons.Images.Add(Properties.Resources.WinClassicComputer);
program.BringToFront();
dirLbl.Text = "folders";
diskView.Items.Add("My Computer", 0);
+ Application.DoEvents();
CheckLbl();
RefreshAll();
if (FileDialogBoxManager.IsInOpenDialog)
@@ -447,8 +450,11 @@ namespace TimeHACK.OS.Win95.Win95Apps
pnlSave.Show();
Button1.Text = "Open";
} else {
- pnlSave.Show();
- Button1.Text = "Save";
+ if (IsFileSaveDialog == true)
+ {
+ pnlSave.Show();
+ Button1.Text = "Save";
+ }
}
onlyViewExtension = FileDialogBoxManager.OnlyViewExtension;
@@ -461,23 +467,18 @@ namespace TimeHACK.OS.Win95.Win95Apps
if ((String)mainView.FocusedItem.Tag != "") { // If it isn't a file
GoToDir(currentDirectory + "\\" + mainView.FocusedItem.Tag);
} else { // If it is a file
- if (IsFileOpenDialog == true || IsFileSaveDialog == true) { // If it is a open/save file dialog box
- Program.WindowsExplorerReturnPath = currentDirectory + "\\" + mainView.FocusedItem.Text;
- ((Form)this.TopLevelControl).Close();
+ if (new FileInfo(Path.Combine(currentDirectory, txtSave.Text)).Extension == onlyViewExtension)
+ {
+ Program.WindowsExplorerReturnPath = currentDirectory + "\\" + txtSave.Text;
+ }
- } else {
- ReturnType(new FileInfo(currentDirectory + "\\" + mainView.FocusedItem.Text).Extension);
+ FileDialogBoxManager.IsInOpenDialog = false;
+ FileDialogBoxManager.IsInSaveDialog = false;
- switch (fileType) {
- case 1:
- //ManageTextFile.OpenNewTextFile(currentDirectory + "\\" + mainView.FocusedItem.Text);
- break;
- }
- }
+ ((Form)this.TopLevelControl).Close();
}
-
- } catch (Exception ex) {
+ } catch {
}
}
@@ -489,11 +490,9 @@ namespace TimeHACK.OS.Win95.Win95Apps
if (diskView.FocusedItem.Text == "My Computer") {
GoToDir(ProfileFileSystemDirectory);
-
}
-
- } catch (Exception ex) {
+ } catch {
}
}
@@ -537,24 +536,112 @@ namespace TimeHACK.OS.Win95.Win95Apps
private void Button1_Click(object sender, EventArgs e)
{
- if (txtSave.Text == "")
+ try
{
- wm.startInfobox95("Windows Explorer", "Please enter a filename", Properties.Resources.Win95Info);
+ Boolean OpenFile = false;
+ if (mainView.FocusedItem != null)
+ {
+ if ((String)mainView.FocusedItem.Tag != "")
+ { // If it isn't a file
+ GoToDir(currentDirectory + "\\" + mainView.FocusedItem.Tag);
+ }
+ else OpenFile = true; // If it is a file
+ }
+ else OpenFile = true;
+ if (OpenFile == true)
+ {
+ if (txtSave.Text == "")
+ {
+ wm.startInfobox95("Windows Explorer", "Please enter a filename", Properties.Resources.Win95Info);
+ }
+ else
+ {
+ if (new FileInfo(currentDirectory + "\\" + txtSave.Text).Extension == onlyViewExtension)
+ {
+
+ Program.WindowsExplorerReturnPath = currentDirectory + "\\" + txtSave.Text;
+
+ }
+
+
+ FileDialogBoxManager.IsInOpenDialog = false;
+ FileDialogBoxManager.IsInSaveDialog = false;
+
+ ((Form)this.TopLevelControl).Close();
+ }
+ }
+ } catch {
+
}
- else
+ }
+
+ private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ try
{
- if (new FileInfo(currentDirectory + "\\" + txtSave.Text).Extension == onlyViewExtension)
+ if (!File.Exists(Path.Combine(currentDirectory, mainView.FocusedItem.Text)))
{
+ wm.startInfobox95("Windows Explorer", "This directory doesn't exist", Properties.Resources.Win95Info);
+ }
+ else
+ {
+ Directory.Delete(currentDirectory + mainView.FocusedItem.Text, true);
- Program.WindowsExplorerReturnPath = currentDirectory + "\\" + txtSave.Text;
-
+ RefreshAll();
}
+ } catch
+ {
+
+ }
+
+ }
- FileDialogBoxManager.IsInOpenDialog = false;
- FileDialogBoxManager.IsInSaveDialog = false;
+ private void CloseToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ ((Form)this.TopLevelControl).Close();
+ }
+ private void AboutWindows95ToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ WindowManager wm = new WindowManager();
+ wm.startAboutBox95("Windows 95", "Microsoft Windows 95 Rev B", Properties.Resources.WinClassicAbout95);
+ }
- ((Form)this.TopLevelControl).Close();
+ private void RenameToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ // The AfterLabelEdit event will kick in after this
+ oldLabelText = mainView.FocusedItem.Text;
+ mainView.LabelEdit = true;
+ mainView.FocusedItem.BeginEdit();
+ } catch
+ {
+
+ }
+ }
+
+ 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))
+ {
+ wm.startInfobox95("Windows Explorer", "That directory already exists.", Properties.Resources.Win95Info);
+ }
+ else
+ {
+ Directory.Delete(Path.Combine(currentDirectory, oldLabelText), true);
+ Directory.CreateDirectory(Path.Combine(currentDirectory, setText));
+ }
+ }
+ RefreshAll();
}
}
}