Zhuangkh

A .Net Developer

All Posts


How to check if a process is using dotnet

As we all know, we can get information about the processes in the system simply by using the methods provided by the Process class in the System.Diagnostics namespace. For example, you can get all processes by Process.GetProcesses() and all processes by the specified name by Process.GetProcessesByName(). But how do we know if the process is using dotnet or was created by dotnet? Here are three …

.Net Process

Get information of the installed MSI products

MSI files are Windows Installer data packages that actually contain application files stored in a COM structure and a database containing applications information for installing, updating, uninstalling. Windows provides a set of APIs for manipulating msi programs, contained in msi.dll, three of which are listed below. [DllImport(msi.dll, CharSet = CharSet.Unicode)] private static extern uint …

Revit MSI Navisworks GUID SQUID

家庭网络环境改造Ⅱ:系统

Proxmox安装 去除订阅弹窗 免费版本的PVE会在登陆WEB管理页面时提示 没有有效的订阅。 You do not have a valid subscription for this server. Please visit www.proxmox.com to get a list of available options. 我们可以通过修改源码来去除这个提示,打开文件 /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js ,找到第381行。 if (data.status !== = 'Active') { Ext.Msg.show({ title: gettext('No valid subscription'), icon: Ext.Msg.WARNING, …

Network Router

ConfigureAwait的使用

ConfigureAwait的使用 Task.ConfigureAwait(bool)指示了Awaiter完成任务时是否尝试将结果返回原上下文中继续执行,Ture为尝试返回,False则相反。 在讨论ConfigureAwait的正确使用场景之前,则应该先了解SynchronizationContext类型。 SynchronizationContext SynchronizationContext提供了在同步模型中传播上下文的基本功能,其中Send()方法将一个同步消息调度到一个上下文中,Post()方法将一个异步委托调度到一个上下文中。 例如,WinForms具有一个SynchronizationContext的派生类型,它重写了Post方法,以完成相当于Control.BeginInvoke的功能;这意味着对它的Post方法的任何调用都将导致委托稍后在该Control的UI线程上被调 …

.Net Task SynchronizationContext

Revit Stable Reference

Reference Reference in revit is the geometric reference object of the model element ,it is often used when inserting a new face-base instance of a family , or when creating the demensions. The following is an introduction to some of the methods used to obtain the reference. Reference Type <table class="table"> <thead> <tr> <th>Enum</th> <th>Representation</th> <th>StableRepresentation Comment</th> …

Revit Reference

「读书笔记:Concurrency in .Net」Compose&Closure

函数组合 <table class="table"> <thead> <tr> <th>流水线</th> <th>函数组合</th> </tr> </thead> <tbody> <tr> <td>每个函数输出是下一个函数输入</td> <td>返回多个函数组合而成的新函数</td> </tr> <tr> <td>立即求值</td> <td>延迟求值</td> </tr> </tbody> </table> Example: 咖啡豆 -> 磨豆 -> [咖啡粒] -> 冲咖啡 -> [咖啡] 使用链的方式调用 FuncBeans,Ground grind = beans = new Ground(beans); FuncGround,Coffee brew = ground = new Coffee(ground); Coffee coffee = brew(grind(beans)); …

FP BookNotes Closure

「读书笔记:Concurrency in .Net」Functional Programming

函数式编程Functional Programming FP是一种将计算是为对表达式求值的编程范式 FP优点 可组合性和模块化 表达性 可靠性和测试 易于并发 延迟求值 生产力 正确性 可维护性 FP原则 高阶函数(HOF)作为头等值 不可变性 纯函数 声明式编程风格 HOF FP中函数作为头等值,意味着函数可以由变量命名、分配给变量,可以出现在任何构造可以出现的地方。 HOF使编程专注于结果,而不是步骤。 HOF优点 组合和模块化 实现函数式组合的方式 组合 柯里化 部分应用函数 代码可重用性 创建高度动态和适应性强的系统 HOF与lambda 一种重构代码,减少代码冗余的方式,一个优雅的解决方案。 简洁的内联编码 限制类级别变量的暴露 代码流易读性高 Example: stream在使用后被Disposed,一种不可重复使用的模式。 string text; using(var …

Book Notes FP

WPF : Validation

Validation Rule 简单示例 class ViewModel { public int Number { get; set; } } TextBox TextBox.Text Binding Path=Number UpdateSourceTrigger=PropertyChanged Delay=200 /Binding /TextBox.Text /TextBox 示例中由于绑定的属性Number是int型(int在绑定到界面上时会自动添加int⇋string的converter),所以当我们输入非数字时,converter抛出的转换异常会被捕获到,此时Textbox上会出现红色边框。 异常被捕获 描述错误的实际消息存储在 System.Windows.Controls.ValidationError 对象的 …

.Net WPF Validation

Reading Revit File Without Revit

Starting the main Revit program needs to be accompanied by loading multiple components, which usually takes a long time. This is especially annoying after the file automatically calls the wrong version of Revit! So is there any way to read the Revit program without opening Revit? It should be clear that it will be very difficult not to read or modify member information in Revit (there may be …

Revit Ole Storage COM Structured Storage

Merge Multiple .Net Assemblies Into One

When we use a lot of external dependencies, the generated folder may contain a lot of Dlls that are not conducive to distribution. Before Here are two ways to pack multiple assemblies into one. Costura.Fody Costura is an add-in for Fody. Fody is an extensible tool for weaving .net assemblies. It enables the manipulating the IL of an assembly as part of a build. Costura is easy to use. Install …

.Net IL Merge Fody