Reusable Stream You need to install Microsoft.IO.RecyclableMemoryStream. internal class StreamHandler { // Stream pool private static readonly RecyclableMemoryStreamManager Manager = new(); private readonly RecyclableMemoryStream _stream; private volatile boo[…

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

可复用Stream 需要安装 Microsoft.IO.RecyclableMemoryStream。 internal class StreamHandler { // Stream pool private static readonly RecyclableMemoryStreamManager Manager = new(); private readonly RecyclableMemoryStream _stream; private volatile bool _disposed;[......]继续…

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

Background Recently, I needed to connect a domain name with the public IP of residential broadband, which led to a series of issues. Note: Machines within the country without registration cannot provide external services! http://www.gov.cn/gongbao/content/2005…

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

背景 最近要将域名跟家庭宽带的公网 IP 打通,出现了一系列的问题。 注意:国内未经备案的机器,不能对外提供服务! http://www.gov.cn/gongbao/content/2005/content_93018.htm 非经营性互联网信息服务备案管理办法 在中华人民共和国境内提供非经营性互联网信息服务,应当依法履行备案手续。 未经备案,不得在中华人民共和国境内从事非经营性互联网信息服务。 在国内的家庭宽带中,80/443 端口是不开放的,但是 caddy 需要使用这两个端口才能访问,如果设置其他端口,会导…

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

Background The initial approach adopted was to develop using Maui + Blazor, utilizing the Blazor UI framework, which has high community popularity. However, during the development process, there were numerous pitfalls with Maui and the Blazor UI framework. The…

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

背景 最先采用的是 Maui + Blazor 开发,使用社区热度比较高的 Blazor UI 框架。 可是开发进行过程中, Maui 巨多坑,Blazor UI 框架也是巨多坑,使用 Blazor UI 写的页面和样式,过不了设计师和产品经理的是法眼。 最终决定使用原生前端结合,生成静态内容放到 Maui 中,然后将两者结合起来打包发布。 先搞前端 对于前端来说,按照正常的开发模式就行,不对对前端的代码产生污染。 可以使用 VS 创建前端项目,将其放到解决方案中,也可以单独创建一个目录,将前端代码放到里面。 创建…

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

bool IsDefine<T1, T2>(T2 t) where T1 : Enum where T2 : Enum { var value = Unsafe.As<T2, T1>(ref t); var array = Enum.GetValues(typeof(T1)); return (Array.BinarySearch(array, value) >= 0); } public static class EnumTool<T1, T2> where T1 : E…

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

bool IsDefine<T1, T2>(T2 t) where T1 : Enum where T2 : Enum { var value = Unsafe.As<T2, T1>(ref t); var array = Enum.GetValues(typeof(T1)); return (Array.BinarySearch(array, value) >= 0); } public static class EnumTool<T1, T2> where T1 : E…

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

In projects using partial classes, such as Razor, Blazor, WPF, etc., the compilation will generate .g.cs files. However, if there are issues that prevent successful compilation, and examining the source code does not reveal any errors, one can begin outputting…

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

在项目使用分部类,如 Razor、Blazor、Wpf 等项目中,编译会生成 .g.cs 文件,但是因为出现了问题,不能编译成功,查看源代码,找不出错误,只能开始输出 .g.cs ,查看文件进行检查。 <PropertyGroup> <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles> </PropertyGroup> https://stackoverflow.com/questions/7117…

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

Fast speed and good performance through DNS. dig ANY +short @resolver2.opendns.com myip.opendns.com dig ANY +short @resolver2.opendns.com myip.opendns.com dig ANY +short @ns1-1.akamaitech.net ANY whoami.akamai.net [......] 继续阅读

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

通过 DNS 方式,速度快,性能好。 dig ANY +short @resolver2.opendns.com myip.opendns.com dig ANY +short @resolver2.opendns.com myip.opendns.com dig ANY +short @ns1-1.akamaitech.net ANY whoami.akamai.net [......] 继续阅读

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

// 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[......]继续阅读

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

// 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[......]继续阅读

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

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…

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

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条评论 2862点热度 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条评论 594点热度 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条评论 2290点热度 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条评论 610点热度 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条评论 3400点热度 2人点赞 痴者工良 阅读全文
1131415161754