日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

用ASP.Net實現(xiàn)在線壓縮和解壓縮(2)_.Net教程

編輯Tag賺U幣
教程Tag:暫無Tag,歡迎添加,賺取U幣!

推薦:Asp.net Ajax--Calendar控件使用
簡介 Calendar控件是一個很簡單的控件,主要用來在頁面中提供日歷的選擇,其實現(xiàn)在已經(jīng)有很多用javascript寫的日歷控件,但是Canlendar日歷控件能夠讓我們更快速地來實現(xiàn)這種效果,只需要進行

// ---------------------------------------------
// 2. UnZipClass.cs
// ---------------------------------------------

using System;
using System.IO;
using ICSharpCode.SharpZipLib.Zip;
using ICSharpCode.SharpZipLib.GZip;
using ICSharpCode.SharpZipLib.BZip2;
using ICSharpCode.SharpZipLib.Checksums;
using ICSharpCode.SharpZipLib.Zip.Compression;
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;

namespace WebZipUnzip
{
public class UnZipClass
{
/// <summary>
/// 解壓文件
/// </summary>
/// <param name="args">包含要解壓的文件名和要解壓到的目錄名數(shù)組</param>
public void UnZip(string[] args)
{
ZipInputStream s = new ZipInputStream(File.OpenRead(args[0]));
try
{
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] fileName);

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();
}
catch(Exception eu)
{
throw eu;
}
finally
{
s.Close();
}

}//end UnZip

public static bool UnZipFile(string file, string dir)
{
try
{
if (!Directory.Exists(dir))
Directory.CreateDirectory(dir);
string fileFullName = Path.Combine(dir,file);
ZipInputStream s = new ZipInputStream(File.OpenRead( fileFullName ));

ZipEntry theEntry;
while ((theEntry = s.GetNextEntry()) != null)
{
string directoryName = Path.GetDirectoryName(theEntry.Name);
string fileName = Path.GetFileName(theEntry.Name);

if (directoryName != String.Empty)
Directory.CreateDirectory( Path.Combine(dir, directoryName));

if (fileName != String.Empty)
{
FileStream streamWriter = File.Create( Path.Combine(dir,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();
return true;
}
catch (Exception)
{
throw;
}
}

}//end UnZipClass
}

分享:ASP.NET備份恢復SqlServer數(shù)據(jù)庫
備份SqlServer數(shù)據(jù)庫 核心技術: using System.Data.SqlClient; using System.IO; string SqlStr1 = "Server=(local);DataBase=master;Uid=sa;Pwd=&q

來源:模板無憂//所屬分類:.Net教程/更新時間:2008-08-22
相關.Net教程