-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from Frieren-Violet/dev
.github/preProcess
- Loading branch information
Showing
3 changed files
with
80 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System.Xml; | ||
using System.IO; | ||
|
||
string path = @"D:\a\THUAI8\"; | ||
Visit(new DirectoryInfo(path)); | ||
|
||
void Visit(DirectoryInfo root) | ||
{ | ||
foreach (var file in root.EnumerateFiles()) | ||
{ | ||
if (file.Name.EndsWith("csproj")) | ||
{ | ||
ChangeFile(file.FullName); | ||
} | ||
} | ||
foreach (var dir in root.EnumerateDirectories()) | ||
{ | ||
Visit(dir); | ||
} | ||
} | ||
|
||
void ChangeFile(string path) | ||
{ | ||
var document = new XmlDocument(); | ||
document.Load(path); | ||
var projectNode = document.DocumentElement; | ||
if (projectNode != null) | ||
{ | ||
var propertyGroup = document.CreateElement("PropertyGroup", projectNode.NamespaceURI); | ||
|
||
var optimize = document.CreateElement("Optimize", projectNode.NamespaceURI); | ||
optimize.InnerText = "true"; | ||
propertyGroup.AppendChild(optimize); | ||
|
||
var serverGc = document.CreateElement("ServerGarbageCollection", projectNode.NamespaceURI); | ||
serverGc.InnerText = "true"; | ||
propertyGroup.AppendChild(serverGc); | ||
|
||
var concurrentGc = document.CreateElement("ConcurrentGarbageCollection", projectNode.NamespaceURI); | ||
concurrentGc.InnerText = "true"; | ||
propertyGroup.AppendChild(concurrentGc); | ||
|
||
var tieredCompilation = document.CreateElement("TieredCompilation", projectNode.NamespaceURI); | ||
tieredCompilation.InnerText = "true"; | ||
propertyGroup.AppendChild(tieredCompilation); | ||
|
||
projectNode.AppendChild(propertyGroup); | ||
} | ||
|
||
document.Save(path); | ||
} |
This file contains 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
This file contains 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