예제 #1
0
 /// <summary>
 /// Create a clone of the given project with the given name.
 /// </summary>
 /// <param name="toClone">The project to clone</param>
 /// <param name="name">The name to give the clone</param>
 /// <param name="error">A description of the error</param>
 /// <returns>True if the clone succeeded,</returns>
 public bool CloneProject(Project toClone, string name, ref string error)
 {
     if (!Project.ValidateProjectName(name))
     {
         error = "The project name was invalid!";
         return(false);
     }
     lock (EditingSessionLock)
     {
         var repository = Runtime.Configuration.ProjectRepository;
         // Make sure the name is unique
         if ((from project in Runtime.Configuration.ProjectRepository.Projects
              where project.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)
              select project as Project).Any())
         {
             error = "A project with that name already existed!";
             return(false);
         }
         var clonedProject = toClone.CreateCloneProject(false);
         clonedProject.Name = name;
         // if we are able to save, add it to the project repository
         if (clonedProject.Save(ref error))
         {
             repository.AddProject(clonedProject);
             return(true);
         }
         return(false);
     }
 }
예제 #2
0
 /// <summary>
 /// Create a cloned project of the given project
 /// </summary>
 /// <param name="project">The project to clone</param>
 /// <returns>An exact copy of the project, if it is saved it will overwrite</returns>
 internal Project CreateCloneProject(Project project) => project.CreateCloneProject();
예제 #3
0
 /// <summary>
 /// Create a cloned project of the given project
 /// </summary>
 /// <param name="project">The project to clone</param>
 /// <returns>An exact copy of the project, if it is saved it will overwrite</returns>
 internal Project CreateCloneProject(Project project)
 {
     return project.CreateCloneProject();
 }
예제 #4
0
 /// <summary>
 /// Create a cloned project of the given project
 /// </summary>
 /// <param name="project">The project to clone</param>
 /// <returns>An exact copy of the project, if it is saved it will overwrite</returns>
 internal Project CreateCloneProject(Project project)
 {
     return(project.CreateCloneProject());
 }