diff options
Diffstat (limited to 'TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs')
| -rw-r--r-- | TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs | 138 |
1 files changed, 72 insertions, 66 deletions
diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs index 89a6b6f..e4f98ff 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicWindowsExplorer.cs @@ -16,15 +16,15 @@ namespace TimeHACK.OS.Win95.Win95Apps { public partial class WinClassicWindowsExplorer : UserControl { - 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 = ""; + public bool IsFileOpenDialog = false; + public bool IsFileSaveDialog = false; + public string onlyViewExtension = ""; + + string ToReplaceWith = ProfileDirectory; + string currentDirectory = Path.Combine(ProfileDirectory, "folders/computer"); + string oldLabelText; + int fileType = 6; + string attemptedDirectory = ""; WindowManager wm = new WindowManager(); public WinClassicWindowsExplorer() @@ -32,9 +32,6 @@ namespace TimeHACK.OS.Win95.Win95Apps InitializeComponent(); } - - - //'Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) //' mainView.Items.Clear() //' Dim childamount As TreeNodeCollection @@ -48,21 +45,6 @@ namespace TimeHACK.OS.Win95.Win95Apps //' Next //'End Sub - void CheckLbl() { - try - { - dirLbl.Text = dirLbl.Text.Replace(GameDirectory, ""); - dirLbl.Text = dirLbl.Text.Replace("\\TimeHACK\\", ""); - dirLbl.Text = dirLbl.Text.Replace(ProfileDirectory, ""); - dirLbl.Text = dirLbl.Text.Replace("\\Profiles\\" + ProfileName + "\\", ""); - dirLbl.Text = dirLbl.Text.Replace("folders", "My Computer"); - //dirLbl.Text = dirLbl.Text.Substring(7, dirLbl.Text.Length - 7); - } catch - { - - } - } - String ReadDataFile(String reqDirectory, Boolean returnYesIfProtected = false) { String Val = ""; String directoryFileInfo; @@ -87,10 +69,7 @@ namespace TimeHACK.OS.Win95.Win95Apps void RefreshAll() { try { // Refresh the right listview - icons.Images.Clear(); this.mainView.Items.Clear(); - diskView.SmallImageList = icons; - this.mainView.LargeImageList = icons; // 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) @@ -148,16 +127,14 @@ namespace TimeHACK.OS.Win95.Win95Apps } } } - dirLbl.Text = currentDirectory; - CheckLbl(); } catch (Exception ex) { wm.StartInfobox95("Exploring - C:", "Error with the file explorer \n" + ex.Message, Properties.Resources.Win95Info); ((Form)this.TopLevelControl).Close(); } } - String ReturnType(String extension) { - String returnVal = ""; + string ReturnType(string extension) { + string returnVal = ""; fileType = 1; switch (extension) { case ".txt": @@ -452,14 +429,42 @@ 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); + diskView.ImageList.Images.Add(Properties.Resources.Win95DesktopIcon); + diskView.ImageList.Images.Add(Properties.Resources.Win95HardDiskIcon); + diskView.ImageList.Images.Add(Properties.Resources.WinClassicFolderSmall); + diskView.ImageList.Images.Add(Properties.Resources.WinClassicOpenFolderSmall); + diskView.ImageList.Images.Add(Properties.Resources.Win95ControlPanelIcon); + diskView.ImageList.Images.Add(Properties.Resources.Win95PrintersFolder); + diskView.ImageList.Images.Add(Properties.Resources.Win95ComputerIcon); + diskView.ImageList.Images.Add(Properties.Resources.Win95NetworkIcon); + diskView.ImageList.Images.Add(Properties.Resources.Win95RecycleIcon); program.BringToFront(); - dirLbl.Text = "folders"; - diskView.Items.Add("My Computer", 0); + 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) + { + TreeNode[] tn = createSubDirNodes(folder); + folders[loc] = new TreeNode(folder.Name, 2, 3, tn); + } + else + { + folders[loc] = new TreeNode(folder.Name, 2, 3); + } + 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(); - CheckLbl(); RefreshAll(); if (FileDialogBoxManager.IsInOpenDialog) { @@ -506,12 +511,11 @@ namespace TimeHACK.OS.Win95.Win95Apps } } - void diskView_DoubleClick(object sender, EventArgs e) + void diskView_AfterSelect(object sender, EventArgs e) { try { - if (diskView.FocusedItem.Text == "My Computer") { - + if (diskView.SelectedNode.Text == "My Computer") { GoToDir(ProfileFileSystemDirectory); } @@ -519,30 +523,12 @@ namespace TimeHACK.OS.Win95.Win95Apps } } - void btnGo_Click(object sender, EventArgs e) + void GoToDir(string dir) { - GoToDir(ProfileDirectory + "\\" + dirLbl.Text.Replace("My Computer", "folders")); - } - - void GoToDir(String dir, Boolean GoneThoughHidden = false) - { - if (ReadDataFile(dir, true) == "yes" && (GoneThoughHidden == false)) { - attemptedDirectory = dir; - mainView.Hide(); - pnlHidden.BringToFront(); - pnlHidden.Show(); - } else { - pnlHidden.Hide(); - mainView.Show(); - mainView.BringToFront(); - currentDirectory = dir; - RefreshAll(); - } - } - - private void LinkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - GoToDir(attemptedDirectory, true); + mainView.Show(); + mainView.BringToFront(); + currentDirectory = dir; + RefreshAll(); } private void FolderToolStripMenuItem_Click(object sender, EventArgs e) @@ -666,5 +652,25 @@ namespace TimeHACK.OS.Win95.Win95Apps } RefreshAll(); } + + private TreeNode[] createSubDirNodes(DirectoryInfo folder) + { + TreeNode[] toReturn = new TreeNode[folder.GetDirectories().Length]; + int loc = 0; + foreach (DirectoryInfo fold in folder.GetDirectories()) + { + if (fold.GetDirectories().Length > 0) + { + TreeNode[] tn = createSubDirNodes(fold); + toReturn[loc] = new TreeNode(fold.Name, 2, 3, tn); + } + else + { + toReturn[loc] = new TreeNode(fold.Name, 2, 3); + } + loc++; + } + return toReturn; + } } } |
