//UI: CREATE (ADD) FOLDER (PROJECT) public static void CreateProjectFolder(string projectName, Label notifyText, DropDownList ddlProj, DropDownList ddlXML) { Valid folder = ProjectFolder.CreateNewProjectFolder(projectName); if (folder.Bool) { //reload pulldown //rehash folders loadPullDowns(ddlProj, ddlXML, notifyText); //FileManager.LoadDropDownListProjName(ddlProj); //project names (folders) //FileManager.LoadDropDownList(ddlXML); //*.xml files //notifyText.Text = String.Format("Your new project folder <b>{0}</b> was created", projectName); notifyText.Text = folder.Message; } else { notifyText.Text = folder.Message; } }
//CREATE (ADD) (NEW PROJECT) public static Valid CreateNewProjectFolder(string projectName) { Valid _isValid = new Valid(); //string path = GetRootFolder() + projectName; //string path = GetCurrentProjectFolder(); //xml path string path = GetClashProjectsFolder() + projectName; //image folder string image_path = GetProjectsImageFolder() + projectName; //test (if folders exist) bool testXmlFolderExists = Directory.Exists(path); bool testImageFolderExists = Directory.Exists(image_path); //directory info DirectoryInfo xmlDir; DirectoryInfo imageDir; //TEST WHICH FOLDERS EXIST if ((testXmlFolderExists == false) && (testImageFolderExists == false)) { //create both folders xmlDir = Directory.CreateDirectory(path); imageDir = Directory.CreateDirectory(image_path); //********************** //create (image subfolders) CreateImageSubFolders(projectName); //********************** //return message _isValid.Bool = true; _isValid.Message = "Both the xml or image folders were created successfully."; } else if ((testXmlFolderExists == false) && (testImageFolderExists == true)) { //create (xml folder only) xmlDir = Directory.CreateDirectory(path); //********************** //create (image subfolders) CreateImageSubFolders(projectName); //********************** _isValid.Bool = true; _isValid.Message = "Only the xml folder was created."; } else if ((testXmlFolderExists == true) && (testImageFolderExists == false)) { //create (image folder only) imageDir = Directory.CreateDirectory(image_path); //********************** //create (image subfolders) CreateImageSubFolders(projectName); //********************** _isValid.Bool = true; _isValid.Message = "Only the image folder was created."; } else if ((testXmlFolderExists == true) && (testImageFolderExists == true)) { //create (no folders) //********************** //create (image subfolders) CreateImageSubFolders(projectName); //********************** _isValid.Bool = false; _isValid.Message = "Neither the xml or image folders were created, they already exist."; } //xml //only create it if the path doesn't exist //if (!Directory.Exists(path)) //{ // Directory.CreateDirectory(path); // return true; //} //images //only create it if the path doesn't exist //if (!Directory.Exists(image_path)) //{ // Directory.CreateDirectory(image_path); // result = true; //} //RETURN return(_isValid); }