// json => Dictionary static Dictionary<string, string> Read(string jsonData) { var reader = new Utf8JsonReader(Encoding.Default.GetBytes(jsonData), _jsonReaderOptions); var map = new Dictionary<string, string>(); BuildMap(r[......]继续阅读
// json => Dictionary static Dictionary<string, string> Read(string jsonData) { var reader = new Utf8JsonReader(Encoding.Default.GetBytes(jsonData), _jsonReaderOptions); var map = new Dictionary<string, string>(); BuildMap(r[......]继续阅读
// json => Dictionary static Dictionary<string, string> Read(string jsonData) { var reader = new Utf8JsonReader(Encoding.Default.GetBytes(jsonData), _jsonReaderOptions); var map = new Dictionary<string, string>(); BuildMap(r[......]继续阅读
private static void RunPowershellScript(string scriptFile) { ProcessStartInfo ps = new ProcessStartInfo(@"powershell.exe", scriptFile) { RedirectStandardOutput = true }; //ps.CreateNoWindow = true; var proc = Process.Start(ps); proc.OutputDataReceive…
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)…
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…
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…
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…
项目发布参数: 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…
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…
ASP.NET Core Response.Body 默认是 HttpResponseStream,其主要特征是只能追加写,不能读取也不能修改。 所以最根本方法是替换 HttpResponseStream。 随便设置一个中间件,或者将 HttpContext 拿出来,定义变量 context。 替换 Body: var responseOriginalBody = context.Response.Body; var memStream = new MemoryStream(); context.Response.…
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…
做单元测试的时候往往会使用 Moq 等库,对代码进行 Mock。 但是有些过程,我们希望除了 Mock 方法之外,能够在 Mock 方法中,判断传递的参数是否正确。 因为常规的 Mock ,是返回一个值。 var mock = new Mock<Test>(); mock.Setup<xxxx>(x => Get).... var obj = mock.Object; var result = obj.Get(); 在这个时候,是忽略参数和计算过程,返回一个值。 但是我们如果需要一个参…
Windows.ApplicationModel.Package.Current.InstalledLocation.Path [......] 继续阅读
首先映射是按照块来映射的,每个块内都有一个块内地址,记录每个字长的位置。 本文部分图片来源参考:https://blog.csdn.net/weixin_42649617/article/details/105092395 直接映射 特点是内存与 Cache 之间的映射位置是固定的,其中内存到 Cache 的映射位置计算是取余。 每个内存块的的大小跟 Cache 的块大小一致,内存块数量为 M, Cache 块数量为 N。 一个内存块的序号是 M(i),那么在 Cache 中的位置是 M(i)%N = N(i), …
首先映射是按照块来映射的,每个块内都有一个块内地址,记录每个字长的位置。 本文部分图片来源参考:https://blog.csdn.net/weixin_42649617/article/details/105092395 直接映射 特点是内存与 Cache 之间的映射位置是固定的,其中内存到 Cache 的映射位置计算是取余。 每个内存块的的大小跟 Cache 的块大小一致,内存块数量为 M, Cache 块数量为 N。 一个内存块的序号是 M(i),那么在 Cache 中的位置是 M(i)%N = N(i), …
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…
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…
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…
MAUI Blazor 在 Windows 上使用的是 WebView2,MAUI Blazor 运行环境是跟程序没关系的,即使是系统设置了中文语言,程序集设置了中文,本地文化设置了中文,CultureInfo 设置了中文,统统都没有用。 你可以在程序启动后,按下 F12,然后执行 JavaScript 代码,检查浏览器的运行环境是何种语言: navigator.language 'en-US' 或者使用 API: // using Windows.Globalization var langs = Applica…