Example #1
0
        public virtual void Process(IEnumerable <OutputFile> files)
        {
            var filesToProcess = new List <OutputFile>();

            foreach (var file in files)
            {
                var outputPath = VsManager.GetOutputPath(_dte, file, Path.GetDirectoryName(_templateFile));
                file.FileName = Path.Combine(outputPath, file.Name) + "_Generated" + GetFileTypeExtension(file);

                var isNewOrAdjusted = IsNewFile(file);

                if (isNewOrAdjusted || !file.FileName.EndsWith(".sql"))
                {
                    OutputPaneManager.WriteToOutputPane($"File {file.Name} shall be processed");
                    filesToProcess.Add(file);
                }
                else
                {
                    OutputPaneManager.WriteToOutputPane($"File {file.Name} shall not be processed.");
                }
            }

            ProjectSync(_templateProjectItem, filesToProcess);
            CleanUpTemplatePlaceholders();
            var items = VsManager.GetOutputFilesAsProjectItems(_dte, filesToProcess);

            WriteVsProperties(items, filesToProcess);

            filesToProcess = null;
        }
Example #2
0
        internal void ProcessClassFile(OutputFile outputFile)
        {
            var outputPath = VsManager.GetOutputPath(_dte, outputFile, _defaultPath);

            outputFile.FileName = Path.Combine(outputPath, outputFile.FullName);

            ProjectItem placeHolder = GetPlaceholder(outputFile);

            if (!FileExist(outputFile) || IsFileContentDifferent(outputFile))
            {
                OutputPaneManager.WriteToOutputPane($"Process {outputFile.Name}");
                ProcessFile(outputFile, placeHolder);
            }
            RegisterProcessedFile(outputFile);
        }