From 4ded6f7e9936cefb344fe22b683cecdf9f5df13c Mon Sep 17 00:00:00 2001 From: LionelZhao Date: Tue, 26 Sep 2023 10:30:03 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=E4=BF=AE=E6=AD=A3=E5=87=A0?= =?UTF-8?q?=E4=B8=AA=E6=98=BE=E8=91=97=E7=9A=84=E6=8B=BC=E5=86=99=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Lazy.Captcha.Core/CaptchaOptions.cs | 2 +- Lazy.Captcha.Core/CaptchaService.cs | 4 ++-- Lazy.Captcha.Core/CaptchaServiceBuilder.cs | 6 +++--- Lazy.Captcha.Core/CaptchaServiceCollectionExtensions.cs | 6 +++--- Lazy.Captcha.Core/Storage/DefaultStorage.cs | 2 +- Lazy.Captcha.Core/Storage/MemeoryStorage.cs | 4 ++-- Sample.NetCore/Program.cs | 2 +- Sample.NetCore/appsettings.json | 2 +- Sample.Winfrom/MainForm.cs | 2 +- Sample.Winfrom/Models/CaptchaOptionsJsonModel.cs | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Lazy.Captcha.Core/CaptchaOptions.cs b/Lazy.Captcha.Core/CaptchaOptions.cs index fd93a85..0d67953 100644 --- a/Lazy.Captcha.Core/CaptchaOptions.cs +++ b/Lazy.Captcha.Core/CaptchaOptions.cs @@ -52,7 +52,7 @@ namespace Lazy.Captcha.Core /// /// 存储键前缀 /// - public virtual string StoreageKeyPrefix { get; set; } + public virtual string StorageKeyPrefix { get; set; } /// /// 图片选项 diff --git a/Lazy.Captcha.Core/CaptchaService.cs b/Lazy.Captcha.Core/CaptchaService.cs index 607d73d..7701ead 100644 --- a/Lazy.Captcha.Core/CaptchaService.cs +++ b/Lazy.Captcha.Core/CaptchaService.cs @@ -29,7 +29,7 @@ namespace Lazy.Captcha.Core public virtual CaptchaData Generate(string captchaId, int? expirySeconds = null) { var _captchaCodeGenerator = GetCodeGenerator(); - var _captchaImageGenerator = GetImmageGenerator(); + var _captchaImageGenerator = GetImageGenerator(); var (renderText, code) = _captchaCodeGenerator.Generate(CaptchaOptions.CodeLength); var image = _captchaImageGenerator.Generate(renderText, CaptchaOptions.ImageOption); @@ -39,7 +39,7 @@ namespace Lazy.Captcha.Core return new CaptchaData(captchaId, code, image); } - protected virtual ICaptchaImageGenerator GetImmageGenerator() + protected virtual ICaptchaImageGenerator GetImageGenerator() { return new DefaultCaptchaImageGenerator(); } diff --git a/Lazy.Captcha.Core/CaptchaServiceBuilder.cs b/Lazy.Captcha.Core/CaptchaServiceBuilder.cs index 82b610a..32a0ad2 100644 --- a/Lazy.Captcha.Core/CaptchaServiceBuilder.cs +++ b/Lazy.Captcha.Core/CaptchaServiceBuilder.cs @@ -97,11 +97,11 @@ namespace Lazy.Captcha.Core /// /// 存储键前缀 /// - /// + /// /// - public CaptchaServiceBuilder StoreageKeyPrefix(string storeageKeyPrefix) + public CaptchaServiceBuilder StorageKeyPrefix(string storageKeyPrefix) { - CaptchaOptions.StoreageKeyPrefix = storeageKeyPrefix; + CaptchaOptions.StorageKeyPrefix = storageKeyPrefix; return this; } diff --git a/Lazy.Captcha.Core/CaptchaServiceCollectionExtensions.cs b/Lazy.Captcha.Core/CaptchaServiceCollectionExtensions.cs index b164e63..24d444d 100644 --- a/Lazy.Captcha.Core/CaptchaServiceCollectionExtensions.cs +++ b/Lazy.Captcha.Core/CaptchaServiceCollectionExtensions.cs @@ -46,10 +46,10 @@ namespace Microsoft.Extensions.DependencyInjection } } - var foregroudColors = configuration?.GetSection("CaptchaOptions:ImageOption:ForegroundColors")?.Value; - if (!string.IsNullOrWhiteSpace(foregroudColors)) + var foregroundColors = configuration?.GetSection("CaptchaOptions:ImageOption:ForegroundColors")?.Value; + if (!string.IsNullOrWhiteSpace(foregroundColors)) { - var colors = foregroudColors.Split(',').ToList().Where(e => !string.IsNullOrEmpty(e)); + var colors = foregroundColors.Split(',').ToList().Where(e => !string.IsNullOrEmpty(e)); foreach (var item in colors) { if (SKColor.TryParse(item, out var color)) diff --git a/Lazy.Captcha.Core/Storage/DefaultStorage.cs b/Lazy.Captcha.Core/Storage/DefaultStorage.cs index f93d0f7..32a19aa 100644 --- a/Lazy.Captcha.Core/Storage/DefaultStorage.cs +++ b/Lazy.Captcha.Core/Storage/DefaultStorage.cs @@ -18,7 +18,7 @@ namespace Lazy.Captcha.Core.Storeage private string WrapKey(string key) { - return $"{this._options.CurrentValue.StoreageKeyPrefix}{key}"; + return $"{this._options.CurrentValue.StorageKeyPrefix}{key}"; } public string Get(string key) diff --git a/Lazy.Captcha.Core/Storage/MemeoryStorage.cs b/Lazy.Captcha.Core/Storage/MemeoryStorage.cs index 6c84cb7..ed0ca51 100644 --- a/Lazy.Captcha.Core/Storage/MemeoryStorage.cs +++ b/Lazy.Captcha.Core/Storage/MemeoryStorage.cs @@ -8,7 +8,7 @@ namespace Lazy.Captcha.Core.Storage public class MemeoryStorage : IStorage { private MemoryCache Cache; - public string StoreageKeyPrefix { get; set; } = string.Empty; + public string StorageKeyPrefix { get; set; } = string.Empty; public MemeoryStorage() { @@ -17,7 +17,7 @@ namespace Lazy.Captcha.Core.Storage private string WrapKey(string key) { - return $"{StoreageKeyPrefix}{key}"; + return $"{StorageKeyPrefix}{key}"; } public string Get(string key) diff --git a/Sample.NetCore/Program.cs b/Sample.NetCore/Program.cs index c39af57..a1145ea 100644 --- a/Sample.NetCore/Program.cs +++ b/Sample.NetCore/Program.cs @@ -42,7 +42,7 @@ builder.Services.AddCaptcha(builder.Configuration, options => // option.CodeLength = 6; // ֤볤, ҪCaptchaTypeú. Ϊʽʱȴĸ // option.ExpirySeconds = 30; // ֤ʱ // option.IgnoreCase = true; // ȽʱǷԴСд -// option.StoreageKeyPrefix = ""; // 洢ǰ׺ +// option.StorageKeyPrefix = ""; // 洢ǰ׺ // option.ImageOption.Animation = true; // Ƿö // option.ImageOption.FrameDelay = 30; // ÿ֡ӳ,Animation=trueʱЧ, Ĭ30 diff --git a/Sample.NetCore/appsettings.json b/Sample.NetCore/appsettings.json index 0abe4c1..126d270 100644 --- a/Sample.NetCore/appsettings.json +++ b/Sample.NetCore/appsettings.json @@ -7,7 +7,7 @@ "CodeLength": 2, "ExpirySeconds": 60, "IgnoreCase": true, - "StoreageKeyPrefix": "", + "StorageKeyPrefix": "", "ImageOption": { "Animation": false, "BackgroundColor": null, diff --git a/Sample.Winfrom/MainForm.cs b/Sample.Winfrom/MainForm.cs index fea40ab..74e41af 100644 --- a/Sample.Winfrom/MainForm.cs +++ b/Sample.Winfrom/MainForm.cs @@ -101,7 +101,7 @@ namespace Sample.Winfrom CodeLength = (int)this.Length_Nud.Value, ExpirySeconds = 60, IgnoreCase = true, - StoreageKeyPrefix = "", + StorageKeyPrefix = "", ImageOption = new CaptchaImageGeneratorOptionJsonModel { Animation = this.Gif_Cbx.Checked, diff --git a/Sample.Winfrom/Models/CaptchaOptionsJsonModel.cs b/Sample.Winfrom/Models/CaptchaOptionsJsonModel.cs index b682592..af33158 100644 --- a/Sample.Winfrom/Models/CaptchaOptionsJsonModel.cs +++ b/Sample.Winfrom/Models/CaptchaOptionsJsonModel.cs @@ -34,7 +34,7 @@ namespace Sample.Winfrom.Models /// /// 存储键前缀 /// - public string StoreageKeyPrefix { get; set; } + public string StorageKeyPrefix { get; set; } /// /// 图片选项 -- Gitee