Archer.Extension
1.1.5
dotnet add package Archer.Extension --version 1.1.5
NuGet\Install-Package Archer.Extension -Version 1.1.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Archer.Extension" Version="1.1.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Archer.Extension" Version="1.1.5" />
<PackageReference Include="Archer.Extension" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Archer.Extension --version 1.1.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Archer.Extension, 1.1.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Archer.Extension@1.1.5
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Archer.Extension&version=1.1.5
#tool nuget:?package=Archer.Extension&version=1.1.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Archer.Extension
NUGET package | UITC每個專案都會用的方法獨立出來放這
.Net version
.NET Standard 2.0
Using
using Archer.Extension
Security helper
an encrypting and decryting helper
| function name | paramter type | return type |
|---|---|---|
| EncryptConn | string | string |
| DecryptConn | string | string |
| GetMd5Hash | string | string |
| GetSha256Hash | string | byte[] |
example:
string _keyConn = "keyConn";
string _ivConn = "ivConn";
string _keyData = "keyData";
string _ivData = "ivData";
SecurityHelper helper = new SecurityHelper(_keyConn, _ivConn, _keyData, _ivData);
string connectionString = "connection string";
string encryptedConnectionString = helper.EncryptConn(connectionString);
string decryptedConnectionString = helper.DecryptConn(encryptedConnectionString);
JwtHelper
| function name | paramter type | return type | description |
|---|---|---|---|
| GenerateToken | object | Exception? | Generate token by token model |
| ValidateToken | string | bool | validate token |
DatabaseHelper
| function name | paramter type | return type | description |
|---|---|---|---|
| CreateConnectionBy | string, DatabaseTypeEnum | IDbConnection | create IDbConnection by connection string |
WatermarkHelper
命名空間: Archer.Extension.Images
| function name | description |
|---|---|
| AddWatermarkToImages | 給圖片增加浮水印 |
| RemoveWatermark | [實驗性功能] 移除浮水印 |
給圖片增加浮水印
using Archer.Extension.Images;
string base64Image = string.Empty;
using (FileStream fs = new FileStream(@"D:\暫時\IMG_0123.jpg", FileMode.Open, FileAccess.Read))
{
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
base64Image = Convert.ToBase64String(buffer);
}
WatermarkHelper watermarkHelper = new WatermarkHelper();
string[] watermarkImages = watermarkHelper.AddWatermarkToImages(new string[] { base64Image },
"想按摩師傅的小腿肚,嘿嘿嘿",
new Font(FontFamily.GenericSerif, 50, FontStyle.Bold, GraphicsUnit.Pixel),
Color.FromArgb(127, 0, 153, 153),
WatermarkPosition.MiddleCenter);
移除浮水印
// 浮水印顏色
Color watermarkColor = Color.FromArgb(127, 0, 153, 153);
// 顏色相似度閾值
int threshold = 100;
string removedResult = watermarkHelper.RemoveWatermark(watermarkImages[0], watermarkColor, threshold);
byte[] buffer2 = Convert.FromBase64String(removedResult);
using (FileStream fs2 = new FileStream($@"D:\暫時\IMG_0123_watermarked_removedResult.jpg", FileMode.Create, FileAccess.Write))
{
fs2.Write(buffer2, 0, buffer2.Length);
}
Extension method
Some useful extension method
| function name | paramter type | return type |
|---|---|---|
| ThrowIfNull | object | Exception? |
| GetDescription | Enum | string |
example:
users.ThrowIfNull(nameof(users));
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.AspNetCore.Http (>= 2.2.2)
- Microsoft.Data.SqlClient (>= 5.2.0)
- Microsoft.Data.Sqlite.Core (>= 7.0.8)
- Microsoft.Extensions.Configuration.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 7.0.4)
- Microsoft.IdentityModel.Tokens (>= 7.5.1)
- Portable.BouncyCastle (>= 1.9.0)
- System.Drawing.Common (>= 8.0.7)
- System.IdentityModel.Tokens.Jwt (>= 7.5.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Archer.Extension:
| Package | Downloads |
|---|---|
|
Archer.Repository
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.5 | 327 | 3/11/2025 |
| 1.1.4 | 162 | 2/11/2025 |
| 1.1.3 | 160 | 2/11/2025 |
| 1.1.2 | 161 | 2/11/2025 |
| 1.1.1 | 237 | 8/7/2024 |
| 1.1.0 | 163 | 7/30/2024 |
| 1.0.9 | 1,025 | 4/23/2024 |
| 1.0.8 | 200 | 4/23/2024 |
| 1.0.7 | 530 | 7/5/2023 |
| 1.0.6 | 480 | 7/5/2023 |
| 1.0.5 | 499 | 7/5/2023 |
| 1.0.4 | 506 | 4/27/2023 |
| 1.0.3 | 596 | 4/25/2023 |
| 1.0.2 | 1,222 | 4/25/2023 |
| 1.0.1 | 1,107 | 4/25/2023 |
| 1.0.0 | 591 | 8/26/2022 |