aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex-TIMEHACK <[email protected]>2017-11-04 17:48:05 +0000
committerAlex-TIMEHACK <[email protected]>2017-11-04 17:48:05 +0000
commitcc07981aa3603c74507c9ea0acb6dd0d8418d58e (patch)
tree3a912bad67da226cc0f27e35f8bbd0f568d2f9fe
parent4af08fc6e341a45158e23beb13be10aa1a6a3590 (diff)
downloadhistacom2-cc07981aa3603c74507c9ea0acb6dd0d8418d58e.tar.gz
histacom2-cc07981aa3603c74507c9ea0acb6dd0d8418d58e.tar.bz2
histacom2-cc07981aa3603c74507c9ea0acb6dd0d8418d58e.zip
Address Book can now save data!
-rw-r--r--Histacom2.Engine/FileDialogBoxManager.cs12
-rw-r--r--Histacom2.Engine/UI/ClassicDropDown.cs4
-rw-r--r--Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs21
-rw-r--r--Histacom2/OS/Win98/Win98Apps/AddressBook/FRMWinClassicAddressBookNewContact.cs8
-rw-r--r--Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs2
-rw-r--r--Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs157
-rw-r--r--Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs51
7 files changed, 180 insertions, 75 deletions
diff --git a/Histacom2.Engine/FileDialogBoxManager.cs b/Histacom2.Engine/FileDialogBoxManager.cs
index 9f0b2ce..d4d025c 100644
--- a/Histacom2.Engine/FileDialogBoxManager.cs
+++ b/Histacom2.Engine/FileDialogBoxManager.cs
@@ -12,27 +12,27 @@ namespace Histacom2.Engine
{
public static bool IsInOpenDialog = false;
public static bool IsInSaveDialog = false;
- public static string OnlyViewExtension = "";
+ public static List<string> OnlyViewExtension = new List<string>();
- public static void ActivateOpenFileDialog(string ExtensionToView)
+ public static void ActivateOpenFileDialog(params string[] ExtensionToView)
{
IsInOpenDialog = true;
IsInSaveDialog = false;
- OnlyViewExtension = ExtensionToView;
+ OnlyViewExtension = ExtensionToView.ToList();
}
- public static void ActivateSaveFileDialog(string ExtensionToView)
+ public static void ActivateSaveFileDialog(params string[] ExtensionToView)
{
IsInOpenDialog = false;
IsInSaveDialog = true;
- OnlyViewExtension = ExtensionToView;
+ OnlyViewExtension = ExtensionToView.ToList();
}
public static void DeactivateFileDialog()
{
IsInOpenDialog = false;
IsInSaveDialog = false;
- OnlyViewExtension = "";
+ OnlyViewExtension = new List<string>();
}
public static string ReadTextFile(string path)
diff --git a/Histacom2.Engine/UI/ClassicDropDown.cs b/Histacom2.Engine/UI/ClassicDropDown.cs
index 93b4a62..edf2268 100644
--- a/Histacom2.Engine/UI/ClassicDropDown.cs
+++ b/Histacom2.Engine/UI/ClassicDropDown.cs
@@ -34,7 +34,7 @@ namespace Histacom2.Engine.UI
public static Color _lightBack = Color.Silver;
public static Color _darkBack = Color.Silver;
- public List<string> items = new List<string> { "TestItem" };
+ public List<string> Items { get; set; } = new List<string>();
public ClassicDropDown()
{
@@ -117,7 +117,7 @@ namespace Histacom2.Engine.UI
} else {
thisOverlay = new DropDownOverlay();
int applyHeight = 0;
- foreach (string str in items)
+ foreach (string str in Items)
{
DropDownItem itm = new DropDownItem();
itm.ChangeText(str, Font);
diff --git a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs
index 4efdd6f..1ac4512 100644
--- a/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs
+++ b/Histacom2/OS/Win95/Win95Apps/Win95WindowsExplorer.cs
@@ -22,14 +22,12 @@ namespace Histacom2.OS.Win95.Win95Apps
{
public bool IsFileOpenDialog = false;
public bool IsFileSaveDialog = false;
- public string onlyViewExtension = "";
+ public List<string> onlyViewExtension = new List<string>();
string ToReplaceWith = ProfileDirectory;
public string CurrentDirectory = ProfileMyComputerDirectory;
string OldLabelText;
string CurrentCopyFile;
-
- int fileType = 6;
//string attemptedDirectory = "";
WindowManager wm = new WindowManager();
@@ -89,7 +87,8 @@ namespace Histacom2.OS.Win95.Win95Apps
Properties.Resources.TimeDistorter1,
Properties.Resources.WinClassicGTN,
Properties.Resources.WinClassicFTP,
- Properties.Resources.WinClassicRtfFile}); //20
+ Properties.Resources.WinClassicRtfFile, // 20
+ Properties.Resources.WinClassicAddressBook});
program.BringToFront();
@@ -124,6 +123,9 @@ namespace Histacom2.OS.Win95.Win95Apps
}
onlyViewExtension = FileDialogBoxManager.OnlyViewExtension;
+
+ foreach (string str in onlyViewExtension)
+ cmbType.Items.Add(str);
}
string ReadDataFile(string reqDirectory, bool returnYesIfProtected = false) {
@@ -162,7 +164,7 @@ namespace Histacom2.OS.Win95.Win95Apps
{
if (!(Path.GetFileName(str) == "_data.info"))
{
- if (new FileInfo(str).Extension == onlyViewExtension)
+ if (onlyViewExtension.Contains(new FileInfo(str).Extension))
{
itm = this.mainView.Items.Add(Path.GetFileName(str));
itm.Tag = str;
@@ -232,8 +234,7 @@ namespace Histacom2.OS.Win95.Win95Apps
{
try
{
- ReturnType(new FileInfo(fileDir).Extension);
- switch (fileType)
+ switch (ReturnType(new FileInfo(fileDir).Extension))
{
case 1:
WinClassicNotepad np = new WinClassicNotepad();
@@ -501,7 +502,7 @@ namespace Histacom2.OS.Win95.Win95Apps
{ // If it is a file
if (IsFileOpenDialog || IsFileSaveDialog)
{
- if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension)
+ if (onlyViewExtension.Contains(new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension))
{
Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text);
}
@@ -513,9 +514,7 @@ namespace Histacom2.OS.Win95.Win95Apps
((Form)this.TopLevelControl).Close();
}
else
- {
OpenFile(mainView.FocusedItem.Tag.ToString());
- }
}
} catch { /* TODO: Illegal operation */ }
}
@@ -595,7 +594,7 @@ namespace Histacom2.OS.Win95.Win95Apps
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 (onlyViewExtension.Contains(new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension)) Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text);
FileDialogBoxManager.IsInOpenDialog = false;
FileDialogBoxManager.IsInSaveDialog = false;
diff --git a/Histacom2/OS/Win98/Win98Apps/AddressBook/FRMWinClassicAddressBookNewContact.cs b/Histacom2/OS/Win98/Win98Apps/AddressBook/FRMWinClassicAddressBookNewContact.cs
index 9facd7b..45384fa 100644
--- a/Histacom2/OS/Win98/Win98Apps/AddressBook/FRMWinClassicAddressBookNewContact.cs
+++ b/Histacom2/OS/Win98/Win98Apps/AddressBook/FRMWinClassicAddressBookNewContact.cs
@@ -7,12 +7,13 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
-
+using Histacom2.Engine;
namespace Histacom2.OS.Win95.Win95Apps
{
public partial class FRMWinClassicAddressBookNewContact : UserControl
{
+ WindowManager wm = new WindowManager();
public AddressBookContact toSet = new AddressBookContact();
public FRMWinClassicAddressBookNewContact()
{
@@ -37,7 +38,7 @@ namespace Histacom2.OS.Win95.Win95Apps
Program.AddressBookSelectedContact = toSet;
((Form)this.TopLevelControl).Close();
} else {
- MessageBox.Show("Please fill out the First, Middle and Last name.");
+ wm.StartInfobox95("Address Book", "Please fill out the First, Middle and Last name.", Engine.Template.InfoboxType.Info, Engine.Template.InfoboxButtons.OK);
}
}
@@ -62,9 +63,6 @@ namespace Histacom2.OS.Win95.Win95Apps
emails.Items.Add(email);
}
}
- } else
- {
- MessageBox.Show("NULL CONTACT!");
}
}
}
diff --git a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs
index 09030fb..5452184 100644
--- a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs
+++ b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.Designer.cs
@@ -145,12 +145,14 @@
this.importToolStripMenuItem.Name = "importToolStripMenuItem";
this.importToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.importToolStripMenuItem.Text = "Import...";
+ this.importToolStripMenuItem.Click += new System.EventHandler(this.importToolStripMenuItem_Click);
//
// exportToolStripMenuItem
//
this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
this.exportToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.exportToolStripMenuItem.Text = "Export...";
+ this.exportToolStripMenuItem.Click += new System.EventHandler(this.exportToolStripMenuItem_Click);
//
// toolStripSeparator3
//
diff --git a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs
index e4d6c7b..bf4f648 100644
--- a/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs
+++ b/Histacom2/OS/Win98/Win98Apps/AddressBook/WinClassicAddressBook.cs
@@ -9,6 +9,9 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using Histacom2.Engine;
using Histacom2.Engine.Template;
+using System.IO;
+using static Histacom2.Engine.SaveSystem;
+using static Histacom2.Engine.FileDialogBoxManager;
namespace Histacom2.OS.Win95.Win95Apps
{
@@ -42,14 +45,30 @@ namespace Histacom2.OS.Win95.Win95Apps
{
new AddressBookContactList()
{
- AttachedNode = treeView1.Nodes[0].Text
+ NodePath = treeView1.Nodes[0].Text
}
};
+
+ if (File.Exists(Path.Combine(ProfileWindowsDirectory, "Application Data", "Microsoft", "Address Book", $"{ProfileName}.wab")))
+ LoadData();
+ else
+ SaveData();
+
+
}
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
- UpdateContactListFromNodeName(treeView1.SelectedNode.Text);
+ previousParent = treeView1.SelectedNode.Parent;
+ UpdateContactListFromNodeName(treeView1.SelectedNode);
+
+ // Remove the focus from contactsView
+
+ if (contactsView.SelectedItems.Count != 0)
+ contactsView.SelectedItems[0].Selected = false;
+
+ if (contactsView.FocusedItem != null)
+ contactsView.FocusedItem.Focused = false;
}
//AddressBookContactList GetAddressBookContactListFromNode(string NodeText)
@@ -71,14 +90,15 @@ namespace Histacom2.OS.Win95.Win95Apps
// return toReturn;
//}
- public void UpdateContactListFromNodeName(string NodeName)
+ public void UpdateContactListFromNodeName(TreeNode Node)
{
+ previousParent = Node.Parent;
contactsView.Items.Clear();
try
{
foreach (AddressBookContactList ContactList in AddressBookObjects)
{
- if (ContactList.AttachedNode == NodeName)
+ if (ContactList.NodePath == FindNodePath(Node))
{
foreach (AddressBookContact contact in ContactList.Contacts)
{
@@ -97,15 +117,29 @@ namespace Histacom2.OS.Win95.Win95Apps
{
if (OldTreeNode != null)
{
- OldTreeNode.Nodes.Add(NewNodeName);
+ TreeNode nde = OldTreeNode.Nodes.Add(NewNodeName);
AddressBookObjects.Add(new AddressBookContactList
{
- AttachedNode = NewNodeName,
+ NodePath = FindNodePath(nde)
});
}
}
+ TreeNode previousParent;
+ public string FindNodePath(TreeNode nde)
+ {
+ if (nde != null)
+ {
+ string ret = nde.Text;
+ previousParent = nde.Parent;
+ while (previousParent != null)
+ ret = $"{FindNodePath(nde.Parent)}\\{ret}";
+ return ret;
+ }
+ else return "";
+ }
+
private void newFolderToolStripMenuItem_Click(object sender, EventArgs e)
{
NewFolder();
@@ -145,7 +179,7 @@ namespace Histacom2.OS.Win95.Win95Apps
{
foreach (AddressBookContactList ContactList in AddressBookObjects)
{
- if (ContactList.AttachedNode == treeView1.SelectedNode.Text)
+ if (ContactList.NodePath == FindNodePath(treeView1.SelectedNode))
{
ContactList.Contacts.Add(Program.AddressBookSelectedContact);
contactsView.Items.Add(Program.AddressBookSelectedContact.FirstName + " " + Program.AddressBookSelectedContact.MiddleName + " " + Program.AddressBookSelectedContact.LastName);
@@ -169,7 +203,7 @@ namespace Histacom2.OS.Win95.Win95Apps
{
foreach (AddressBookContactList ContactList in AddressBookObjects)
{
- if (ContactList.AttachedNode == treeView1.SelectedNode.Text)
+ if (ContactList.NodePath == FindNodePath(treeView1.SelectedNode))
{
foreach (AddressBookContact Contact in ContactList.Contacts)
{
@@ -195,7 +229,7 @@ namespace Histacom2.OS.Win95.Win95Apps
{
foreach (AddressBookContactList ContactList in AddressBookObjects)
{
- if (ContactList.AttachedNode == treeView1.SelectedNode.Text)
+ if (ContactList.NodePath == FindNodePath(treeView1.SelectedNode))
{
foreach (AddressBookContact Contact in ContactList.Contacts)
{
@@ -228,31 +262,31 @@ namespace Histacom2.OS.Win95.Win95Apps
{
try
{
- if (treeView1.SelectedNode != null)
+ foreach (AddressBookContactList ContactList in AddressBookObjects)
{
- foreach (AddressBookContactList ContactList in AddressBookObjects)
+ if (ContactList.NodePath == FindNodePath(treeView1.SelectedNode))
{
- if (ContactList.AttachedNode == treeView1.SelectedNode.Text)
+ foreach (AddressBookContact Contact in ContactList.Contacts)
{
- foreach (AddressBookContact Contact in ContactList.Contacts)
- {
- if (contactsView.FocusedItem == null)
- { // Most likely they are trying to delete a whole folder!
- if (treeView1.SelectedNode.Text != "Shared Contacts")
- if (treeView1.SelectedNode != null)
- {
- AddressBookObjects.Remove(ContactList);
- treeView1.Nodes.Remove(treeView1.SelectedNode);
- UpdateContactListFromNodeName("Shared Contacts");
- }
- }
- else
- {
- if ((Contact.FirstName + " " + Contact.MiddleName + " " + Contact.LastName) == contactsView.FocusedItem.Text)
+ if (contactsView.FocusedItem == null)
+ { // Most likely they are trying to delete a whole folder!
+ if (treeView1.SelectedNode.Text != "Shared Contacts")
+ if (treeView1.SelectedNode != null)
{
- ContactList.Contacts.Remove(Contact);
+ AddressBookObjects.Remove(ContactList);
+ treeView1.Nodes.Remove(treeView1.SelectedNode);
+ previousParent = null;
+ UpdateContactListFromNodeName(treeView1.Nodes[0]);
}
- }
+ }
+ else
+ {
+ if ((Contact.FirstName + " " + Contact.MiddleName + " " + Contact.LastName) == contactsView.FocusedItem.Text)
+ {
+ ContactList.Contacts.Remove(Contact);
+ previousParent = treeView1.SelectedNode.Parent;
+ UpdateContactListFromNodeName(treeView1.SelectedNode);
+ }
}
}
}
@@ -310,14 +344,75 @@ namespace Histacom2.OS.Win95.Win95Apps
public void SaveData()
{
-
+ string toSave = Newtonsoft.Json.JsonConvert.SerializeObject(AddressBookObjects, Newtonsoft.Json.Formatting.Indented);
+ CreateWindowsFile(Path.Combine(ProfileWindowsDirectory, "Application Data", "Microsoft", "Address Book"), $"{ProfileName}.wab", toSave, 21, toSave.Length);
}
public void SaveDataAs()
{
+ try
+ {
+ string toSave = Newtonsoft.Json.JsonConvert.SerializeObject(AddressBookObjects, Newtonsoft.Json.Formatting.Indented);
+
+ ActivateSaveFileDialog(".wab");
+ string selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath();
+ DeactivateFileDialog();
+
+ if (selectedPath != "")
+ CreateWindowsFile(new FileInfo(selectedPath).Directory.FullName, selectedPath.Split('\\').Last(), toSave, 21, toSave.Length);
+ } catch { }
+ }
+
+ public void LoadData()
+ {
+ AddressBookObjects = Newtonsoft.Json.JsonConvert.DeserializeObject<List<AddressBookContactList>>(File.ReadAllText(Path.Combine(ProfileWindowsDirectory, "Application Data", "Microsoft", "Address Book", $"{ProfileName}.wab")));
+
+ foreach (AddressBookContactList lst in AddressBookObjects)
+ UpdateTreeView(lst);
+ }
+
+ public void LoadDataAs()
+ {
+ ActivateOpenFileDialog(".wab");
+ string selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath();
+ DeactivateFileDialog();
+
+ if (selectedPath != "")
+ AddressBookObjects = Newtonsoft.Json.JsonConvert.DeserializeObject<List<AddressBookContactList>>(File.ReadAllText(selectedPath));
+ foreach (AddressBookContactList lst in AddressBookObjects)
+ UpdateTreeView(lst);
}
+ TreeNode UpdatePrevParent;
+ public void UpdateTreeView(AddressBookContactList lst, int count = 0)
+ {
+ try
+ {
+ string[] parts = lst.NodePath.Split('\\');
+ if (count == 0) UpdatePrevParent = treeView1.Nodes[0];
+ if (lst.NodePath != FindNodePath(treeView1.Nodes[0]))
+ {
+ if (UpdatePrevParent.Nodes.ContainsKey(parts[count + 1]))
+ UpdatePrevParent.Nodes.RemoveByKey(parts[count + 1]);
+
+ TreeNode newNde = UpdatePrevParent.Nodes.Add(parts[count + 1], parts[count + 1]);
+ UpdatePrevParent = newNde;
+ if (count != parts.Length - 2) UpdateTreeView(lst, ++count);
+ }
+
+ } catch { }
+ }
+
+ private void importToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ LoadDataAs();
+ }
+
+ private void exportToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ SaveDataAs();
+ }
}
public class AddressBookContact
@@ -330,7 +425,7 @@ namespace Histacom2.OS.Win95.Win95Apps
public class AddressBookContactList
{
- public string AttachedNode;
+ public string NodePath;
public List<AddressBookContact> Contacts = new List<AddressBookContact>();
}
}
diff --git a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs
index c7369b4..947f9ba 100644
--- a/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs
+++ b/Histacom2/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs
@@ -22,13 +22,12 @@ namespace Histacom2.OS.Win95.Win95Apps
{
public bool IsFileOpenDialog = false;
public bool IsFileSaveDialog = false;
- public string onlyViewExtension = "";
+ public List<string> onlyViewExtension = new List<string>();
string ToReplaceWith = ProfileDirectory;
public string CurrentDirectory = ProfileMyComputerDirectory;
string OldLabelText;
string CurrentCopyFile;
- int fileType = 6;
//string attemptedDirectory = "";
WindowManager wm = new WindowManager();
@@ -82,7 +81,8 @@ namespace Histacom2.OS.Win95.Win95Apps
Properties.Resources.TimeDistorter1,
Properties.Resources.WinClassicGTN,
Properties.Resources.WinClassicFTP,
- Properties.Resources.WinClassicRtfFile}); //20
+ Properties.Resources.WinClassicRtfFile, // 20
+ Properties.Resources.WinClassicAddressBook});
program.BringToFront();
@@ -117,6 +117,11 @@ namespace Histacom2.OS.Win95.Win95Apps
}
onlyViewExtension = FileDialogBoxManager.OnlyViewExtension;
+
+ foreach (string str in onlyViewExtension)
+ cmbType.Items.Add(str);
+
+ cmbType.Text = onlyViewExtension.FirstOrDefault();
}
//'Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs)
@@ -157,6 +162,19 @@ namespace Histacom2.OS.Win95.Win95Apps
//try {
this.mainView.Items.Clear();
+ if (CurrentDirectory == ProfileFileSystemDirectory)
+ {
+ txtInfoTitle.Text = "My Computer";
+ pictureBox1.Image = Properties.Resources.Win95ComputerIcon;
+ } else if (CurrentDirectory == ProfileMyComputerDirectory) {
+ txtInfoTitle.Text = "C:";
+ pictureBox1.Image = Properties.Resources.WinClassicFolderSmall; // TODO: ADD DRIVE ICON
+ } else {
+ txtInfoTitle.Text = Path.GetFileName(CurrentDirectory);
+ pictureBox1.Image = Properties.Resources.WinClassicFolderSmall;
+ }
+
+
foreach (string str in Directory.GetDirectories(CurrentDirectory))
{
string label = ReadDataFile(str, false);
@@ -172,14 +190,14 @@ namespace Histacom2.OS.Win95.Win95Apps
{
if (!(Path.GetFileName(str) == "_data.info"))
{
- if (new FileInfo(str).Extension == onlyViewExtension)
+ if (onlyViewExtension.Contains(new FileInfo(str).Extension))
{
itm = this.mainView.Items.Add(Path.GetFileName(str));
itm.Tag = str;
}
- else break;
+ else continue;
}
- else break;
+ else continue;
}
else
{
@@ -188,7 +206,7 @@ namespace Histacom2.OS.Win95.Win95Apps
itm = this.mainView.Items.Add(Path.GetFileName(str));
itm.Tag = str;
}
- else break;
+ else continue;
}
FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info")));
foreach (var item in fsfi.Files)
@@ -244,8 +262,7 @@ namespace Histacom2.OS.Win95.Win95Apps
{
try
{
- ReturnType(new FileInfo(fileDir).Extension);
- switch (fileType)
+ switch (ReturnType(new FileInfo(fileDir).Extension))
{
case 1:
WinClassicNotepad np = new WinClassicNotepad();
@@ -452,7 +469,7 @@ namespace Histacom2.OS.Win95.Win95Apps
{ // If it is a file
if (IsFileOpenDialog || IsFileSaveDialog)
{
- if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension)
+ if (onlyViewExtension.Contains(new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension))
{
Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text);
}
@@ -464,9 +481,7 @@ namespace Histacom2.OS.Win95.Win95Apps
((Form)this.TopLevelControl).Close();
}
else
- {
OpenFile(mainView.FocusedItem.Tag.ToString());
- }
}
} catch { /* TODO: Illegal operation */ }
}
@@ -477,7 +492,7 @@ namespace Histacom2.OS.Win95.Win95Apps
{
if (diskView.SelectedNode != null)
{
- if (diskView.SelectedNode.Text == "My Computer")
+ if (diskView.SelectedNode.Text == "My Computer" || diskView.SelectedNode.Text == "Desktop")
{
GoToDir(ProfileFileSystemDirectory);
}
@@ -491,11 +506,7 @@ namespace Histacom2.OS.Win95.Win95Apps
{
// It is a directory:
- try
- {
- GoToDir(diskView.SelectedNode.Tag.ToString());
- }
- catch { }
+ GoToDir(diskView.SelectedNode.Tag.ToString());
}
}
}
@@ -540,7 +551,7 @@ namespace Histacom2.OS.Win95.Win95Apps
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 (onlyViewExtension.Contains(new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension)) Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text);
FileDialogBoxManager.IsInOpenDialog = false;
FileDialogBoxManager.IsInSaveDialog = false;
@@ -980,7 +991,7 @@ namespace Histacom2.OS.Win95.Win95Apps
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 (onlyViewExtension.Contains(new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension)) Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text);
FileDialogBoxManager.IsInOpenDialog = false;
FileDialogBoxManager.IsInSaveDialog = false;