ow
This commit is contained in:
commit
f05d2d215f
678 files changed
+73865
No files matched your search
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,51 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Config\tool-init-config.xml" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Config\tool-init-config.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.OLE.Interop" Version="17.8.37221" />
|
||||
<PackageReference Include="RazorEngineCore" Version="2023.11.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="8.0.0" />
|
||||
<PackageReference Include="Fido2NetLib" Version="1.0.0-alpha" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="CloudBuilder.CodeGenerator">
|
||||
<HintPath>..\CloudBuilder.CodeGenerator\bin\Debug\net8.0-windows\CloudBuilder.CodeGenerator.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CloudBuilder.Core">
|
||||
<HintPath>..\Lib\CloudBuilder.Core.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,212 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ToolInitConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<TemplatePath>D:\NET8\Templates</TemplatePath>
|
||||
<CurrentAssembly>CloudBuilder.AI</CurrentAssembly>
|
||||
<Using>
|
||||
@using CloudBuilder.CodeGenerator.Config;
|
||||
@using CloudBuilder.CodeGenerator.Data;
|
||||
@using CloudBuilder.CodeGenerator.Entity;
|
||||
@using CloudBuilder.Core.Application.Builders;
|
||||
@using CloudBuilder.Core.DatabaseAccessor.Entity;
|
||||
@using CloudBuilder.Core.DependencyInjection.Form;
|
||||
@using CloudBuilder.Core.Extensions;
|
||||
@using CloudBuilder.Core.Utility;
|
||||
@using Microsoft.Extensions.DependencyInjection;
|
||||
@using System.Data;
|
||||
@using System;
|
||||
@using System.Reflection;
|
||||
</Using>
|
||||
<NamespaceObjects>
|
||||
<NamespaceObject>
|
||||
<TemplateType>Request</TemplateType>
|
||||
<TemplateFileName>Request.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\CloudBuilder\CloudBuilder.Request\AI</OutFilePath>
|
||||
<Assembly>CloudBuilder.Request</Assembly>
|
||||
<Namespace>CloudBuilder.Request.AI</Namespace>
|
||||
<FileNameSuffix>Request.auto.cs</FileNameSuffix>
|
||||
<FileNamePrefix />
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>Entity</TemplateType>
|
||||
<TemplateFileName>IEntity.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\CloudBuilder\CloudBuilder.AI\Entity</OutFilePath>
|
||||
<Assembly>CloudBuilder.AI</Assembly>
|
||||
<Namespace>CloudBuilder.AI</Namespace>
|
||||
<FileNameSuffix>Entity.auto.cs</FileNameSuffix>
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>IEntityKey</TemplateType>
|
||||
<TemplateFileName>IEntityKey.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\CloudBuilder\CloudBuilder.AI\Entity</OutFilePath>
|
||||
<Assembly>CloudBuilder.AI</Assembly>
|
||||
<Namespace>CloudBuilder.AI</Namespace>
|
||||
<FileNameSuffix>EntityKey.auto.cs</FileNameSuffix>
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>IService</TemplateType>
|
||||
<TemplateFileName>IService.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\CloudBuilder\CloudBuilder.AI\Service</OutFilePath>
|
||||
<Assembly>CloudBuilder.AI</Assembly>
|
||||
<Namespace>CloudBuilder.AI</Namespace>
|
||||
<FileNameSuffix>Service.auto.cs</FileNameSuffix>
|
||||
<FileNamePrefix>I</FileNamePrefix>
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>Permission</TemplateType>
|
||||
<TemplateFileName>Permission.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\CloudBuilder\CloudBuilder.AI\Policy</OutFilePath>
|
||||
<Assembly>CloudBuilder.AI</Assembly>
|
||||
<Namespace>CloudBuilder.AI</Namespace>
|
||||
<FileNameSuffix>PermissionPolicy.auto.cs</FileNameSuffix>
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>RegistEntity</TemplateType>
|
||||
<TemplateFileName>RegistEntity.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\CloudBuilder\CloudBuilder.AI\Entity</OutFilePath>
|
||||
<Assembly>CloudBuilder.AI</Assembly>
|
||||
<Namespace>CloudBuilder.AI</Namespace>
|
||||
<FileNameSuffix>RegistEntity.auto.cs</FileNameSuffix>
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>SearchCriteria</TemplateType>
|
||||
<TemplateFileName>SearchCriteria.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\CloudBuilder\CloudBuilder.AI\SearchCriteria</OutFilePath>
|
||||
<Assembly>CloudBuilder.AI</Assembly>
|
||||
<Namespace>CloudBuilder.AI</Namespace>
|
||||
<FileNameSuffix>SearchCriteria.auto.cs</FileNameSuffix>
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>Service</TemplateType>
|
||||
<TemplateFileName>Service.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\CloudBuilder\CloudBuilder.AI.Service</OutFilePath>
|
||||
<Assembly>CloudBuilder.AI</Assembly>
|
||||
<Namespace>CloudBuilder.AI</Namespace>
|
||||
<FileNameSuffix>Service.auto.cs</FileNameSuffix>
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>TypeScript</TemplateType>
|
||||
<TemplateFileName>TypeScript.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\WebVue\src\data\auto</OutFilePath>
|
||||
<Assembly>CloudBuilder.AI</Assembly>
|
||||
<Namespace>CloudBuilder.AI</Namespace>
|
||||
<FileNameSuffix>.ts</FileNameSuffix>
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>Controller</TemplateType>
|
||||
<TemplateFileName>Controller.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\CloudBuilder\CloudBuilder.Web.Entry\Controllers\Ai</OutFilePath>
|
||||
<Assembly>CloudBuilder.AI.Service</Assembly>
|
||||
<Namespace>CloudBuilder.Web.Entry.Controllers.Ai</Namespace>
|
||||
<FileNameSuffix>Controller.auto.cs</FileNameSuffix>
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>TypeScriptService</TemplateType>
|
||||
<TemplateFileName>TypeScriptService.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\WebVue\src\service\Ai</OutFilePath>
|
||||
<Assembly>CloudBuilder.AI.Service</Assembly>
|
||||
<Namespace>CloudBuilder.Web.Entry.Controllers.Ai</Namespace>
|
||||
<FileNameSuffix>.ts</FileNameSuffix>
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>Request</TemplateType>
|
||||
<TemplateFileName>Request.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\CloudBuilder\CloudBuilder.Request\Security</OutFilePath>
|
||||
<Assembly>CloudBuilder.Request</Assembly>
|
||||
<Namespace>CloudBuilder.Request.Security</Namespace>
|
||||
<FileNameSuffix>Request.auto.cs</FileNameSuffix>
|
||||
<FileNamePrefix />
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>Entity</TemplateType>
|
||||
<TemplateFileName>IEntity.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\CloudBuilder\CloudBuilder.Security\Entity</OutFilePath>
|
||||
<Assembly>CloudBuilder.Security</Assembly>
|
||||
<Namespace>CloudBuilder.Security</Namespace>
|
||||
<FileNameSuffix>Entity.auto.cs</FileNameSuffix>
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>IEntityKey</TemplateType>
|
||||
<TemplateFileName>IEntityKey.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\CloudBuilder\CloudBuilder.Security\Entity</OutFilePath>
|
||||
<Assembly>CloudBuilder.Security</Assembly>
|
||||
<Namespace>CloudBuilder.Security</Namespace>
|
||||
<FileNameSuffix>EntityKey.auto.cs</FileNameSuffix>
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>IService</TemplateType>
|
||||
<TemplateFileName>IService.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\CloudBuilder\CloudBuilder.Security\Service</OutFilePath>
|
||||
<Assembly>CloudBuilder.Security</Assembly>
|
||||
<Namespace>CloudBuilder.Security</Namespace>
|
||||
<FileNameSuffix>Service.auto.cs</FileNameSuffix>
|
||||
<FileNamePrefix>I</FileNamePrefix>
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>Permission</TemplateType>
|
||||
<TemplateFileName>Permission.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\CloudBuilder\CloudBuilder.Security\Policy</OutFilePath>
|
||||
<Assembly>CloudBuilder.Security</Assembly>
|
||||
<Namespace>CloudBuilder.Security</Namespace>
|
||||
<FileNameSuffix>PermissionPolicy.auto.cs</FileNameSuffix>
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>RegistEntity</TemplateType>
|
||||
<TemplateFileName>RegistEntity.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\CloudBuilder\CloudBuilder.Security\Entity</OutFilePath>
|
||||
<Assembly>CloudBuilder.Security</Assembly>
|
||||
<Namespace>CloudBuilder.Security</Namespace>
|
||||
<FileNameSuffix>RegistEntity.auto.cs</FileNameSuffix>
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>SearchCriteria</TemplateType>
|
||||
<TemplateFileName>SearchCriteria.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\CloudBuilder\CloudBuilder.Security\SearchCriteria</OutFilePath>
|
||||
<Assembly>CloudBuilder.Security</Assembly>
|
||||
<Namespace>CloudBuilder.Security</Namespace>
|
||||
<FileNameSuffix>SearchCriteria.auto.cs</FileNameSuffix>
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>Service</TemplateType>
|
||||
<TemplateFileName>Service.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\CloudBuilder\CloudBuilder.Security.Service</OutFilePath>
|
||||
<Assembly>CloudBuilder.Security</Assembly>
|
||||
<Namespace>CloudBuilder.Security</Namespace>
|
||||
<FileNameSuffix>Service.auto.cs</FileNameSuffix>
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>TypeScript</TemplateType>
|
||||
<TemplateFileName>TypeScript.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\WebVue\src\data\auto</OutFilePath>
|
||||
<Assembly>CloudBuilder.Security</Assembly>
|
||||
<Namespace>CloudBuilder.Security</Namespace>
|
||||
<FileNameSuffix>.ts</FileNameSuffix>
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>Controller</TemplateType>
|
||||
<TemplateFileName>Controller.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\CloudBuilder\CloudBuilder.Web.Entry\Controllers\Security</OutFilePath>
|
||||
<Assembly>CloudBuilder.Security.Service</Assembly>
|
||||
<Namespace>CloudBuilder.Web.Entry.Controllers.Security</Namespace>
|
||||
<FileNameSuffix>Controller.auto.cs</FileNameSuffix>
|
||||
</NamespaceObject>
|
||||
<NamespaceObject>
|
||||
<TemplateType>TypeScriptService</TemplateType>
|
||||
<TemplateFileName>TypeScriptService.cshtml</TemplateFileName>
|
||||
<OutFilePath>D:\MAFAI\WebVue\src\service\security</OutFilePath>
|
||||
<Assembly>CloudBuilder.Security.Service</Assembly>
|
||||
<Namespace>CloudBuilder.Web.Entry.Controllers.Security</Namespace>
|
||||
<FileNameSuffix>.ts</FileNameSuffix>
|
||||
</NamespaceObject>
|
||||
</NamespaceObjects>
|
||||
<AssemblyReferences>
|
||||
<AssemblyReference>
|
||||
<AssemblyFileName>D:\MAFAI\CloudBuilder\CloudBuilder.Security.Service\bin\Debug\net8.0\CloudBuilder.Security.Service.dll</AssemblyFileName>
|
||||
</AssemblyReference>
|
||||
<AssemblyReference>
|
||||
<AssemblyFileName>D:\MAFAI\CloudBuilder\CloudBuilder.Security\bin\Debug\net8.0\CloudBuilder.Security.dll</AssemblyFileName>
|
||||
</AssemblyReference>
|
||||
</AssemblyReferences>
|
||||
<ExculdePropertyTypes>
|
||||
<string>Dictionary</string>
|
||||
</ExculdePropertyTypes>
|
||||
</ToolInitConfig>
|
||||
@@ -0,0 +1,214 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
using CloudBuilder.CodeGenerator.Config;
|
||||
using CloudBuilder.CodeGenerator.Data;
|
||||
using CloudBuilder.CodeGenerator.Utility;
|
||||
using CloudBuilder.Core.Application.Builders;
|
||||
using CloudBuilder.Core.Authorization;
|
||||
using CloudBuilder.Core.DatabaseAccessor;
|
||||
using CloudBuilder.Core.DatabaseAccessor.Entity;
|
||||
using CloudBuilder.Core.Extensions;
|
||||
using CloudBuilder.Core.Service;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Connections;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using RazorEngineCore;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
public partial class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
string logFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log\\log.txt");
|
||||
|
||||
if (!Directory.Exists(Path.GetDirectoryName(logFileName))) Directory.CreateDirectory(Path.GetDirectoryName(logFileName));
|
||||
using (StreamWriter w = File.AppendText(logFileName))
|
||||
{
|
||||
w.WriteLine($"[{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}]Start:");
|
||||
}
|
||||
|
||||
Assembly assembly = null;
|
||||
|
||||
if (args != null && args.Length > 0)
|
||||
{
|
||||
Console.WriteLine(args[0]);
|
||||
assembly = Assembly.LoadFrom(args[0]);
|
||||
}
|
||||
|
||||
if (assembly == null) return;
|
||||
|
||||
using (StreamWriter w = File.AppendText(logFileName))
|
||||
{
|
||||
w.WriteLine($"[{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}]Succeed:" + assembly.FullName);
|
||||
}
|
||||
|
||||
ModelData modelData = null;
|
||||
ToolInitConfig toolInitConfig = ToolInitConfig.GetInstance();
|
||||
string template = null;
|
||||
string outputText = null;
|
||||
string outputFileName = null;
|
||||
|
||||
|
||||
ClassInfo[] dataInfos = RazorEngineHelper.PackTypeScriptClassInfo(assembly);
|
||||
|
||||
using (StreamWriter w = File.AppendText(logFileName))
|
||||
{
|
||||
w.WriteLine($"[{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}]PackTypeScriptClassInfo:" + dataInfos.Count());
|
||||
}
|
||||
|
||||
foreach (var item in dataInfos)
|
||||
{
|
||||
modelData = new ModelData();
|
||||
modelData.ClassInfo = item;
|
||||
modelData.ClassInfos = new ClassInfo[] { item };
|
||||
modelData.NamespaceObject = toolInitConfig.NamespaceObjects.Where(x => x.TemplateType == "TypeScript" && x.Assembly == Path.GetFileNameWithoutExtension(assembly.Location)).FirstOrDefault();
|
||||
if (modelData.NamespaceObject == null) continue;
|
||||
|
||||
outputFileName = Path.Combine(modelData.NamespaceObject.OutFilePath, item.ClassName.StringToProtectedProerty() + modelData.NamespaceObject.FileNameSuffix);
|
||||
if (string.IsNullOrEmpty(outputFileName)) continue;
|
||||
|
||||
template = File.ReadAllText(Path.Combine(toolInitConfig.TemplatePath, modelData.NamespaceObject.TemplateFileName));
|
||||
if (string.IsNullOrEmpty(template)) continue;
|
||||
|
||||
outputText = RazorEngineHelper.CompiledTemplate(template, modelData);
|
||||
if (string.IsNullOrEmpty(outputText)) continue;
|
||||
|
||||
if (!Directory.Exists(Path.GetDirectoryName(outputFileName))) Directory.CreateDirectory(Path.GetDirectoryName(outputFileName));
|
||||
|
||||
File.WriteAllText(outputFileName, outputText);
|
||||
|
||||
|
||||
if (!Directory.Exists(Path.GetDirectoryName(logFileName))) Directory.CreateDirectory(Path.GetDirectoryName(logFileName));
|
||||
using (StreamWriter w = File.AppendText(logFileName))
|
||||
{
|
||||
w.WriteLine($"[{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}]Succeed:" + outputFileName);
|
||||
}
|
||||
}
|
||||
|
||||
template = null;
|
||||
outputText = null;
|
||||
outputFileName = null;
|
||||
|
||||
ClassInfo[] classInfos = RazorEngineHelper.PackIServiceClassInfo(assembly);
|
||||
|
||||
using (StreamWriter w = File.AppendText(logFileName))
|
||||
{
|
||||
w.WriteLine($"[{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}]PackIServiceClassInfo:" + classInfos.Count());
|
||||
}
|
||||
|
||||
foreach (var item in classInfos)
|
||||
{
|
||||
//没有要生成公共方法的接口不处理
|
||||
if (item.ClassMethodInfos.Length == 0) continue;
|
||||
|
||||
modelData = new ModelData();
|
||||
modelData.ClassInfo = item;
|
||||
|
||||
if (item.ClassMethodInfos.Select(x => x.MethodName).Where(x => x.StartsWith("PrintBy")).Count() > 0)
|
||||
{
|
||||
modelData.ClassInfo.IsDownload = true;
|
||||
}
|
||||
|
||||
modelData.ClassInfos = new ClassInfo[] { item };
|
||||
|
||||
modelData.NamespaceObject = toolInitConfig.NamespaceObjects.Where(x => x.TemplateType == "Controller" && x.Assembly == Path.GetFileNameWithoutExtension(assembly.Location)).FirstOrDefault();
|
||||
|
||||
using (StreamWriter w = File.AppendText(logFileName))
|
||||
{
|
||||
w.WriteLine($"[{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}]Controller:" + (modelData.NamespaceObject == null ? ("配置文件不存在【TemplateType、Assembly】" + Path.GetFileNameWithoutExtension(assembly.Location)) : modelData.NamespaceObject.OutFilePath));
|
||||
}
|
||||
|
||||
if (modelData.NamespaceObject == null) continue;
|
||||
|
||||
outputFileName = Path.Combine(modelData.NamespaceObject.OutFilePath, item.ClassName.Replace("Service", "") + modelData.NamespaceObject.FileNameSuffix);
|
||||
|
||||
using (StreamWriter w = File.AppendText(logFileName))
|
||||
{
|
||||
w.WriteLine($"[{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}]Controller:" + (string.IsNullOrEmpty(outputFileName) ? "空文件" : outputFileName));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(outputFileName)) continue;
|
||||
|
||||
template = File.ReadAllText(Path.Combine(toolInitConfig.TemplatePath, modelData.NamespaceObject.TemplateFileName));
|
||||
if (string.IsNullOrEmpty(template)) continue;
|
||||
|
||||
outputText = RazorEngineHelper.CompiledTemplate(template, modelData);
|
||||
if (string.IsNullOrEmpty(outputText)) continue;
|
||||
|
||||
if (!Directory.Exists(Path.GetDirectoryName(outputFileName))) Directory.CreateDirectory(Path.GetDirectoryName(outputFileName));
|
||||
|
||||
File.WriteAllText(outputFileName, outputText);
|
||||
|
||||
|
||||
if (!Directory.Exists(Path.GetDirectoryName(logFileName))) Directory.CreateDirectory(Path.GetDirectoryName(logFileName));
|
||||
using (StreamWriter w = File.AppendText(logFileName))
|
||||
{
|
||||
w.WriteLine($"[{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}]Succeed:" + outputFileName);
|
||||
}
|
||||
//================================CloudBuilder.Security.Service >.Security
|
||||
modelData.NamespaceObject = toolInitConfig.NamespaceObjects.Where(x => x.TemplateType == "Request" &&
|
||||
Path.GetFileNameWithoutExtension(assembly.Location).Contains(x.Namespace.Replace(x.Assembly, ""))).FirstOrDefault();
|
||||
if (modelData.NamespaceObject == null) continue;
|
||||
|
||||
outputFileName = Path.Combine(modelData.NamespaceObject.OutFilePath, item.ClassName.Replace("Service", "") + modelData.NamespaceObject.FileNameSuffix);
|
||||
if (string.IsNullOrEmpty(outputFileName)) continue;
|
||||
|
||||
template = File.ReadAllText(Path.Combine(toolInitConfig.TemplatePath, modelData.NamespaceObject.TemplateFileName));
|
||||
if (string.IsNullOrEmpty(template)) continue;
|
||||
|
||||
outputText = RazorEngineHelper.CompiledTemplate(template, modelData);
|
||||
if (string.IsNullOrEmpty(outputText)) continue;
|
||||
|
||||
if (!Directory.Exists(Path.GetDirectoryName(outputFileName))) Directory.CreateDirectory(Path.GetDirectoryName(outputFileName));
|
||||
|
||||
File.WriteAllText(outputFileName, outputText);
|
||||
|
||||
|
||||
if (!Directory.Exists(Path.GetDirectoryName(logFileName))) Directory.CreateDirectory(Path.GetDirectoryName(logFileName));
|
||||
using (StreamWriter w = File.AppendText(logFileName))
|
||||
{
|
||||
w.WriteLine($"[{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}]Succeed:" + outputFileName);
|
||||
}
|
||||
//================================
|
||||
modelData.NamespaceObject = toolInitConfig.NamespaceObjects.Where(x => x.TemplateType == "TypeScriptService" && x.Assembly == Path.GetFileNameWithoutExtension(assembly.Location)).FirstOrDefault();
|
||||
if (modelData.NamespaceObject == null) continue;
|
||||
|
||||
outputFileName = Path.Combine(modelData.NamespaceObject.OutFilePath, item.ClassName.StringToProtectedProerty() + modelData.NamespaceObject.FileNameSuffix);
|
||||
if (string.IsNullOrEmpty(outputFileName)) continue;
|
||||
|
||||
template = File.ReadAllText(Path.Combine(toolInitConfig.TemplatePath, modelData.NamespaceObject.TemplateFileName));
|
||||
if (string.IsNullOrEmpty(template)) continue;
|
||||
|
||||
outputText = RazorEngineHelper.CompiledTemplate(template, modelData);
|
||||
if (string.IsNullOrEmpty(outputText)) continue;
|
||||
|
||||
if (!Directory.Exists(Path.GetDirectoryName(outputFileName))) Directory.CreateDirectory(Path.GetDirectoryName(outputFileName));
|
||||
|
||||
File.WriteAllText(outputFileName, outputText);
|
||||
|
||||
|
||||
if (!Directory.Exists(Path.GetDirectoryName(logFileName))) Directory.CreateDirectory(Path.GetDirectoryName(logFileName));
|
||||
using (StreamWriter w = File.AppendText(logFileName))
|
||||
{
|
||||
w.WriteLine($"[{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}]Succeed:" + outputFileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string logFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log\\log.txt");
|
||||
if (!Directory.Exists(Path.GetDirectoryName(logFileName))) Directory.CreateDirectory(Path.GetDirectoryName(logFileName));
|
||||
using (StreamWriter w = File.AppendText(logFileName))
|
||||
{
|
||||
w.WriteLine($"[{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}]Exception:" + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"profiles": {
|
||||
"CodeGenerator": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "D:\\Docker\\CloudBuilder\\CloudBuilder.Security.Service\\bin\\Debug\\net8.0\\CloudBuilder.Security.Service.dll"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"CloudBuilder": {
|
||||
"DbContexts": {
|
||||
"MasterDbContext": {
|
||||
"DbContextTypeName": "MasterDbContext",
|
||||
"ConnectionString": "Server=localhost\\SQLEXPRESS;Database=Furion;User=sa;Password=owen123456;MultipleActiveResultSets=True;TrustServerCertificate=true",
|
||||
"DatabaseType": "SqlServer",
|
||||
"LazyLoadingProxiesEnabled": true,
|
||||
"AuditEntityEnabled": true,
|
||||
"AutoMigrationEnabled": true
|
||||
},
|
||||
"SecondaryDbContext": {
|
||||
"DbContextTypeName": "SecondaryDbContext",
|
||||
"ConnectionString": "Server=localhost\\SQLEXPRESS;Database=Furion_dev;User=sa;Password=owen123456;MultipleActiveResultSets=True;TrustServerCertificate=true",
|
||||
"DatabaseType": "SqlServer",
|
||||
"LazyLoadingProxiesEnabled": true,
|
||||
"AuditEntityEnabled": true,
|
||||
"AutoMigrationEnabled": true
|
||||
}
|
||||
},
|
||||
"MailSender": {
|
||||
"Host": "smtp.mxhichina.com",
|
||||
"Port": 587,
|
||||
"EnableSsl": true,
|
||||
"DisplayName": "OSharp邮件发送",
|
||||
"UserName": "osharpsender@66soft.net",
|
||||
"Password": "OSharp147963"
|
||||
},
|
||||
"Jwt": {
|
||||
"Issuer": "Cloud Builder identity",
|
||||
"Audience": "Cloud Builder",
|
||||
"Secret": "{8619F7C3-B53C-4B85-99F0-983D351ECD82}",
|
||||
"AccessExpireMins": 1440, //1天过期
|
||||
"RefreshExpireMins": 10080, // 7天
|
||||
"IsRefreshAbsoluteExpired": false
|
||||
},
|
||||
"Redis": {
|
||||
"Configuration": "localhost",
|
||||
"InstanceName": "CloudBuilder:"
|
||||
}
|
||||
},
|
||||
"IpRateLimiting": {
|
||||
"EnableEndpointRateLimiting": true, //False: globally executed, true: executed for each
|
||||
"StackBlockedRequests": false, //False: Number of rejections should be recorded on another counter
|
||||
"RealIpHeader": "X-Real-IP",
|
||||
"ClientIdHeader": "X-ClientId",
|
||||
"IpWhitelist": [], //白名单
|
||||
"EndpointWhitelist": [],
|
||||
"ClientWhitelist": [],
|
||||
"HttpStatusCode": 200,
|
||||
"QuotaExceededResponse": {
|
||||
"Content": "{{\"code\":429,\"msg\":\"访问过于频繁,请稍后重试\",\"data\":null}}",
|
||||
"ContentType": "application/json",
|
||||
"StatusCode": 200
|
||||
},
|
||||
"GeneralRules": [
|
||||
{
|
||||
"Endpoint": "*",
|
||||
"Period": "1s",
|
||||
"Limit": 5
|
||||
},
|
||||
{
|
||||
"Endpoint": "*",
|
||||
"Period": "1m",
|
||||
"Limit": 50
|
||||
},
|
||||
{
|
||||
"Endpoint": "*",
|
||||
"Period": "12h",
|
||||
"Limit": 500
|
||||
}
|
||||
]
|
||||
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
Reference in new issue
Block a user