
C#
文章平均质量分 60
chao3150
123
展开
-
制作并发布 Nuget 包
制作并发布 Nuget 包翻译 2023-02-19 11:37:03 · 501 阅读 · 0 评论 -
c# 中加密混淆 dll 并通过反射的方式调用
基于 .net Framework 4.7.2假设我们有一个输出类型为类库的项目,项目的命名空间为 SomeSecurityDll,该命名空间下有如下一个类namespace SomeSecurityDll{ public static class ImportantClass { private static string password = "123@abc"; public static string DoSomething() .原创 2022-05-16 00:18:14 · 4336 阅读 · 0 评论 -
C#/WPF 修改用户配置 user.config 的路径
原文链接:https://stackoverflow.com/questions/2265271/custom-path-of-the-user-config在 WPF 中,可以使用 user.config 去持久化配置,但是该文件是存储在 c 盘的用户文件夹下,不好移动和修改,且微软不提供修改的方法,因此使用下面的方法可以实现修改路径新建一个类 CustomSettingsProvider 如下:class CustomSettingsProvider : SettingsProvider翻译 2022-01-11 23:00:13 · 1613 阅读 · 0 评论 -
将 SQLite.Interop.dll 嵌入到一个 exe 中
原文链接:https://old.idmedia.no/general/including-sqlite-interop-dll-into-your-c-project/添加所有 dll 文件到一个 exe 中Nuget 中搜索 Costura.Fody,安装成功后,重新构建程序,所有的 dll 就会自动打包到 exe中,但是这个方法没法打包 SQLite.Interop.dll 到 exe 中,因此得用接下来的方法将 SQLite.Interop.dll 嵌入到一个 exe 中在项目下新建两个文转载 2020-11-22 22:04:41 · 1704 阅读 · 3 评论 -
WPF TextBox 处理键盘 Alt 的坑
后台代码如下private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e){ Console.WriteLine(e.Key); Console.WriteLine(e.Key==e.SystemKey);}输出:SystemFalseMatthiasG 的回到中解释到:Alt 键是由系统处理的,只有系统通过 e.SystemKey 才知道是否按下了 Alt 键,属性键会返回Key. system翻译 2020-10-12 18:26:41 · 453 阅读 · 0 评论 -
C# 访问被墙网站如何设置超时
最近使用 C# HttpWebRequest 写网络模块的时候,即使设置了 Timeout,也会在Request = (HttpWebRequest)HttpWebRequest.Create(URL);卡住,因为上面这段代码要判断服务器是否可访问,这里的超时是 20s,也就是说,如果这个网站被墙了,就会在这里卡 20s 左右,单独设置 HttpWebRequest.TimeOut 是无效的。Karl Glennon 在 问题 中说到当我们检查的服务器停机时,无论我们尝试什么,我们都无法使超时小翻译 2020-08-11 17:30:12 · 287 阅读 · 0 评论 -
requests 中文编码错误
最近使用 Python 写爬虫发现一个问题:请求某个特定网站的时候,总会显示乱码headers = { 'Host': "test", 'Connection': 'Keep-Alive', 'Cache-Control':'max-age=0', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTM原创 2020-07-03 11:01:38 · 484 阅读 · 0 评论