diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/CliService.cs b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/CliService.cs index ede610e9..5d780b52 100644 --- a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/CliService.cs +++ b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/CliService.cs @@ -20,7 +20,7 @@ public class CliService : DomainService public async Task RunAsync(string[] args) { - AnsiConsole.MarkupLine("[green]ABP Pro CLI (http://doc.cncore.club/)[/]"); + AnsiConsole.MarkupLine("[green]ABP Pro CLI (http://docs.chengzhi.online/)[/]"); AnsiConsole.MarkupLine("[green]请输入lion.abp help 查看所有命令[/]"); try { diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Commands/CreateCommand.cs b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Commands/CreateCommand.cs index 5aa1951c..7511e375 100644 --- a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Commands/CreateCommand.cs +++ b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Commands/CreateCommand.cs @@ -128,7 +128,8 @@ public class CreateCommand : IConsoleCommand, ITransientDependency projectName, string.Empty, templateOptions.ReplaceSuffix, - version); + version, + true); _logger.LogInformation($"创建模板成功,请查阅----->: {output}"); diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Commands/NewCommand.cs b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Commands/NewCommand.cs index c484621e..389bfccb 100644 --- a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Commands/NewCommand.cs +++ b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Commands/NewCommand.cs @@ -139,7 +139,8 @@ public class NewCommand : IConsoleCommand, ITransientDependency projectName, moduleName, templateOptions.ReplaceSuffix, - version); + version, + false); _logger.LogInformation($"创建模板成功,请查阅----->: {output}"); diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Utils/ReplaceHelper.cs b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Utils/ReplaceHelper.cs index 78e25a02..d8ad5b7b 100644 --- a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Utils/ReplaceHelper.cs +++ b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Utils/ReplaceHelper.cs @@ -11,11 +11,12 @@ public static class ReplaceHelper string projectName, string moduleName, string replaceSuffix, - string version) + string version, + bool vben5) { try { - RenameTemplate(sourcePath, oldCompanyName, oldProjectName, oldModuleName, companyName, projectName, moduleName, replaceSuffix, version); + RenameTemplate(sourcePath, oldCompanyName, oldProjectName, oldModuleName, companyName, projectName, moduleName, replaceSuffix, version, vben5); } catch (Exception ex) { @@ -32,10 +33,11 @@ public static class ReplaceHelper string projectName, string moduleName, string replaceSuffix, - string version) + string version, + bool vben5) { - RenameAllDirectories(sourcePath, oldCompanyName, oldProjectName, oldModuleName, companyName, projectName, moduleName, version); - RenameAllFileNameAndContent(sourcePath, oldCompanyName, oldProjectName, oldModuleName, companyName, projectName, moduleName, replaceSuffix, version); + RenameAllDirectories(sourcePath, oldCompanyName, oldProjectName, oldModuleName, companyName, projectName, moduleName, version, vben5); + RenameAllFileNameAndContent(sourcePath, oldCompanyName, oldProjectName, oldModuleName, companyName, projectName, moduleName, replaceSuffix, version, vben5); } private static void RenameAllDirectories( @@ -46,12 +48,13 @@ public static class ReplaceHelper string companyName, string projectName, string moduleName, - string version) + string version, + bool vben5) { var directories = Directory.GetDirectories(sourcePath); foreach (var subDirectory in directories) { - RenameAllDirectories(subDirectory, oldCompanyName, oldProjectName, oldModuleName, companyName, projectName, moduleName, version); + RenameAllDirectories(subDirectory, oldCompanyName, oldProjectName, oldModuleName, companyName, projectName, moduleName, version, vben5); var directoryInfo = new DirectoryInfo(subDirectory); if (directoryInfo.Name.Contains(oldCompanyName) || @@ -59,7 +62,7 @@ public static class ReplaceHelper directoryInfo.Name.Contains(oldModuleName)) { var oldDirectoryName = directoryInfo.Name; - var newDirectoryName = oldDirectoryName.CustomReplace(oldCompanyName, oldProjectName, oldModuleName, companyName, projectName, moduleName, version); + var newDirectoryName = oldDirectoryName.CustomReplace(oldCompanyName, oldProjectName, oldModuleName, companyName, projectName, moduleName, version, vben5); var newDirectoryPath = Path.Combine(directoryInfo.Parent?.FullName, newDirectoryName); @@ -81,7 +84,8 @@ public static class ReplaceHelper string projectName, string moduleName, string replaceSuffix, - string version) + string version, + bool vben5) { var list = new DirectoryInfo(sourcePath) .GetFiles() @@ -93,7 +97,7 @@ public static class ReplaceHelper { // 改文件内容 var oldContents = File.ReadAllText(fileInfo.FullName, encoding); - var newContents = oldContents.CustomReplace(oldCompanyName, oldProjectName, oldModuleName, companyName, projectName, moduleName, version); + var newContents = oldContents.CustomReplace(oldCompanyName, oldProjectName, oldModuleName, companyName, projectName, moduleName, version, vben5); // 文件名包含模板关键字 if (fileInfo.Name.Contains(oldCompanyName) @@ -101,7 +105,7 @@ public static class ReplaceHelper || fileInfo.Name.Contains(oldModuleName)) { var oldFileName = fileInfo.Name; - var newFileName = oldFileName.CustomReplace(oldCompanyName, oldProjectName, oldModuleName, companyName, projectName, moduleName, version); + var newFileName = oldFileName.CustomReplace(oldCompanyName, oldProjectName, oldModuleName, companyName, projectName, moduleName, version, vben5); var newFilePath = Path.Combine(fileInfo.DirectoryName, newFileName); // 无变化才重命名 @@ -118,7 +122,7 @@ public static class ReplaceHelper foreach (var subDirectory in Directory.GetDirectories(sourcePath)) { - RenameAllFileNameAndContent(subDirectory, oldCompanyName, oldProjectName, oldModuleName, companyName, projectName, moduleName, replaceSuffix, version); + RenameAllFileNameAndContent(subDirectory, oldCompanyName, oldProjectName, oldModuleName, companyName, projectName, moduleName, replaceSuffix, version, vben5); } } @@ -131,15 +135,38 @@ public static class ReplaceHelper string companyName, string projectName, string moduleName, - string version) + string version, + bool vben5) { - var result = content.ReplacePackageReferenceBasicManagement() - .ReplacePackageReferenceLanguageManagement() - .ReplacePackageReferenceFileManagement() - .ReplacePackageReferenceDataDictionaryManagement() - .ReplacePackageReferenceNotificationManagement() - .ReplacePackageReferenceCore() - .ReplaceLionPackageVersion(version); + string result; + if (!vben5) + { + result = content.ReplacePackageReferenceBasicManagement() + .ReplacePackageReferenceLanguageManagement() + .ReplacePackageReferenceFileManagement() + .ReplacePackageReferenceDataDictionaryManagement() + .ReplacePackageReferenceNotificationManagement() + .ReplacePackageReferenceCore() + .ReplaceLionPackageVersion(version); + } + else + { + result = content.Vben5ReplacePackageReferenceBasicManagement() + .Vben5ReplacePackageReferenceLanguageManagement() + .Vben5ReplacePackageReferenceFileManagement() + .Vben5ReplacePackageReferenceDataDictionaryManagement() + .Vben5ReplacePackageReferenceNotificationManagement() + .Vben5ReplacePackageReferenceCodeManagement() + .Vben5ReplacePackageReferenceTemplateManagement() + .Vben5ReplacePackageReferenceFileManagement() + .Vben5ReplacePackageReferenceImportExportManagement() + .Vben5ReplacePackageReferenceDynamicMenuManagement() + .Vben5ReplacePackageReferenceCacheManagement() + .Vben5ReplacePackageReferenceMasterDataManagement() + .Vben5ReplacePackageReferenceCore() + .Vben5ReplaceLionPackageVersion(version); + } + if (oldModuleName.IsNullOrWhiteSpace() || oldModuleName.IsNullOrWhiteSpace()) { diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Utils/ReplacePackageReferenceExtensions.cs b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Utils/ReplacePackageReferenceExtensions.cs index 4a273acb..9ea5df32 100644 --- a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Utils/ReplacePackageReferenceExtensions.cs +++ b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Utils/ReplacePackageReferenceExtensions.cs @@ -1,4 +1,4 @@ -namespace Lion.AbpPro.Cli.Utils; +namespace Lion.AbpPro.Cli.Utils; public static class ReplacePackageReferenceExtensions { @@ -15,8 +15,6 @@ public static class ReplacePackageReferenceExtensions "") .Replace("", "") - .Replace("", - "") ; } @@ -160,7 +158,7 @@ public static class ReplacePackageReferenceExtensions "", ""); } - + public static string ReplaceLionPackageVersion(this string context, string version) { return context.Replace("MyVersion", version); diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Utils/ReplacePackageReferenceVben5Extensions.cs b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Utils/ReplacePackageReferenceVben5Extensions.cs new file mode 100644 index 00000000..d34bcd76 --- /dev/null +++ b/aspnet-core/frameworks/src/Lion.AbpPro.Cli.Core/Lion/AbpPro/Cli/Utils/ReplacePackageReferenceVben5Extensions.cs @@ -0,0 +1,340 @@ +namespace Lion.AbpPro.Cli.Utils; + +public static class ReplacePackageReferenceVben5Extensions +{ + public static string Vben5ReplacePackageReferenceCore(this string content) + { + return content + .Replace("", + "") + .Replace("", + "") + .Replace("", + "") + .Replace("", + "") + .Replace("", + "") + ; + } + + public static string Vben5ReplacePackageReferenceBasicManagement(this string content) + { + return content + .Replace( + "", + "") + .Replace( + "", + "") + .Replace("", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace("", + "") + .Replace( + "", + ""); + } + + public static string Vben5ReplacePackageReferenceDataDictionaryManagement(this string content) + { + return content + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + ""); + } + + public static string Vben5ReplacePackageReferenceFileManagement(this string content) + { + return content + .Replace( + "", + "") + .Replace( + "", + "") + .Replace("", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace("", + "") + .Replace( + "", + ""); + } + + public static string Vben5ReplacePackageReferenceLanguageManagement(this string content) + { + return content + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + ""); + } + + public static string Vben5ReplacePackageReferenceNotificationManagement(this string content) + { + return content + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + ""); + } + + public static string Vben5ReplacePackageReferenceCodeManagement(this string content) + { + return content + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + ""); + } + + public static string Vben5ReplacePackageReferenceTemplateManagement(this string content) + { + return content + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + ""); + } + + public static string Vben5ReplacePackageReferenceDynamicMenuManagement(this string content) + { + return content + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + ""); + } + + public static string Vben5ReplacePackageReferenceImportExportManagement(this string content) + { + return content + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + ""); + } + + public static string Vben5ReplacePackageReferenceCacheManagement(this string content) + { + return content + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + ""); + } + + public static string Vben5ReplacePackageReferenceMasterDataManagement(this string content) + { + return content + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + "") + .Replace( + "", + ""); + } + + public static string Vben5ReplaceLionPackageVersion(this string context, string version) + { + return context.Replace("MyVersion", version); + } +} \ No newline at end of file diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs index 7156dd3b..40dc53aa 100644 --- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs +++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs @@ -1,4 +1,3 @@ -using Lion.AbpPro.Hangfire; using Microsoft.AspNetCore.SignalR.StackExchangeRedis; #pragma warning disable CS0618 // Type or member is obsolete @@ -13,8 +12,8 @@ public static class ServiceCollectionExtensions public static IServiceCollection AddAbpProRedis(this IServiceCollection service, Action configureOptions = null) { var configuration = service.GetConfiguration(); - var redisEnabled = configuration["Redis:IsEnabled"]; - if (!string.IsNullOrEmpty(redisEnabled) && !bool.Parse(redisEnabled)) return service; + var redisEnabled = configuration.GetValue("Redis:IsEnabled"); + if (!redisEnabled) return service; if (configureOptions != null) { @@ -36,8 +35,8 @@ public static class ServiceCollectionExtensions public static IServiceCollection AddAbpProRedisDistributedLocking(this IServiceCollection service) { var configuration = service.GetConfiguration(); - var redisEnabled = configuration["Redis:IsEnabled"]; - if (!string.IsNullOrEmpty(redisEnabled) && !bool.Parse(redisEnabled)) return service; + var redisEnabled = configuration.GetValue("Redis:IsEnabled"); + if (!redisEnabled) return service; var connectionString = configuration.GetValue("Redis:Configuration"); service.AddSingleton(sp => @@ -63,8 +62,8 @@ public static class ServiceCollectionExtensions public static IServiceCollection AddAbpProSignalR(this IServiceCollection service, Action redisOptions = null) { var configuration = service.GetConfiguration(); - var redisEnabled = configuration["Redis:IsEnabled"]; - if (!string.IsNullOrEmpty(redisEnabled) && !bool.Parse(redisEnabled)) + var redisEnabled = configuration.GetValue("Redis:IsEnabled"); + if (redisEnabled) { if (redisOptions != null) { @@ -97,27 +96,27 @@ public static class ServiceCollectionExtensions return service; } - /// - /// 注册cap - /// - public static IServiceCollection AddAbpProCap(this IServiceCollection service) - { - var configuration = service.GetConfiguration(); - service.AddAbpCap(capOptions => - { - capOptions.SetCapDbConnectionString(configuration["ConnectionStrings:Default"]); - capOptions.UseEntityFramework(); - capOptions.UseRabbitMQ(option => - { - option.HostName = configuration.GetValue("Cap:RabbitMq:HostName"); - option.UserName = configuration.GetValue("Cap:RabbitMq:UserName"); - option.Password = configuration.GetValue("Cap:RabbitMq:Password"); - option.Port = configuration.GetValue("Cap:RabbitMq:Port"); - }); - capOptions.UseDashboard(options => { options.AuthorizationPolicy = AbpProCapPermissions.CapManagement.Cap; }); - }); - return service; - } + // /// + // /// 注册cap + // /// + // public static IServiceCollection AddAbpProCap(this IServiceCollection service) + // { + // var configuration = service.GetConfiguration(); + // service.AddAbpCap(capOptions => + // { + // capOptions.SetCapDbConnectionString(configuration["ConnectionStrings:Default"]); + // capOptions.UseEntityFramework(); + // capOptions.UseRabbitMQ(option => + // { + // option.HostName = configuration.GetValue("Cap:RabbitMq:HostName"); + // option.UserName = configuration.GetValue("Cap:RabbitMq:UserName"); + // option.Password = configuration.GetValue("Cap:RabbitMq:Password"); + // option.Port = configuration.GetValue("Cap:RabbitMq:Port"); + // }); + // capOptions.UseDashboard(options => { options.AuthorizationPolicy = AbpProCapPermissions.CapManagement.Cap; }); + // }); + // return service; + // } // /// // /// 注册hangfire