private void папкуToolStripMenuItem_Click(object sender, EventArgs e) { var fileName = ""; try { fileName = FileNameText.Text; DirectoryInfo directory = new DirectoryInfo(filePath + "/" + fileName); if (!directory.Exists) { directory.Create(); } FileNameText.Clear(); FileNameText.Hide(); LoadFilesAndDirectories(); } catch (Exception) { return; } }
private void переименоватьToolStripMenuItem_Click(object sender, EventArgs e) { var newFileName = ""; FileNameText.Show(); newFileName = FileNameText.Text; while (true) { try { if (!isFile) { Directory.Move(filePath + currentFileName, filePath + "/" + newFileName); } else { File.Move(filePath + currentFileName, filePath + "/" + newFileName); } break; } catch (Exception) { break; } } isFile = false; LoadFilesAndDirectories(); FileNameText.Clear(); FileNameText.Hide(); }
private void файлToolStripMenuItem_Click(object sender, EventArgs e) { var fileName = ""; try { fileName = FileNameText.Text; FileInfo file = new FileInfo(filePath + "/" + fileName + ".txt"); if (!file.Exists) { file.Create().Close(); } FileNameText.Clear(); FileNameText.Hide(); LoadFilesAndDirectories(); } catch (Exception) { return; } }
private void Form1_Load(object sender, EventArgs e) { LoadDrives(); FileNameText.Hide(); }