最近搞 .net项目,Dapper连接Mysql时,运行报错: System.NotSupportedException:“No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.” 解决办法: 新建项目,选择Visual C#   ->    .Net…
写了一个小程序利用NPOI来读取Excel,弹出这样的报错: ICSharpCode.SharpZipLib.Zip.ZipException:Wrong Local header signature 原因在于读取Excel的时候若是读取的文件为txt或者其他拓展名时,都会报这样不知所措的异常: 所以只需要在读取时先检查一下文件名的拓展名,把非.xls和.xlsx的文件过滤就可以了.…
最近想用个解压缩功能 从网上找了找 加自己修改,个人感觉还是比较好用的,直接上代码如下 using System; using System.Linq; using System.IO; using ICSharpCode.SharpZipLib.Zip; using ICSharpCode.SharpZipLib.Checksums; using System.Diagnostics; using Microsoft.Win32; namespace ZipCommon { public cl…
官网http://www.icsharpcode.net/ 支持文件和字符压缩. 创建全新的压缩包 第一步,创建压缩包 using ICSharpCode.SharpZipLib.Zip; ZipOutputStream zipOutputStream = new ZipOutputStream(File.Create(strZipPath)); 参数:strZipPath,提供压缩后的文件包全路径,即地址和文件名.如,D:\tmp\01.rar第二步,向压缩包中添加压缩包的文件名 ICShar…
使用开源类库ICSharpCode.SharpZipLib.Zip可以实现压缩与解压缩功能,源代码和DLL可以从http://www.icsharpcode.net/OpenSource/SharpZipLib/Default.aspx下载: 有两种方式可以实现压缩与解压缩,这里只提供了ZIP格式: 1.DLL本身提供的快速压缩与解压缩,直接代码: using System; using ICSharpCode.SharpZipLib.Zip; namespace Zip { public st…
原文:基于ICSharpCode.SharpZipLib.Zip的压缩解压缩 今天记压缩解压缩的使用,是基于开源项目ICSharpCode.SharpZipLib.Zip的使用. 一.压缩: /// <summary> /// 压缩 /// </summary> /// <param name="sourceDirectory"></param> /// <param name="targetZipName"&g…
修改远程服务器的文件名,报错“System.NotSupportedException”类型的未经处理的异常在 mscorlib.dll 中发生”,“System.NotSupportedException: 不支持给定路径的格式.” 此错误说明路径有问题,本来是映射到本地,路径为“Z:\XXX”,既然报错,这种路径肯定是非法路径,改为服务器路径就可以了,比如“\\10.0.0.101\ArcCatalog\Connection to 10.0.0.101.sde”,这样就算是使用了网络路径.…
//压缩整个目录下载 var projectFolder = Request.Params["folder"] != null ? Request.Params["folder"] : string.Empty; if (!string.IsNullOrWhiteSpace(projectFolder)) { string path = Util.GetMapPath(string.Format("attarch/html/{0}", proje…
.bin/mysqld --initialize-insecure --basedir=xxx --datadir=xxx 然后 .bin/mysqld_safe --defaults-file=xxx --user=mysql & 抛错: InnoDB: auto-extending data file ./ibdata1 is of a different size 640 pages (rounded down to MB) than specified in the .cnf file:…
首先了解ZipOutPutStream和ZipEntry对象 ZipOutPutStream对象 如果要完成一个文件或文件夹的压缩,则要使用ZipOutputStream类.ZipOutputStream是OutputStream的子类,常用操作方法如表12-20所示.ZipOutputStream类的常用方法 序号 方    法 类型 描    述 1 public ZipOutputStream (OutputStream out) 构造 创建新的ZIP输出流 2 public void p…