public void DoubleClick(object sender, EventArgs e) { if (file is FolderFile) { ((FolderFile)file).Open(); } else { folderDisplay.LoadFolder(new Folder(file.path)); } }
public void Select(FileType type, string path) { CodeBox.Visible = false; CodeBox.Enabled = false; pictureBox1.Visible = false; pictureBox1.Enabled = false; panel1.Visible = false; panel1.Enabled = false; if (currentFileType == FileType.Text) { File.WriteAllText(currentFile, CodeBox.Text); } currentFile = path; currentFileType = type; if (type == FileType.Text) { CodeBox.Visible = true; CodeBox.Enabled = true; try { CodeBox.Text = File.ReadAllText(path); } catch { CodeBox.Text = "Unreadable Shit"; CodeBox.Enabled = false; } if (!Formatter.reformating) { Formatter.reformat(CodeBox, this, false); } } if (type == FileType.Image) { pictureBox1.Visible = true; pictureBox1.Enabled = true; pictureBox1.Image = Image.FromFile(path); } if (type == FileType.Directory) { panel1.Visible = true; panel1.Enabled = true; if (folderDisplay == null) { folderDisplay = new FolderDisplay(panel1, FileMenu, DirectoryMenu, vScrollBar1, ImagePreview); } folderDisplay.LoadFolder(new Folder(path)); } }