Created
November 12, 2020 22:29
-
-
Save Deneas/aae3a25e96b74d2b2f9797e1698f65a5 to your computer and use it in GitHub Desktop.
Merges all .cs files of a project into a single one. Quick and dirty, but it should be enough for programming competition like on Codingame
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <#@ template debug="false" hostspecific="True" language="C#" #> | |
| <#@ assembly name="System.Core" #> | |
| <#@ assembly name="EnvDte" #> | |
| <#@ import namespace="System.Linq" #> | |
| <#@ import namespace="System.IO" #> | |
| <#@ import namespace="System.Collections.Generic" #> | |
| <#@ import namespace="System.Text.RegularExpressions" #> | |
| <#@ import namespace="System" #> | |
| <#@ output extension=".generated.cs" #> | |
| namespace SingleFile { | |
| <# | |
| var root = Host.ResolvePath(""); | |
| var outputFile = Host.TemplateFile.Substring(0,Host.TemplateFile.Length - 3) + ".generated.cs"; | |
| var fileNames = Directory.EnumerateFiles(root, "*.cs", SearchOption.AllDirectories) | |
| .Where(f => !(f.StartsWith(root + "\\bin") || f.StartsWith(root + "\\obj") || f.EndsWith(outputFile))) | |
| .ToList(); | |
| foreach(string fileName in fileNames) | |
| { | |
| var text = File.ReadAllText(fileName); | |
| WriteLine(text); | |
| } | |
| #> | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment