添加工具:CreateNewSenparcEntitiesFile

pull/229/head
苏震巍 7 months ago
parent ea522dcf3a
commit 9cadb2649b

4
.gitignore vendored

@ -75,7 +75,7 @@ obj/
SenparcConfig.Development.config
.idea/
/src/Extensions/Senparc.Web/App_Data/ApiDocXML/Senparc.Xncf.PromptRange.XML
/src/Extensions/Senparc.Web/App_Data/ApiDocXML/
/src/Extensions/Senparc.Xncf.AIAgentsHub.Tests/appsettings.Development.json
*.zip
/tools/BuildXncfBuilderTemplate/ReplacePlaceholders/.vs
.vs/

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.10.35004.147
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CreateNewSenparcEntitiesFile", "CreateNewSenparcEntitiesFile.csproj", "{9F601775-E72F-482B-8C43-ECC6711E1F36}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9F601775-E72F-482B-8C43-ECC6711E1F36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9F601775-E72F-482B-8C43-ECC6711E1F36}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9F601775-E72F-482B-8C43-ECC6711E1F36}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9F601775-E72F-482B-8C43-ECC6711E1F36}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A79D606D-DA75-4D3B-818B-B02C71893384}
EndGlobalSection
EndGlobal

@ -0,0 +1,43 @@
using System;
using System.IO;
class Program
{
static void Main(string[] args)
{
string baseDirectory = @"X:\Senparc 项目\NeuCharFramework\NcfPackageSources\src"; // 替换为你的目录路径
string replacementText = "Dm"; // 替换为你指定的字符
ProcessFiles(baseDirectory, replacementText);
}
static void ProcessFiles(string baseDir, string replacement)
{
// 获取所有.cs文件
var files = Directory.GetFiles(baseDir, "*.cs", SearchOption.AllDirectories);
foreach (var file in files)
{
var fileName = Path.GetFileName(file);
// 检查文件名是否以SenparcEntities_SqlServer.cs结尾
if (fileName.EndsWith("SenparcEntities_SqlServer.cs"))
{
var newFileName = fileName.Replace("SqlServer", replacement);
var newFilePath = Path.Combine(Path.GetDirectoryName(file), newFileName);
// 读取原文件内容
var content = File.ReadAllText(file);
// 替换内容中的SqlServer
var newContent = content.Replace("SqlServer", replacement);
// 写入新文件
File.WriteAllText(newFilePath, newContent);
// 输出新建文件的路径
Console.WriteLine($"New file created: {newFilePath}");
}
}
}
}
Loading…
Cancel
Save