src/T4Toolbox.VisualStudio/OutputFileManager.cs
/// <summary>
/// Records a list of the generated files in the LastOutputs metadata of the input item.
/// </summary>
Records a list of the generated files in the LastOutputs metadata of the input item.
Records a list of the generated files in the LastOutputs metadata of the input item .
private void RecordLastOutputs()
        {
            string lastGenOutputFullPath = this.GetLastGenOutputFullPath();
            var outputFileList = new List<string>();
            foreach (OutputFile output in this.outputFiles)
            {
                if (output.PreserveExistingFile)
                {
                    continue;
                }
                string outputFullPath = this.GetFullPath(output.Path);
                if (string.Equals(lastGenOutputFullPath, outputFullPath, StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }
                outputFileList.Add(FileMethods.GetRelativePath(this.inputFile, outputFullPath));
            }
            outputFileList.Sort();
            string lastOutputs = string.Join(Environment.NewLine, outputFileList);
            if (outputFileList.Count > 1)
            {
                lastOutputs = Environment.NewLine + lastOutputs + Environment.NewLine;
            }
            this.input.SetItemAttribute(ItemMetadata.LastOutputs, lastOutputs);
        }
private void RecordLastOutputs ( ) { string lastGenOutputFullPath = this . GetLastGenOutputFullPath ( ) ; var outputFileList = new List < string > ( ) ; foreach ( OutputFile output in this . outputFiles ) { if ( output . PreserveExistingFile ) { continue ; } string outputFullPath = this . GetFullPath ( output . Path ) ; if ( string . Equals ( lastGenOutputFullPath , outputFullPath , StringComparison . OrdinalIgnoreCase ) ) { continue ; } outputFileList . Add ( FileMethods . GetRelativePath ( this . inputFile , outputFullPath ) ) ; } outputFileList . Sort ( ) ; string lastOutputs = string . Join ( Environment . NewLine , outputFileList ) ; if ( outputFileList . Count > 1 ) { lastOutputs = Environment . NewLine + lastOutputs + Environment . NewLine ; } this . input . SetItemAttribute ( ItemMetadata . LastOutputs , lastOutputs ) ; }
Records a list of the generated files in the LastOutputs metadata of the input item.
Records a list of the generated files in the LastOutputs metadata of the input item .
// Create a list of files that may be regenerated/overwritten in the future // Don't store the name of file user wants to preserve so that we don't deleted next time. // Don't store the name of default output file second time // Store a relative path from the input file to the output file // If more than one output file was generated, write one file per line in alphabetical order for readability // Write the file list to the project file