예제 #1
0
 /// <summary>
 /// This method creates a new project in the given path
 /// </summary>
 /// <param name="projectName">The name of the project</param>
 /// <param name="projectPath">The path of the project</param>
 private void CreateProject(string projectName, string projectPath)
 {
     try
     {
         if (projectName.IndexOfAny(System.IO.Path.GetInvalidFileNameChars()) != -1)
         {
             throw new Exception(MSG_ERR_INVALID_PRJ_NAME);
         }
         Boolean pathExists   = Directory.Exists(projectPath),
                 prjDirExists = pathExists ? Directory.Exists(Path.Combine(projectPath, projectName)) : false,
                 prjIsEmpty   = prjDirExists ? Directory.GetDirectories(projectPath).Length + Directory.GetFiles(projectPath).Length == 0 : true;
         if (pathExists) //&& prjIsEmpty)
         {
             ProjectUtils.InitProject(projectName, projectPath);
         }
         else if (!pathExists)
         {
             throw new Exception(MSG_ERR_NEW_PRJ_MISS_DIR);
         }
         Console.WriteLine(MSG_INF_NEW_PRJ, projectName, projectPath);
     }
     catch (Exception exc)
     {
         throw exc;
     }
 }