随笔分类 - C#
摘要:void GetDir(string dir) { DirectoryInfo directoryInfo = new DirectoryInfo(dir); var directroies = directoryInfo.GetDirectories(); foreach (var directr
阅读全文
摘要:解决方法,用高版本的mysql.data.dll ,对应的用高版本的 NET Framework 这和问题 的原因是 mysql版本在8.0前后的密码加密算法不同。 在8.0之前采用的是mysql_native_password 在8.0之后采用的是caching_sha2_password 如果你
阅读全文
摘要:一直提示有相同版本或者高版本,但是控制面板里还找不到。 下载这个 开发者工具包,安装就可以了。。
阅读全文
摘要:class HotKey { //如果函数执行成功,返回值不为0。 //如果函数执行失败,返回值为0。要得到扩展错误信息,调用GetLastError。 [System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = tr
阅读全文
摘要:request.ContentType = "application/json; charset=utf-8"; 这种的postdata 在写入 Stream的时候要确保编码是 utf-8 string postData = "中文乱码问题"; UTF8Encoding encoding = new
阅读全文
摘要:如抓 https 设置好代理之后出现 网络等问题,无法正常抓包。 可以用 JustTrustMe.apk+Xposed框架,然后安装FiddlerRoot.cer 证书。然后再抓。 安装JustTrustMe 容易造成 无法正常上网,抓完包,在xposde的模块里取消,重启手机就可以正常上网了。 如
阅读全文
摘要:HttpWebRequest 多线程一定要设置 System.Net.ServicePointManager.DefaultConnectionLimit = 512; 否则跑不起,很多超时。。 另外 HttpWebResponse 用完一定要close 。。。
阅读全文
摘要:https请求,win7正常,xp返回 The underlying connection was closed: An unexpected error occurred on a send 百度了下,貌似是 认证协议的问题 加入,果然奏效。。
阅读全文
摘要:一般是由于使用相对路径造成的,使用绝对路径即可。
阅读全文
摘要:比如我要操作的是下面的input 用到的方法是 调用如下: 类似这种div在webkit中好像是无法通过常规方法模拟的 这时候,可通过: 来模拟点击。
阅读全文
摘要:F12进入进入开发者模式后,ctrl+shift+f , 全局搜索含有某个字符串的资源(可方便找出某个字符串在哪个js文件中,进行js分析,解密)。
阅读全文
摘要:using System.Runtime.InteropServices; [DllImport("kernel32.dll")] public static extern Boolean AllocConsole(); [DllImport("kernel32.dll")] public static exter...
阅读全文
摘要:/// /// 获取文件的编码格式 /// public class EncodingType { /// /// 给定文件的路径,读取文件的二进制数据,判断文件的编码类型 /// /// 文件路径 /// 文件的编码类型 public s...
阅读全文
摘要:开源项目地址:http://dotras.codeplex.com/ 使用这个可以方便的操作ADSL拨号、断开。有详细的开发文档,需要的可以自己去看。。
阅读全文
摘要:public long GetGTK(string sKey) { int hash = 5381; for (int i = 0, len = sKey.Length; i < len; ++i) { hash += (hash << 5) + (int)sKey[i]; } return (ha
阅读全文
摘要:get/post请求返回的cookie中并不是所有的键值对我们都需要,我们只需要提取我们需要的进行重新组合就可以了。 如下图是一个GET请求返回的cookie 我需要提取其中的 uin,skey等相关键值对。 以下函数可以完成我们的需求 public string GetCookieByName(L
阅读全文
摘要:将Bin目录放到网站根目录就好了。。。
阅读全文
摘要:网上时间接口很多,但是源码里根本看不到常规的DateTime类型的时间。全是时间戳形式的时间。 这里提供一个接口: http://www.hko.gov.hk/cgi-bin/gts/time5a.pr?a=1 取时间戳的前10位,转化成DateTime类型就可以了。前10位精确到秒。
阅读全文
摘要:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.11 TaoBrowser/2.0 Safari/536.11Mozilla/5.0 (Windows NT 6.1...
阅读全文
摘要:\u9a8c\u8bc1\u5931\u8d25\uff0c\u8bf7\u6309\u7167\u5408\u89c4\u7684\u65b9\u5f0f\u8fdb\u884c\u63d0\u4ea4这样的就是汉字的unicode编码了。。转换函数: public static string unicodetogb(string text) { System.Text.RegularExpressions.MatchCollection mc = System.Text.RegularExpressions.Regex.Matches(te...
阅读全文

浙公网安备 33010602011771号