public IHelixProjectTemplate Run(HelixTemplateManifest manifest, string solutionRootPath)
        {
            Manifest                    = manifest;
            ReplaceTokensService        = new ReplaceTokensService(Manifest.ReplacementTokens);
            DestinationRootPath         = solutionRootPath;
            BuildDestinationPathService = new BuildDestinationPathService(Manifest.ManifestRootPath, DestinationRootPath);
            var templateObjects = new List <ITemplateObject>();

            templateObjects.AddRange(GetTemplateObjectFromDirectory(Manifest.ManifestRootPath));
            var copyTemplateObjectsService = new CopyTemplateObjectFilesService(templateObjects);
            var copiedFilePaths            = copyTemplateObjectsService.Copy();

            if (!copiedFilePaths.Any())
            {
                return new HelixProjectTemplate
                       {
                           Manifest          = Manifest,
                           TemplateObjects   = templateObjects,
                           ReplacementTokens = Manifest.ReplacementTokens
                       }
            }
            ;

            var replaceFileTokensService = new ReplaceTokensInFilesService(copiedFilePaths, Manifest.ReplacementTokens);

            replaceFileTokensService.Replace();
            MarkIfSkipped(templateObjects);
            CreateVirtualSolutionFolders(templateObjects);
            return(new HelixProjectTemplate
            {
                Manifest = Manifest,
                TemplateObjects = templateObjects,
                ReplacementTokens = Manifest.ReplacementTokens
            });
        }
 public virtual HelixTemplateManifest Parse(IDictionary <string, string> replacementTokens)
 {
     Manifest = new HelixTemplateManifest(ManifestFilePath)
     {
         ReplacementTokens = replacementTokens
     };
     ManifestTypeInstantiator = new ManifestTypeInstantiator();
     return(Parse(File.ReadAllText(ManifestFilePath)));
 }
예제 #3
0
 protected void SelectionChanged(object sender, SelectionChangedEventArgs selectionChangedEventArgs)
 {
     if (AvailableManifestsComboBox.SelectedIndex < 0 ||
         AvailableManifestsComboBox.SelectedIndex > AvailableManifestsCollection.Count)
     {
         return;
     }
     _selectedManifest = _manifests[AvailableManifestsComboBox.SelectedIndex];
     SetSelectedManifest();
 }
        protected void SettingsButton_Clicked(object sender, RoutedEventArgs e)
        {
            var settingsDialog  = new SettingsDialog();
            var settingsUpdated = settingsDialog.ShowDialog();

            if (!settingsUpdated.HasValue || !settingsUpdated.Value)
            {
                return;
            }

            var rootDirectory = settingsDialog.RootDirectory;

            Initialize(rootDirectory, SolutionRoot, _initialTokens, _isSolutionCreation);
            _selectedManifest = _manifests[AvailableManifestsComboBox.SelectedIndex];
            SetSelectedManifest();
        }
 public virtual HelixTemplateManifest Parse(IDictionary <string, string> replacementTokens)
 {
     try
     {
         Manifest = new HelixTemplateManifest(ManifestFilePath)
         {
             ReplacementTokens = replacementTokens
         };
         ManifestTypeInstantiator = new ManifestTypeInstantiator();
         return(Parse(File.ReadAllText(ManifestFilePath)));
     }
     catch (Exception exception)
     {
         Trace.WriteLine($"Exception occurred while parsing manifest: {exception.Message}\n\n{exception.StackTrace}");
         return(null);
     }
 }
        public IHelixProjectTemplate Run(HelixTemplateManifest manifest, string solutionRootPath)
        {
            Manifest = manifest;
            WriteTraceService.WriteToTrace("Template Engine started", "\nInfo", $"Manifest: {manifest.Name}",
                                           $"root path: {solutionRootPath} ");
            ReplaceTokensService        = new ReplaceTokensService(Manifest.ReplacementTokens);
            DestinationRootPath         = solutionRootPath;
            BuildDestinationPathService = new BuildDestinationPathService(Manifest.ManifestRootPath, DestinationRootPath);
            ExpandConditions();

            var templateObjects = new List <ITemplateObject>();

            templateObjects.AddRange(GetTemplateObjectFromDirectory(Manifest.ManifestRootPath));
            var copyTemplateObjectsService = new CopyTemplateObjectFilesService(templateObjects);
            var copiedFilePaths            = copyTemplateObjectsService.Copy();

            if (!copiedFilePaths.Any())
            {
                return new HelixProjectTemplate
                       {
                           Manifest          = Manifest,
                           TemplateObjects   = templateObjects,
                           ReplacementTokens = Manifest.ReplacementTokens
                       }
            }
            ;

            var replaceFileTokensService = new ReplaceTokensInFilesService(copiedFilePaths, Manifest.ReplacementTokens);

            replaceFileTokensService.Replace();
            EvaluateSkipAttach(templateObjects);
            CreateVirtualSolutionFolders(templateObjects);

            return(new HelixProjectTemplate
            {
                Manifest = Manifest,
                TemplateObjects = templateObjects,
                ReplacementTokens = Manifest.ReplacementTokens
            });
        }
 protected void SelectionChanged(object sender, SelectionChangedEventArgs selectionChangedEventArgs)
 {
     SelectedManifestComboItem = AvailableManifestsCollection[AvailableManifestsComboBox.SelectedIndex];
     _selectedManifest         = _manifests[AvailableManifestsComboBox.SelectedIndex];
     SetSelectedManifest();
 }