Beispiel #1
0
        public void GivenTheScriptWithFollowingContentForAutomation(string filename, string templateContent)
        {
            this.currentTesteeFilePath = Path.Combine(this.pathTestEnvironment, filename);
            File.WriteAllText(this.currentTesteeFilePath, templateContent);
            this.t4TemplateContent = templateContent;

            this.t4Template = VisualStudioHelper.AddFileToProject(this.projectName, this.currentTesteeFilePath);
        }
        public void GivenTheScriptModifiedByFollowingContent(string filename, string templateContent)
        {
            var file = Path.Combine(sourcePath, filename);

            VisualStudioHelper.RemoveFileFromProject(file);

            File.WriteAllText(file, templateContent);

            t4Template = VisualStudioHelper.AddFileToProject(
                projectName,
                file);
        }
Beispiel #3
0
        public bool DoWork()
        {
            using (var vsHelper = new VisualStudioHelper(_dte2Service))
            {
                if (!vsHelper.CanAccessPackageManifest())
                {
                    return(ReturnFailed("No package manifest found... \n"));
                }
                var sfn         = vsHelper.GetSelectedItemPath();
                var imageHelper = new ImageHelper(sfn);
                if (string.IsNullOrEmpty(sfn))
                {
                    return(ReturnFailed("No file selected, aborting... \n"));
                }

                var extension = Path.GetExtension(sfn);
                if (extension != ".png" && extension != ".svg")
                {
                    return(ReturnFailed("Unsupported file selected (only .png & .svg allowed), aborting... \n"));
                }

                _outputWindow.OutputString("Starting generation of images... \n");


                foreach (var tile in _tilesToGenerate)
                {
                    _outputWindow.OutputString("Generating " + tile.XmlName + "... \n");
                    foreach (var scaleFactor in tile.ScaleFactors)
                    {
                        var savePath = GenerateSavePath(tile, scaleFactor, sfn);
                        imageHelper.GenerateFile(tile, scaleFactor, savePath);
                        vsHelper.AddFileToProject(savePath);
                        vsHelper.AddTileToPackage(tile);
                    }
                }
                _outputWindow.OutputString("Saving project... \n");
            }
            return(true);
        }