aboutsummaryrefslogtreecommitdiff
path: root/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs
diff options
context:
space:
mode:
authorAlex-TIMEHACK <[email protected]>2017-07-08 16:03:59 +0100
committerAlex-TIMEHACK <[email protected]>2017-07-08 16:03:59 +0100
commitf095f4efd9e2dd217045f65b7b33594b16fb0125 (patch)
treece0871d09e075a7ac4a081a6ba88fba2532c3864 /TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs
parent35f7ca92da983723ccdb2aeadc9917ea1370a19b (diff)
downloadhistacom2-f095f4efd9e2dd217045f65b7b33594b16fb0125.tar.gz
histacom2-f095f4efd9e2dd217045f65b7b33594b16fb0125.tar.bz2
histacom2-f095f4efd9e2dd217045f65b7b33594b16fb0125.zip
Made the Windows Explorer open non exe files PART 1
Diffstat (limited to 'TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs')
-rw-r--r--TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs70
1 files changed, 61 insertions, 9 deletions
diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs
index e4f98ff..ad44cbd 100644
--- a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs
+++ b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs
@@ -11,6 +11,7 @@ using static TimeHACK.Engine.SaveSystem;
using System.IO;
using TimeHACK.Engine;
using Newtonsoft.Json;
+using TimeHACK.Engine.Template;
namespace TimeHACK.OS.Win95.Win95Apps
{
@@ -133,6 +134,46 @@ namespace TimeHACK.OS.Win95.Win95Apps
}
}
+ void OpenFile(String filedir)
+ {
+ try
+ {
+ ReturnType(new FileInfo(filedir).Extension);
+ switch (fileType)
+ {
+ case 1:
+ WinClassicNotepad np = new WinClassicNotepad();
+ np.mainText.Text = FileDialogBoxManager.ReadTextFile(filedir);
+ WinClassic app = wm.StartWin95(new WinClassicNotepad(), "Notepad", Properties.Resources.Win95IconNotepad, true, true);
+
+ Program.AddTaskbarItem(app, app.Tag.ToString(), "Notepad", Properties.Resources.Win95IconNotepad);
+
+ break;
+ case 12:
+ OpenApplication(FileDialogBoxManager.ReadTextFile(filedir));
+ break;
+ }
+ } catch {
+
+ }
+
+ }
+
+ void OpenApplication(String appname)
+ {
+ switch (appname.ToLower())
+ {
+ case "windowsexplorer":
+ WinClassicWindowsExplorer we = new WinClassicWindowsExplorer();
+ Engine.Template.WinClassic app = wm.StartWin95(we, "Windows Explorer", Properties.Resources.Win95Computer, true, true);
+ Program.AddTaskbarItem(app, app.Tag.ToString(), "Windows Explorer", Properties.Resources.Win95Computer);
+
+ break;
+ case "calculator":
+ throw new NotImplementedException();
+ }
+ }
+
string ReturnType(string extension) {
string returnVal = "";
fileType = 1;
@@ -492,20 +533,31 @@ namespace TimeHACK.OS.Win95.Win95Apps
{
try
{
- if ((String)mainView.FocusedItem.Tag != "") { // If it isn't a file
- GoToDir(currentDirectory + "\\" + mainView.FocusedItem.Tag);
- } else { // If it is a file
- if (new FileInfo(Path.Combine(currentDirectory, txtSave.Text)).Extension == onlyViewExtension)
- {
- Program.WindowsExplorerReturnPath = currentDirectory + "\\" + txtSave.Text;
+ if (IsFileOpenDialog == true || IsFileSaveDialog == true)
+ {
+ if ((String)mainView.FocusedItem.Tag != "")
+ { // If it isn't a file
+ GoToDir(currentDirectory + "\\" + mainView.FocusedItem.Tag);
}
+ else
+ { // If it is a file
+ if (new FileInfo(Path.Combine(currentDirectory, txtSave.Text)).Extension == onlyViewExtension)
+ {
+ Program.WindowsExplorerReturnPath = currentDirectory + "\\" + txtSave.Text;
+ }
- FileDialogBoxManager.IsInOpenDialog = false;
- FileDialogBoxManager.IsInSaveDialog = false;
+ FileDialogBoxManager.IsInOpenDialog = false;
+ FileDialogBoxManager.IsInSaveDialog = false;
+
+ ((Form)this.TopLevelControl).Close();
+ }
+ } else {
+ // Open it if it's a recognized file
- ((Form)this.TopLevelControl).Close();
+
}
+
} catch {
}