Skip to content

Commit

Permalink
Sorting files by fullname when generating ttinclude file
Browse files Browse the repository at this point in the history
  • Loading branch information
lerocha committed Feb 3, 2024
1 parent 8c187cd commit 1a20b4b
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions ChinookDatabase/_T4Templates/Chinook.tt
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,19 @@
// List of Included Files:
<#
DirectoryInfo directoryInfo = new DirectoryInfo(options.Path);
FileInfo[] files = directoryInfo.GetFiles(options.SearchPattern, SearchOption.AllDirectories);
var query = from file in directoryInfo.GetFiles(options.SearchPattern, SearchOption.AllDirectories)
where !file.Name.Contains("AssemblyInfo") &&
!file.Name.Contains("AssemblyAttributes") &&
!file.Name.Equals("Chinook.Designer.cs") &&
!file.Name.Contains("GlobalUsings.g.cs") &&
!file.FullName.Contains("DataModel") &&
!file.Name.StartsWith("TemporaryGeneratedFile_")
orderby file.FullName
select file;
var files = query.ToList();

var fullnames = new List<string>();
foreach (FileInfo file in files)
foreach (var file in files)
{
// Skip any unwanted source file.
if (file.Name.Contains("AssemblyInfo") ||
file.Name.Contains("AssemblyAttributes") ||
file.Name.Equals("Chinook.Designer.cs") ||
file.Name.Contains("GlobalUsings.g.cs") ||
file.FullName.Contains("DataModel") ||
file.Name.StartsWith("TemporaryGeneratedFile_"))
{
continue;
}

fullnames.Add(file.FullName);
#>
// <#= file.Name #>
<#
Expand All @@ -88,12 +84,12 @@
<#
// Reads all the classes and append them to output.
output = new StringBuilder();
foreach (var fullname in fullnames)
foreach (var file in files)
{
output.AppendLine("\n//------------------------------------------------------------------------------");
output.AppendLine("// Filename: " + Path.GetFileName(fullname));
output.AppendLine("// Filename: " + file.Name);
output.AppendLine("//------------------------------------------------------------------------------\n");
lines = File.ReadAllLines(fullname);
lines = File.ReadAllLines(file.FullName);
foreach (string line in lines)
{
if (!line.StartsWith("using") &&
Expand Down

0 comments on commit 1a20b4b

Please sign in to comment.