private void mainView_SelectedIndexChanged(object sender, EventArgs e) { // This will change the web view! if (mainView.FocusedItem == null) { txtInfoTip.Show(); InfoDesc.Hide(); } else { txtInfoTip.Hide(); if (File.Exists(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text))) { // lemon note: no more implementation of windows explorer, because holy hell is it hard and buggy InfoDesc.Show(); FileInfo fi = new FileInfo(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text)); txtInfoDescName.Text = mainView.FocusedItem.Text; txtInfoDescType.Text = GetDescription(ReturnType(fi.Extension)); txtInfoDescModified.Text = fi.CreationTime.ToString(); txtInfoDescSize.Show(); txtInfoDescSize.Text = $"Size: {fi.Length} bytes."; } else if (Directory.Exists(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text))) { txtInfoTip.Hide(); InfoDesc.Show(); DirectoryInfo fi = new DirectoryInfo(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text)); txtInfoDescName.Text = mainView.FocusedItem.Text; txtInfoDescType.Text = "File Folder"; txtInfoDescModified.Text = fi.CreationTime.ToString(); txtInfoDescSize.Hide(); } } }
private void mainView_SelectedIndexChanged(object sender, EventArgs e) { // This will change the web view! if (mainView.FocusedItem == null) { txtInfoTip.Show(); InfoDesc.Hide(); } else { txtInfoTip.Hide(); if (File.Exists(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text))) { // Check if it is a regonized file - if so then in Windows 2000/ME it gives a fancy description bool recognized = false; string description = ""; if (SaveSystem.CurrentSave.CurrentOS == "2000" || SaveSystem.CurrentSave.CurrentOS == "ME") { switch (File.ReadAllText(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text))) { case "explorer": recognized = true; description = "Insert a description here..."; break; } } if (recognized == true) { // TODO: } else { InfoDesc.Show(); FileInfo fi = new FileInfo(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text)); txtInfoDescName.Text = mainView.FocusedItem.Text; txtInfoDescType.Text = ReturnType(fi.Extension).Split('\n')[0]; txtInfoDescModified.Text = fi.CreationTime.ToString(); txtInfoDescSize.Show(); txtInfoDescSize.Text = $"Size: {fi.Length} bytes."; } } else if (Directory.Exists(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text))) { txtInfoTip.Hide(); InfoDesc.Show(); DirectoryInfo fi = new DirectoryInfo(Path.Combine(CurrentDirectory, mainView.FocusedItem.Text)); txtInfoDescName.Text = mainView.FocusedItem.Text; txtInfoDescType.Text = "File Folder"; txtInfoDescModified.Text = fi.CreationTime.ToString(); txtInfoDescSize.Hide(); } } }
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(); string weblabel = ReadDataFile(CurrentDirectory, false); 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)) { // 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 (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.Tag = str; } } } } 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(); } }