예제 #1
0
        private void AddNewFile(String location, String fileName, VSTemplate template)
        {
            if (template == null || this.Callback == null)
            {
                return;
            }
            if (String.IsNullOrEmpty(location) || String.IsNullOrEmpty(fileName))
            {
                return;
            }

            fileName = System.IO.Path.GetFileNameWithoutExtension(fileName);
            String file = template.GetProjectFile(location, fileName);

            if (File.Exists(file))
            {
                String msg = String.Format(Constants.Message.FileIsExist, this.ProjectName);
                System.Windows.MessageBox.Show(msg, Constants.Message.Title, MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            // 1、复制相关文件;
            template.Copy(this.Location, fileName);
            // 2、
            this.Callback(file, template.TemplateData.Type);
        }
예제 #2
0
        private void NewProject(String solutionLocation, String solutionName, String projectName, VSTemplate template)
        {
            if (template == null || this.Callback == null)
            {
                return;
            }

            //
            String solutionFolder = System.IO.Path.Combine(this.Location, this.SolutionName);

            if (Directory.Exists(solutionFolder))
            {
                // Solution文件夹已经存在;
                String message = String.Format(Constants.Message.ProjectIsExist, this.Location);
                System.Windows.MessageBox.Show(message, Constants.Message.Title, MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            Directory.CreateDirectory(solutionFolder);
            //
            String projectFolder = System.IO.Path.Combine(solutionFolder, ProjectName);
            String projectFile   = template.Copy(projectFolder, projectName);

            //this(projectFile, projectName, template.TemplateData.Type, solutionName, solutionFolder);
            this.Callback(projectFile, template.TemplateData.Type);
        }
예제 #3
0
        private void AddNewProject(String location, String projectName, VSTemplate template)
        {
            if (template == null || this.Callback == null)
            {
                return;
            }

            String projectFolder = System.IO.Path.Combine(location, ProjectName);

            //
            if (Directory.Exists(projectFolder))
            {
                String message = String.Format(Constants.Message.ProjectIsExist, this.ProjectName);
                System.Windows.MessageBox.Show(message, Constants.Message.Title, MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            // 3、复制相关模板文件;
            String projectFile = template.Copy(projectFolder, this.ProjectName);

            // 3、调用回调函数;
            this.Callback(projectFile, template.TemplateData.Type);
        }