diff options
| author | Alex-TIMEHACK <[email protected]> | 2017-08-18 14:56:56 +0100 |
|---|---|---|
| committer | Alex-TIMEHACK <[email protected]> | 2017-08-18 14:56:56 +0100 |
| commit | 414133b35d39b84537f4375e27e3e5f206655c5a (patch) | |
| tree | a7faf10e39c8fa34cad39a7b1261d793ba4bbee9 /TimeHACK.Main/OS/Win98/Win98Apps | |
| parent | 3399ab978ca11faee44803d2b7c5f0f06855504a (diff) | |
| download | histacom2-414133b35d39b84537f4375e27e3e5f206655c5a.tar.gz histacom2-414133b35d39b84537f4375e27e3e5f206655c5a.tar.bz2 histacom2-414133b35d39b84537f4375e27e3e5f206655c5a.zip | |
Quite Big revamp on Explorer Part 1
Diffstat (limited to 'TimeHACK.Main/OS/Win98/Win98Apps')
| -rw-r--r-- | TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs | 141 |
1 files changed, 60 insertions, 81 deletions
diff --git a/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs b/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs index f21a851..c148974 100644 --- a/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs +++ b/TimeHACK.Main/OS/Win98/Win98Apps/WinClassicWindowsExplorer.cs @@ -12,6 +12,7 @@ using System.IO; using TimeHACK.Engine; using Newtonsoft.Json; using TimeHACK.Engine.Template; +using System.Diagnostics; namespace TimeHACK.OS.Win95.Win95Apps { @@ -123,81 +124,54 @@ namespace TimeHACK.OS.Win95.Win95Apps } void RefreshAll() { - try { - - this.mainView.Items.Clear(); - - // Update the WebView - - if (CurrentDirectory == SaveSystem.ProfileMyComputerDirectory) - { - pictureBox1.Image = Properties.Resources.Win95HardDiskIcon; - } else if (CurrentDirectory == SaveSystem.ProfileFileSystemDirectory) { - pictureBox1.Image = Properties.Resources.Win95Computer; - } else { - pictureBox1.Image = Properties.Resources.WinClassicFolder; - } - - txtInfoTip.Show(); - InfoDesc.Hide(); + //try { + this.mainView.Items.Clear(); - string weblabel = ReadDataFile(CurrentDirectory, false); + foreach (string str in Directory.GetDirectories(CurrentDirectory)) + { + string label = ReadDataFile(str, false); + ListViewItem itm = this.mainView.Items.Add(label ?? Path.GetFileName(str)); + itm.ImageIndex = 1; + itm.Tag = str; + } + foreach (string str in Directory.GetFiles(CurrentDirectory)) + { + ListViewItem itm; - txtInfoTitle.Text = weblabel ?? new FileInfo(CurrentDirectory).Name; - foreach (string str in Directory.GetDirectories(CurrentDirectory)) - { - string label = ReadDataFile(str, false); - ListViewItem itm = this.mainView.Items.Add(label ?? Path.GetFileName(str)); - itm.ImageKey = str; - } - foreach (string str in Directory.GetFiles(CurrentDirectory)) + if (IsFileOpenDialog == true || IsFileSaveDialog == true) { - // Get the app Icon - - //int AppIcon = 2; - - //switch (new FileInfo(str).Extension) - //{ - // case ".exe": - // string contents; - - // contents = File.ReadAllText(str); - - // switch (contents.ToLower()) - // { - // case "calc": - // AppIcon = 3; - // break; - // case "explorer": - // AppIcon = 4; - // break; - // } - // break; - //} - - - - if (IsFileOpenDialog == true || IsFileSaveDialog == true) + if (!(Path.GetFileName(str) == "_data.info")) { - if (!(Path.GetFileName(str) == "_data.info")) + if (new FileInfo(str).Extension == onlyViewExtension) { - if (new FileInfo(str).Extension == onlyViewExtension) - { - ListViewItem itm = this.mainView.Items.Add(Path.GetFileName(str)); - itm.Tag = str; - } - } - } else { - if (!(Path.GetFileName(str) == "_data.info")) { - ListViewItem itm = this.mainView.Items.Add(Path.GetFileName(str)); + itm = this.mainView.Items.Add(Path.GetFileName(str)); itm.Tag = str; } + else break; } + else break; + } + else + { + if (!(Path.GetFileName(str) == "_data.info")) + { + itm = this.mainView.Items.Add(Path.GetFileName(str)); + itm.Tag = str; + } + else break; + } + FileSystemFolderInfo fsfi = JsonConvert.DeserializeObject<FileSystemFolderInfo>(File.ReadAllText(Path.Combine(CurrentDirectory, "_data.info"))); + foreach (var item in fsfi.Files) + { + Debug.Print(item.Name + " " + Path.GetFileName(str)); + if (item.Name == Path.GetFileName(str)) { itm.ImageIndex = item.FileIcon; break; } } - } catch (Exception ex) { - //wm.StartInfobox95("Exploring - C:", "Error with the file explorer \n" + ex.Message, Properties.Resources.Win95Info); add illegal operation dialog here later - ((Form)this.TopLevelControl).Close(); } + /* + } catch (Exception ex) { + //wm.StartInfobox95("Exploring - C:", "Error with the file explorer \n" + ex.Message, Properties.Resources.Win95Info); add illegal operation dialog here later + ((Form)this.TopLevelControl).Close(); + }*/ } void RefreshTreeNode() @@ -602,31 +576,36 @@ namespace TimeHACK.OS.Win95.Win95Apps { try { - if (mainView.FocusedItem.Tag == null) + if (new DirectoryInfo((string)mainView.FocusedItem.Tag).Extension == null || new DirectoryInfo((string)mainView.FocusedItem.Tag).Extension == "") { // If it isn't a file - GoToDir(Path.Combine(CurrentDirectory, mainView.FocusedItem.ImageKey.ToString())); + if (mainView.FocusedItem.Text == "C:") + GoToDir(Path.Combine(CurrentDirectory, "CDrive")); + else + GoToDir(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text)); } else { // If it is a file - if (IsFileOpenDialog == true || IsFileSaveDialog == true) + if (IsFileOpenDialog == true || IsFileSaveDialog == true) + { + if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension) { - if (new FileInfo(Path.Combine(CurrentDirectory, txtSave.Text)).Extension == onlyViewExtension) - { - Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text); - } + Program.WindowsExplorerReturnPath = Path.Combine(CurrentDirectory, txtSave.Text); + } - FileDialogBoxManager.IsInOpenDialog = false; - FileDialogBoxManager.IsInSaveDialog = false; + FileDialogBoxManager.IsInOpenDialog = false; + FileDialogBoxManager.IsInSaveDialog = false; - ((Form)this.TopLevelControl).Close(); - } - else - { - OpenFile(mainView.FocusedItem.Tag.ToString()); - } + ((Form)this.TopLevelControl).Close(); + } + else + { + OpenFile(mainView.FocusedItem.Tag.ToString()); + } } - } catch (Exception ex) { + } + catch (Exception ex) + { MessageBox.Show(ex.Message); } } |
