当前位置: 首页 > news >正文

制作一个有用户网站百度竞价排名广告定价

制作一个有用户网站,百度竞价排名广告定价,ps做 网站标准尺寸是多少,如何在百度举报网站真是折腾呀,网上虽然有不少的源码但测试几个就是不成功,经过折腾还是折腾出来了现在分享出来给大家。 源码还是在网友们的基础上调整的,主要是调整源码大大小写格式。 sharpziplib.dll 下载:http://pan.baidu.com/share/link?sh…

真是折腾呀,网上虽然有不少的源码但测试几个就是不成功,经过折腾还是折腾出来了现在分享出来给大家。

源码还是在网友们的基础上调整的,主要是调整源码大大小写格式。


sharpziplib.dll 下载:http://pan.baidu.com/share/link?shareid=1016448925&uk=134565274&fid=3214033513

首先需要在项目里引用sharpziplib.dll

ZipClass.cs 类函数 包括压缩和解压

using System;
using System.Text;
using System.Collections;
using System.IO;
using System.Diagnostics;
using System.Runtime.Serialization.Formatters.Binary;
using System.Data;
using ICSharpCode.SharpZipLib.BZip2;
using ICSharpCode.SharpZipLib.Zip;
using ICSharpCode.SharpZipLib.Zip.Compression;
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
using ICSharpCode.SharpZipLib.GZip;
using ICSharpCode.SharpZipLib.Checksums;
namespace Updatezip
{#region 压缩文件类/// <summary>/// 压缩文件   /// </summary>public class ZipClass{public void ZipFile(string FileToZip, string ZipedFile, int CompressionLevel, int BlockSize){//如果文件没有找到,则报错   if (!System.IO.File.Exists(FileToZip)){throw new System.IO.FileNotFoundException("The specified file " + FileToZip + " could not be found. Zipping aborderd");}System.IO.FileStream StreamToZip = new System.IO.FileStream(FileToZip, System.IO.FileMode.Open, System.IO.FileAccess.Read);System.IO.FileStream ZipFile = System.IO.File.Create(ZipedFile);ZipOutputStream ZipStream = new ZipOutputStream(ZipFile);ZipEntry ZipEntry = new ZipEntry("ZippedFile");ZipStream.PutNextEntry(ZipEntry);ZipStream.SetLevel(CompressionLevel);byte[] buffer = new byte[BlockSize];System.Int32 size = StreamToZip.Read(buffer, 0, buffer.Length);ZipStream.Write(buffer, 0, size);try{while (size < StreamToZip.Length){int sizeRead = StreamToZip.Read(buffer, 0, buffer.Length);ZipStream.Write(buffer, 0, sizeRead);size += sizeRead;}}catch (System.Exception ex){throw ex;}ZipStream.Finish();ZipStream.Close();StreamToZip.Close();}public void ZipFileMain(string[] args){string[] filenames = Directory.GetFiles(args[0]);Crc32 Crc = new Crc32();ZipOutputStream s = new ZipOutputStream(File.Create(args[1]));s.SetLevel(6); // 0 - store only to 9 - means best compression   foreach (string file in filenames){//打开压缩文件   FileStream fs = File.OpenRead(file);byte[] buffer = new byte[fs.Length];fs.Read(buffer, 0, buffer.Length);ZipEntry entry = new ZipEntry(file);entry.DateTime = DateTime.Now;// set Size and the crc, because the information   // about the size and crc should be stored in the header   // if it is not set it is automatically written in the footer.   // (in this case size == crc == -1 in the header)   // Some ZIP programs have problems with zip files that don"t store   // the size and crc in the header.   entry.Size = fs.Length;fs.Close();Crc.Reset();Crc.Update(buffer);entry.Crc = Crc.Value;s.PutNextEntry(entry);s.Write(buffer, 0, buffer.Length);}s.Finish();s.Close();}}
#endregion#region 解压文件类/// <summary>///  解压文件/// </summary>public class UnZipClass{public void UnZip(string[] args){ZipInputStream s = new ZipInputStream(File.OpenRead(args[0]));ZipEntry theEntry;while ((theEntry = s.GetNextEntry()) != null){string directoryName = Path.GetDirectoryName(args[1]);string fileName = Path.GetFileName(theEntry.Name);//生成解压目录   Directory.CreateDirectory(directoryName);if (fileName != String.Empty){//解压文件到指定的目录   FileStream streamWriter = File.Create(args[1] + theEntry.Name);int size = 2048;byte[] data = new byte[2048];while (true){size = s.Read(data, 0, data.Length);if (size > 0){streamWriter.Write(data, 0, size);}else{break;}}streamWriter.Close();}}s.Close();}}
#endregion
}

调用方法

/// <summary>   
/// 调用源码   
/// </summary>   
private void button2_Click_1(object sender, System.EventArgs e)  
{  string[] FileProperties = new string[2];  FileProperties[0] = "C:\\unzipped\\";//待压缩文件目录   FileProperties[1] = "C:\\zip\\a.zip"; //压缩后的目标文件   ZipClass Zc = new ZipClass();  Zc.ZipFileMain(FileProperties);  
}  
private void button2_Click(object sender, System.EventArgs e)  
{  string[] FileProperties = new string[2];  FileProperties[0] = "C:\\zip\\test.zip";//待解压的文件   FileProperties[1] = "C:\\unzipped\\";//解压后放置的目标目录   UnZipClass UnZc = new UnZipClass();  UnZc.UnZip(FileProperties);  
}


http://www.ds6.com.cn/news/81012.html

相关文章:

  • 可以做测试的网站推广资源seo
  • 企业网站建设好的案例企业管理培训机构排名前十
  • 国外域名。国内网站如何注册自己的网站
  • 邯郸做网站哪家好深圳网络运营推广公司
  • 去哪个网站做吃播自助优化排名工具
  • 美化网站公司收录平台
  • wordpress额外css图片seo公司上海牛巨微
  • 给人做代工的网站深圳全网推广
  • 网站推广话术处理事件seo软件
  • 如何做网站广告图片公关负面处理公司
  • 网站制作计划书hao123文件在哪里
  • 网站ico图标企业培训内容有哪些
  • 家用电器销售的网站开发开发一个app需要多少钱
  • 信息时代网站建设的重要性seo怎么优化简述
  • 国外画册设计欣赏网站希爱力副作用太强了
  • 宁波制作网页哪家好seo自己怎么做
  • 做环评在发改委网站申请南宁网络推广品牌
  • 网站二级页面做哪些东西电视剧排行榜
  • 政府 网站建设自查报告图片识别 在线识图
  • 给企业做网站挣钱吗网络营销推广的方式有哪些
  • 北京最大的广告公司郑州网站优化哪家好
  • 别人给我们做的网站如何关闭谷歌seo搜索优化
  • 网络推广培训在哪里优化网站的软件下载
  • 网站建设与推广长春南宁seo营销推广
  • 门户网站首页模板下载百度推广方式有哪些
  • 网页网站制作公司天津百度seo排名优化
  • 深圳市建设集团百度百科优化
  • 工信委网站建设方案做一个网站的步骤
  • 网站备案后应该做什么百度竞价排名的使用方法
  • vps怎么建多个网站北京建站公司