Exemple #1
0
        private void CheckProjectDir(ProjectEntity entity)
        {
            //first create the solution folder
            if (!Directory.Exists(entity.ProjectPath))
            {
                Directory.CreateDirectory(entity.ProjectPath);
            }

            //create sub folders
            if (!Directory.Exists(entity.SubFolderProfiled))
            {
                Directory.CreateDirectory(entity.SubFolderProfiled);
            }

            if (!Directory.Exists(entity.SubFolderSnapshot))
            {
                Directory.CreateDirectory(entity.SubFolderSnapshot);
            }
        }
Exemple #2
0
        /// <summary>
        /// Open a given project file
        /// </summary>
        /// <returns></returns>
        public bool Open(string fileName)
        {
            Tracer.Verbose("ProjectService:Open", "START");

            try
            {
                Current = new ProjectEntity(fileName);
                return(LoadProject());
            }
            catch (Exception err)
            {
                Tracer.Error("ProjectService.Open", err);
                return(false);
            }
            finally
            {
                Tracer.Verbose("ProjectService:Open", "END");
            }
        }
Exemple #3
0
        /// <summary>
        /// Load the project in the Current property
        /// </summary>
        /// <returns></returns>
        public ProjectEntity Load(string filePath)
        {
            ProjectEntity entity = null;

            try
            {
                if (File.Exists(filePath))
                {
                    entity = (ProjectEntity)SerializeHelper.Deserialize(filePath, typeof(ProjectEntity));

                    //first check the solution folder
                    CheckProjectDir(entity);
                }
            }
            catch (Exception error)
            {
                Tracer.Error("ProjectDAC.Load", error);
            }
            return(entity);
        }
Exemple #4
0
        /// <summary>
        /// Create a new project
        /// </summary>
        /// <returns></returns>
        public ProjectEntity Create(string projectLocation, string projectName)
        {
            ProjectEntity entity = null;

            try
            {
                entity = new ProjectEntity(projectLocation, projectName);

                if (File.Exists(entity.ProjectFilePath))
                {
                    return(null);
                }

                //first check the solution folder
                CheckProjectDir(entity);
            }
            catch (Exception error)
            {
                Tracer.Error("ProjectDAC.Create", error);
            }
            return(entity);
        }
Exemple #5
0
        /// <summary>
        /// Create a new project
        /// </summary>
        /// <returns></returns>
        public bool Create(string projectLocation, string projectName)
        {
            Tracer.Verbose("ProjectService:Create", "START");

            try
            {
                EventDispatcher.Instance.RaiseProject(Current, ProjectEventType.Opening);

                Current = new ProjectDAC().Create(projectLocation, projectName);

                EventDispatcher.Instance.RaiseProject(Current, ProjectEventType.Opened);

                return(true);
            }
            catch (Exception err)
            {
                Tracer.Error("ProjectService.Create", err);
                return(false);
            }
            finally
            {
                Tracer.Verbose("ProjectService:Create", "END");
            }
        }
Exemple #6
0
 public ProjectWorker(BackgroundWorker worker, DoWorkEventArgs e)
     : base(worker, e)
 {
     Project = (ProjectEntity)e.Argument;
 }