mirror of
https://github.com/nsnail/dot.git
synced 2025-06-17 04:53:21 +08:00
17 lines
609 B
C#
17 lines
609 B
C#
using System.Text.RegularExpressions;
|
|
|
|
var slnFile = Directory.GetFiles(@".", "*.sln").First();
|
|
var content = File.ReadAllText(slnFile);
|
|
content = Regex.Replace(
|
|
content,
|
|
@"ProjectSection\(SolutionItems\) = preProject(?:.|\n)*?EndProjectSection",
|
|
$"""
|
|
ProjectSection(SolutionItems) = preProject
|
|
{string.Join('\n',
|
|
Directory.GetFiles(@".", "*").Where(x => !x.EndsWith(".sln") && !x.EndsWith(".user"))
|
|
.Select(x=>$"\t\t{Path.GetFileName(x)} = {Path.GetFileName(x)}"))}
|
|
{'\t'}EndProjectSection
|
|
"""
|
|
);
|
|
Console.WriteLine(content);
|
|
File.WriteAllText(slnFile, content); |