private static void RunPowershellScript(string scriptFile) { ProcessStartInfo ps = new ProcessStartInfo(@"powershell.exe",scriptFile) { RedirectStandardOutput = true }; //ps.CreateNoWindow = true; var proc = Process.Start(ps); proc.OutputDataReceived += (s, e)…

2022年10月9日 0条评论 3266点热度 0人点赞 痴者工良 阅读全文

using System.Resources; var assembly = typeof(Program).Assembly; ResourceManager resourceManager = new ResourceManager("update.Properties.Resources", assembly); var host = resourceManager.GetString("host"); You can retrieve a list of resour…

2022年10月8日 0条评论 2964点热度 0人点赞 痴者工良 阅读全文

using System.Resources; var assembly = typeof(Program).Assembly; ResourceManager resourceManager = new ResourceManager("update.Properties.Resources", assembly); var host = resourceManager.GetString("host"); 可以通过 typeof(Program).Assembly.GetManifestResourceName…

2022年10月8日 0条评论 4702点热度 0人点赞 痴者工良 阅读全文

Project publish parameters: dotnet publish -c Release -r win-x64 -p:PublishProfile=FolderProfile --no-self-contained dotnet publish -c Release -r win-x64 -p:PublishProfile=FolderProfile -p:PublishReadyToRun=true -p:PublishTrimmed=true --self-contained false En…

2022年10月8日 0条评论 2994点热度 2人点赞 痴者工良 阅读全文

项目发布参数: dotnet publish -c Release -r win-x64 -p:PublishProfile=FolderProfile --no-self-contained dotnet publish -c Release -r win-x64 -p:PublishProfile=FolderProfile -p:PublishReadyToRun=true -p:PublishTrimmed=true --self-contained false 开启裁剪: 关闭反射: <IlcDis…

2022年10月8日 0条评论 3824点热度 2人点赞 痴者工良 阅读全文

ASP.NET Core Response.Body is by default an HttpResponseStream, which is characterized by allowing writes only in append mode, and it cannot be read or modified. Therefore, the fundamental method is to replace the HttpResponseStream. You can set up a middlewar…

2022年9月30日 0条评论 10414点热度 0人点赞 痴者工良 阅读全文

ASP.NET Core Response.Body 默认是 HttpResponseStream,其主要特征是只能追加写,不能读取也不能修改。 所以最根本方法是替换 HttpResponseStream。 随便设置一个中间件,或者将 HttpContext 拿出来,定义变量 context。 替换 Body: var responseOriginalBody = context.Response.Body; var memStream = new MemoryStream(); context.Response.…

2022年9月30日 0条评论 4102点热度 0人点赞 痴者工良 阅读全文

When performing unit tests, libraries such as Moq are often used to mock the code. However, in some cases, we want to not only mock methods but also determine if the passed parameters are correct within the mock methods. This is because conventional mocking si…

2022年9月26日 0条评论 1032点热度 0人点赞 痴者工良 阅读全文

做单元测试的时候往往会使用 Moq 等库,对代码进行 Mock。 但是有些过程,我们希望除了 Mock 方法之外,能够在 Mock 方法中,判断传递的参数是否正确。 因为常规的 Mock ,是返回一个值。 var mock = new Mock<Test>(); mock.Setup<xxxx>(x => Get).... var obj = mock.Object; var result = obj.Get(); 在这个时候,是忽略参数和计算过程,返回一个值。 但是我们如果需要一个参…

2022年9月26日 0条评论 4246点热度 0人点赞 痴者工良 阅读全文

Windows.ApplicationModel.Package.Current.InstalledLocation.Path [......] 继续阅读

2022年9月23日 0条评论 968点热度 0人点赞 痴者工良 阅读全文

Windows.ApplicationModel.Package.Current.InstalledLocation.Path [......] 继续阅读

2022年9月23日 0条评论 3154点热度 0人点赞 痴者工良 阅读全文

首先映射是按照块来映射的,每个块内都有一个块内地址,记录每个字长的位置。 本文部分图片来源参考:https://blog.csdn.net/weixin_42649617/article/details/105092395 直接映射 特点是内存与 Cache 之间的映射位置是固定的,其中内存到 Cache 的映射位置计算是取余。 每个内存块的的大小跟 Cache 的块大小一致,内存块数量为 M, Cache 块数量为 N。 一个内存块的序号是 M(i),那么在 Cache 中的位置是 M(i)%N = N(i), …

2022年9月18日 0条评论 1265点热度 2人点赞 痴者工良 阅读全文

首先映射是按照块来映射的,每个块内都有一个块内地址,记录每个字长的位置。 本文部分图片来源参考:https://blog.csdn.net/weixin_42649617/article/details/105092395 直接映射 特点是内存与 Cache 之间的映射位置是固定的,其中内存到 Cache 的映射位置计算是取余。 每个内存块的的大小跟 Cache 的块大小一致,内存块数量为 M, Cache 块数量为 N。 一个内存块的序号是 M(i),那么在 Cache 中的位置是 M(i)%N = N(i), …

2022年9月18日 0条评论 6517点热度 2人点赞 痴者工良 阅读全文

Razor Page Field Naming Conventions Component Invocation When a component allows external parameters to be passed, properties must be decorated with [Parameter] and utilize Pascal case naming. <div class="card" style="width:22rem"> &l…

2022年9月15日 0条评论 1178点热度 0人点赞 痴者工良 阅读全文

razor 页面字段属性命名规则 组件被调用 一个组件如果允许外部传递参数,需要使用 [Parameter] 修饰属性和大写命名。 <div class="card" style="width:22rem"> <div class="card-body"> <h3 class="card-title">@Title</h3> <p class="card-text">@ChildContent</p> </div> </div…

2022年9月15日 0条评论 2887点热度 0人点赞 痴者工良 阅读全文

MAUI Blazor uses WebView2 on Windows, and the MAUI Blazor runtime environment is independent of the application. Even if the system language is set to Chinese, the assembly is set to Chinese, and the local culture is set to Chinese, the CultureInfo settings ar…

2022年9月15日 0条评论 4397点热度 2人点赞 痴者工良 阅读全文

MAUI Blazor 在 Windows 上使用的是 WebView2,MAUI Blazor 运行环境是跟程序没关系的,即使是系统设置了中文语言,程序集设置了中文,本地文化设置了中文,CultureInfo 设置了中文,统统都没有用。 你可以在程序启动后,按下 F12,然后执行 JavaScript 代码,检查浏览器的运行环境是何种语言: navigator.language 'en-US' 或者使用 API: // using Windows.Globalization var langs = Applica…

2022年9月15日 0条评论 4531点热度 2人点赞 痴者工良 阅读全文

Fixing issues related to missing components in the system: DISM.exe /Online /Cleanup-image /Scanhealth DISM.exe /Online /Cleanup-image /Checkhealth DISM.exe /Online /Cleanup-image /Restorehealth sfc /scannow [......] 继续阅读

2022年8月27日 0条评论 952点热度 0人点赞 痴者工良 阅读全文

修复系统缺少组件等问题: DISM.exe /Online /Cleanup-image /Scanhealth DISM.exe /Online /Cleanup-image /Checkhealth DISM.exe /Online /Cleanup-image /Restorehealth sfc /scannow [......] 继续阅读

2022年8月27日 0条评论 3090点热度 0人点赞 痴者工良 阅读全文

原作者:Joydip Kanjilal 原文地址:https://www.codemag.com/Article/2207031/Writing-High-Performance-Code-Using-SpanT-and-MemoryT-in-C 本文采用半译方式。 在本文中,将会介绍 C# 7.2 中引入的新类型:Span 和 Memory,文章深入研究 Span<T> 和 Memory<T> ,并演示如何在 C# 中使用它们。 本文所有代码用例在 .NET 6.0 下运行。 .NET 中…

2022年8月20日 0条评论 3383点热度 3人点赞 痴者工良 阅读全文
1141516171854