コード例 #1
0
 public void CreateFolder(string path)
 {
     string title = "Створення папки";
     string name;
     NameOfNewFileOrFolder form = new NameOfNewFileOrFolder(title, path, FOLDER);
     form.ShowDialog();
     name = NameOfNewFileOrFolder.NewName;
     string fullPath = path + NameOfNewFileOrFolder.NewName + "\\";
     try
     {
         Directory.CreateDirectory(fullPath);
     }
     catch (Exception e)
     {
         MessageBox.Show("Дану папку захищено від змін операційною системою.", "Попередження");
     }
 }
コード例 #2
0
        public void CreateTextFile(string path)
        {
            string title = "Створення текстового файлу";
            string name;
            NameOfNewFileOrFolder form = new NameOfNewFileOrFolder(title, path, TEXT_FILE);
            form.ShowDialog();
            name = NameOfNewFileOrFolder.NewName;
            string fullPath = path + NameOfNewFileOrFolder.NewName + "." + txt;

            try
            {
                File.Create(fullPath);
            }
            catch (Exception e)
            {
                MessageBox.Show("Дану папку захищено від змін операційною системою.", "Попередження");
            }
        }