Example #1
0
        public bool IsValid()
        {
            var isValid = false;

            ArgumentError = false;

            var isValidDirectory = Directory.Exists(TemplateRoot);

            patchApplicationService = new PatchApplicationService(TemplateRoot);
            SourceProjectName       = patchApplicationService.GetSourceProjectName(TemplateId, TemplateRoot);
            var hasProjectFile = !string.IsNullOrEmpty(SourceProjectName);

            var totalTemplates  = TemplateData.AllTemplates.Count;
            var isValidTemplate = TemplateId > 0 && TemplateId <= totalTemplates;

            isValid = isValidDirectory && isValidTemplate && hasProjectFile && !ArgumentError;

            if (!isValidDirectory)
            {
                ErrorMessage = "The directory of your project is required.";
            }

            if (!hasProjectFile)
            {
                ErrorMessage = $"A project could not be located at: {TemplateRoot}";
            }

            if (!isValidTemplate)
            {
                ErrorMessage = "A template id is required.";
            }

            return(isValid);
        }
 static IOUtils()
 {
     patchApplicationService = new PatchApplicationService(AssemblyDirectory);
 }
Example #3
0
 public AddTemplateCommand()
 {
     patchApplicationService = new PatchApplicationService(Utils.IOUtils.AssemblyDirectory);
 }