91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 346KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-03
  • 語言: C#
  • 標簽: 壓縮??壓縮??壓縮??

資源簡介

程序實現壓縮與解壓縮 zip 程序實現壓縮與解壓縮 壓縮

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.Text;

using?ICSharpCode.SharpZipLib.Zip;
using?System.IO;
using?ICSharpCode.SharpZipLib.Core;
using?ICSharpCode.SharpZipLib.Checksums;

namespace?CreateZip
{
????class?Program
????{
????????static?void?Main(string[]?args)
????????{
???????????string?dir=Environment.CurrentDirectory;
???????????dir?=?dir?+?“\\UpLoad\\“;
???????????try
???????????{
???????????????AddFolder(dir);
???????????????Console.WriteLine(“Successfully“);
???????????}
???????????catch(Exception?e)
???????????{
???????????????Console.WriteLine(e.Message);
???????????}
???????????Console.ReadLine();
????????}
????????static?void?AddFolder(string?Dir)
????????{
????????????DirectoryInfo?di?=?new?DirectoryInfo(Dir);
????????????foreach?(FileInfo?fi?in?di.GetFiles())
????????????{
????????????????string?zipname?=?fi.Name.Substring(0?6);
????????????????zipname?=?fi.DirectoryName+“\\“?+?zipname?+?“.zip“;
????????????????string[]?FileProperties?=?new?string[3];
????????????????FileProperties[0]?=?fi.FullName;
????????????????
????????????????//壓縮后的目標文件
????????????????//FileProperties[1]?=?destPath?+?“\\“?+?System.IO.Path.GetFileNameWithoutExtension(fullName)?+?“.zip“;
????????????????FileProperties[1]?=?zipname;
????????????????FileProperties[2]?=?fi.Name;
????????????????ZipFileMain(FileProperties);
????????????????fi.Delete();
????????????}
????????}

????????static?void?ZipFileMain(string[]?args)
????????{
????????????string[]?filenames?=?new?string[]?{?args[0]?};
????????????string?name?=?args[2];
????????????if?(System.IO.File.Exists(args[1]))
????????????{
????????????????Add(new?string[]?{?args[1]?args[0]?args[2]?});
????????????????return;
????????????}
????????????Crc32?crc?=?new?Crc32();

????????????FileStream?filestream?=?new?FileStream(args[1]?FileMode.OpenOrCreate);
????????????ZipOutputStream?s?=?new?ZipOutputStream(filestream);

????????????s.SetLevel(6);

????????????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(name);

????????????????entry.DateTime?=?DateTime.Now;
????????????????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();
????????}

????????static?void?Add(string[]?fileSpecs)
????????{
????????????string?zipFileName?=?fileSpecs[0];
????????????using?(ZipFile?zipFile?=?new?ZipFile(zipFileName))
????????????{
????????????????zipFile.BeginUpdate();

????????????????zipFile.Add(fileSpecs[1]?fileSpecs[2]);

??????????

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2010-11-17?18:00??CreateZip\
?????目錄???????????0??2010-11-17?18:00??CreateZip\bin\
?????目錄???????????0??2010-11-17?18:00??CreateZip\bin\Debug\
?????文件???????16384??2010-11-17?11:08??CreateZip\bin\Debug\CreateZip.exe
?????文件???????13824??2010-11-17?11:08??CreateZip\bin\Debug\CreateZip.pdb
?????文件????????5632??2005-12-08?14:51??CreateZip\bin\Debug\CreateZip.vshost.exe
?????文件??????200704??2010-05-25?12:55??CreateZip\bin\Debug\ICSharpCode.SharpZipLib.dll
?????目錄???????????0??2011-03-31?11:40??CreateZip\bin\Debug\UpLoad\
?????目錄???????????0??2011-03-31?11:40??CreateZip\bin\Debug\UpLoad\43.doc\
?????文件???????45056??2010-11-17?11:04??CreateZip\bin\Debug\UpLoad\43.doc\43.doc
?????目錄???????????0??2010-11-17?18:00??CreateZip\bin\Debug\UpLoad\temp\
?????文件??????167936??2010-11-17?09:21??CreateZip\bin\Debug\UpLoad\temp\101117092040324.xls
?????文件???????50688??2010-11-17?09:21??CreateZip\bin\Debug\UpLoad\temp\101117092045081.xls
?????文件??????167936??2010-11-17?09:21??CreateZip\bin\Debug\UpLoad\temp\101117092049878.xls
?????文件??????167936??2010-11-17?09:21??CreateZip\bin\Debug\UpLoad\temp\101117092055296.xls
?????文件??????167936??2010-11-17?09:38??CreateZip\bin\Debug\UpLoad\temp\101117093817740.xls
?????文件??????167936??2010-11-17?09:48??CreateZip\bin\Debug\UpLoad\temp\101117094817545.xls
?????文件????????2244??2010-11-17?10:39??CreateZip\CreateZip.csproj
?????目錄???????????0??2010-11-17?18:00??CreateZip\obj\
?????文件?????????933??2011-03-31?11:35??CreateZip\obj\CreateZip.csproj.FileListAbsolute.txt
?????目錄???????????0??2010-11-17?18:00??CreateZip\obj\Debug\
?????文件???????16384??2010-11-17?11:08??CreateZip\obj\Debug\CreateZip.exe
?????文件???????13824??2010-11-17?11:08??CreateZip\obj\Debug\CreateZip.pdb
?????目錄???????????0??2010-11-17?18:00??CreateZip\obj\Debug\Refactor\
?????文件????????2828??2010-11-17?18:00??CreateZip\obj\Debug\ResolveAssemblyReference.cache
?????目錄???????????0??2010-11-17?18:00??CreateZip\obj\Debug\TempPE\
?????文件????????3081??2010-11-17?11:08??CreateZip\Program.cs
?????目錄???????????0??2010-11-17?18:00??CreateZip\Properties\
?????文件????????1227??2010-11-17?10:16??CreateZip\Properties\AssemblyInfo.cs

評論

共有 條評論