ImageMagick 是一个强大的图像处理库,支持100多种主要的文件格式(不包括子格式)。使用 Magick.NET,你可以在 c #/vb.net/. net Core 应用程序中使用 ImageMagick,而无需在服务器或桌面上安装 ImageMagick。 项目地址:https://github.com/dlemstra/Magick.NET 笔者推荐的原因除了其跨平台、开源,还要我其 API 简单好用。 nuget 搜索 ImageMagick 即可引用。 using ImageMagick; usi…

2023年10月17日 0条评论 3071点热度 0人点赞 痴者工良 阅读全文

Maomi.Mapper Project address: https://github.com/whuanle/Maomi.Mapper Note: This project is for educational purposes only and has poor performance; do not use it in production environments. MaomiMapper is a framework that constructs object member mappings usin…

2023年10月15日 0条评论 1274点热度 0人点赞 痴者工良 阅读全文

Maomi.Mapper 项目地址:https://github.com/whuanle/Maomi.Mapper 注:本项目用于教学目的,性能较差,请勿用于生产环境。 MaomiMapper 是一个使用表达式树构造生成对象成员映射的框架,即对象映射框架。 虽然 MaomiMapper 性能不啥样,但是代码注释也写得很齐全,适合读者研究反射、表达式树、类型转换等代码。 MaomiMapper 与 AutoMapper 对比: Method Mean Error StdDev Gen0 Allocated ASAut…

2023年10月15日 0条评论 2728点热度 0人点赞 痴者工良 阅读全文

System.IO.Compression is an official release of a decompression toolkit that defaults to using UTF-8 encoding for decompressing files. However, on Windows, encoding can be quite chaotic; if files or directories have Chinese names, decompressed results may be g…

2023年10月12日 0条评论 3772点热度 0人点赞 痴者工良 阅读全文

System.IO.Compression 是官方发布的一个由于解压缩的工具包,默认使用 utf8 编码解压缩文件。 但是在 Windows 上,编码比较混乱,如果文件或目录是中文名称,那么解压后会出现乱码,即使压缩包都是 UTF8 编码,.NET 解压也会出现乱码问题,所以需要使用 GB2312 编码解压。 但是 .NET 中默认是不包含 GB2312 编码的。 笔者说的不一定对,可能跟压缩文件也有关,总之, .NET 默认不支持 GB2312 编码,导致解压后中文文件名称乱码。 首先引入 System.Text…

2023年10月12日 0条评论 4518点热度 0人点赞 痴者工良 阅读全文

C# Writing a SignalR Client Requires Manual Injection of Client Methods: connection.On<string, string>("ReceiveMessage", (user, message) => { this.Dispatcher.Invoke(() => { var newMessage = $"{user}[......]继续阅读

2023年9月25日 1条评论 3204点热度 3人点赞 痴者工良 阅读全文

C# 编写 SignalR 客户端时需要手动注入客户端方法: connection.On<string, string>("ReceiveMessage", (user, message) => { this.Dispatcher.Invoke(() => { var newMessage = $"{user}: {message}"; messagesList.Items.Add(n[......]继续阅读

2023年9月25日 1条评论 3540点热度 3人点赞 痴者工良 阅读全文

The source code has been studied for a long time, and its operating mechanism has been discovered. If the page that BlazorWebView navigates to is not https://0.0.0.0, then it will open the page in a browser outside the client. // The URLs here are allowed to b…

2023年9月21日 0条评论 1098点热度 0人点赞 痴者工良 阅读全文

研究了很久源码,发现了其运行机制。 如果 BlazorWebView 跳转的页面不是 https://0.0.0.0 ,那么就会使用客户端之外的浏览器打开页面。 // 这里的地址允许在浏览器中打开 public static readonly Uri[] URLS = new Uri[] { new Uri("https://open.feishu.cn") }; this.webView.BlazorWebViewInitializing += (s, e) =>[......]继续阅读

2023年9月21日 0条评论 5496点热度 0人点赞 痴者工良 阅读全文

Model Class: public class Test { [JsonConverter(typeof(string))] public int Value { get; set; } } API Interface: [HttpPost("aaa")] public string AAA([FromBody] Test test) { return "11111111111"; } However, Swagger still displays the type as…

2023年9月19日 0条评论 1206点热度 0人点赞 痴者工良 阅读全文

模型类: public class Test { [JsonConverter(typeof(string))] public int Value { get; set; } } API 接口: [HttpPost("aaa")] public string AAA([FromBody] Test test) { return "11111111111"; } 但是 Swagger 还是显示 int 类型,没有跟着 json 配置而变化。 所以我们需要[......] 继续阅读

2023年9月19日 1条评论 3327点热度 0人点赞 痴者工良 阅读全文

using System; using System.Runtime.CompilerServices; using System.Threading.Tasks; async Task Main() { Task<int> task = CreateTask(); int result = await task; } Task<int> CreateTask() { // Create an asynchronous task method builder AsyncTaskMethodB…

2023年9月19日 0条评论 1203点热度 0人点赞 痴者工良 阅读全文

using System; using System.Runtime.CompilerServices; using System.Threading.Tasks; async Task Main() { Task<int> task = CreateTask(); int result = await task; } Task<int> CreateTask() { // 创建一个异步任务方法构建器 AsyncTaskMethodBuilder<int> builder = A…

2023年9月19日 0条评论 2754点热度 0人点赞 痴者工良 阅读全文

By default, WebView2 displays in English, including in places like the console and print interface. However, it can be modified to use the local language. public static void SetWebviewLanguage(string language = "zh-CN") { var cultureInfo = new Cultur…

2023年9月14日 0条评论 1262点热度 0人点赞 痴者工良 阅读全文

默认 webview2 使用英文语言显示,包括控制台、打印台等地方,都是英文提示,因此可以修改为本地语言。 public static void SetWebviewLanguage(string language = "zh-CN") { var cultureInfo = new CultureInfo(language); // 设置程序使用的语言,可以忽略。 CultureInfo.CurrentCulture = cultureInfo; CultureIn[......]继续阅读

2023年9月14日 0条评论 3407点热度 0人点赞 痴者工良 阅读全文

Default WebView2 will be installed in the system directory, which may lead to insufficient permissions when the program starts, preventing the use of WebView2, and can also cause storage directory conflicts between multiple versions of the program. Therefore, …

2023年9月14日 0条评论 1212点热度 0人点赞 痴者工良 阅读全文

默认 Webview2 会被安装到系统目录,可能会导致程序启动时权限不足,无法使用 Webview2,以及多版本程序之间发生存储目录冲突。 因此需要自定义设置 Webview2 目录,最好就存储在程序安装目录下。 首先修改 App.xaml 文件,添加一行: <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ui:ThemesDictionary The…

2023年9月14日 0条评论 4297点热度 0人点赞 痴者工良 阅读全文

Deploy Apollo and create an application. Then create a namespace, select private to create a private namespace, and choose the json format. Click modify text and fill in the json content. Next, reference the package in the .NET program <PackageReference Inc…

2023年9月11日 0条评论 1026点热度 0人点赞 痴者工良 阅读全文

部署 Apollo 之后,创建一个应用。 然后创建命名空间,选择 private 创建私有命名空间,选择 json 格式。 点击修改文本,填入 json 内容。 然后在 .NET 程序中引入包 <PackageReference Include="Com.Ctrip.Framework.Apollo.Configuration" Version="2.10.2" /> 在配置文件中定义 apollo 的设置。 { "apollo": { "AppId": "ApolloTest", "MetaServe…

2023年9月11日 0条评论 2722点热度 0人点赞 痴者工良 阅读全文

First is the middleware, which determines which groups to display when there is time. All APIs can be obtained from the IApiDescriptionGroupCollectionProvider service, and then identified through APIs to check for groups. if (context.HostingEnvironment.IsDevel…

2023年8月15日 0条评论 1376点热度 2人点赞 痴者工良 阅读全文
15678954