資源簡介
圖片壓縮工具 可用于拍攝照片后對某個文件夾下的圖片進行集中壓縮,大量減少硬盤空間
支持多級文件夾下圖片一并壓縮
源碼為c#

代碼片段和文件信息
using?System;
using?System.Collections;
using?System.xml;
namespace?CompressImgsWindows
{
????static?public?class?MyClass
????{
????????///?
????????///?讀取xml
????????///?
????????///?從第二個開始數(shù)--1,第一個是標識字段
????????//string[]?valuesUnLoad?=?new?String[2];
????????//valuesUnLoad?=?ReadBlanceConst(“\\xml\\UserConst.xml“?“SysConfigDataSet“?“UnLoad“);
????????//txtUnLoadConst.Text?=?valuesUnLoad[0];
????????//txtUnLoadRemark.Text?=?valuesUnLoad[1];
????????///?xml路徑?如“\\xml\\UserConst.xml“
????????///?第二層結點名稱
????????///?首個鍵值
????????///?返回需要讀取的鍵值數(shù)組
????????static?public?string[]?ReadBlanceConst(string?virtualPath?string?key?string?type)
????????{
????????????string[]?values?=?new?String[999];
????????????string?filePath?=?virtualPath;
????????????xmlDocument?xd?=?new?xmlDocument();
????????????xd.Load(filePath);
????????????xmlNodeList?nodeList?=?xd.SelectSingleNode(key).ChildNodes;
????????????foreach?(xmlNode?xn?in?nodeList)
????????????{
????????????????if?(xn.ChildNodes[0].InnerText?==?type)
????????????????{
????????????????????int?i?=?0;
????????????????????foreach?(xmlNode?xnchild?in?xn)
????????????????????{
????????????????????????//i==0?is?type?value?
????????????????????????if?(i?!=?0)
????????????????????????????values[i?-?1]?=?xnchild.InnerText;
????????????????????????i++;
????????????????????}
????????????????}
????????????}
????????????return?values;
????????}
????????///?
????????///從第一個開始數(shù)--0?
????????//Hashtable?ht?=?new?Hashtable();
????????//ht.Add(“1“?txtBalConst.Text);
????????//ht.Add(“2“?txtRemark.Text);
????????//SetBlanceConst(“\\xml\\UserConst.xml“?“SysConfigDataSet“?“Balance“?ht);
????????//MessageBox.Show(this?“保存成功!“);
????????///?
????????///?xml路徑?如“\\xml\\UserConst.xml“
????????///?第二層結點名稱
????????///?首個鍵值
????????///?其它需要保存鍵值
????????static?public?void?SetxmlValue(string?virtualPath?string?key?string?type?Hashtable?ht)
????????{
????????????xmlDocument?xd?=?new?xmlDocument();
????????????xd.Load(virtualPath);
????????????xmlNodeList?nodeList?=?xd.SelectSingleNode(key).ChildNodes;
????????????foreach?(xmlNode?xn?in?nodeList)
????????????{
????????????????if?(xn.ChildNodes[0].InnerText?==?type)
????????????????{
????????????????????foreach?(DictionaryEntry?de?in?ht)
????????????????????{
????????????????????????xn.ChildNodes[Convert.ToInt16(de.Key)].InnerText?=?de.Value.ToString();
????????????????????}
????????????????????break;
????????????????}
????????????}
????????????xd.Save(virtualPath);
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????77??2008-09-29?20:47??CompressImgsWindows\app.config
?????文件??????49152??2008-10-24?03:41??CompressImgsWindows\bin\Debug\CompressImgs.exe
?????文件?????????77??2008-09-29?20:47??CompressImgsWindows\bin\Debug\CompressImgs.exe.config
?????文件??????38400??2008-10-24?03:41??CompressImgsWindows\bin\Debug\CompressImgs.pdb
?????文件??????14328??2008-10-24?01:12??CompressImgsWindows\bin\Debug\CompressImgs.vshost.exe
?????文件?????????77??2008-09-29?20:47??CompressImgsWindows\bin\Debug\CompressImgs.vshost.exe.config
?????文件????????490??2007-07-21?01:33??CompressImgsWindows\bin\Debug\CompressImgs.vshost.exe.manifest
?????文件????????264??2009-11-02?21:50??CompressImgsWindows\bin\Debug\Config.xm
?????文件???????5429??2008-09-30?21:49??CompressImgsWindows\CompressImgs.csproj
?????文件????????530??2008-10-14?02:13??CompressImgsWindows\CompressImgs.csproj.user
?????文件???????1756??2008-09-29?20:49??CompressImgsWindows\l.xs_2008-9-29.pfx
?????文件???????2987??2008-09-28?09:16??CompressImgsWindows\MyClass.cs
?????文件???????1610??2008-10-24?01:19??CompressImgsWindows\obj\Debug\CompressImgs.csproj.FileListAbsolute.txt
?????文件????????860??2008-10-24?01:19??CompressImgsWindows\obj\Debug\CompressImgs.csproj.GenerateResource.Cache
?????文件??????49152??2008-10-24?03:41??CompressImgsWindows\obj\Debug\CompressImgs.exe
?????文件??????38400??2008-10-24?03:41??CompressImgsWindows\obj\Debug\CompressImgs.pdb
?????文件????????180??2008-10-24?01:19??CompressImgsWindows\obj\Debug\CompressImgs.Properties.Resources.resources
?????文件????????180??2008-10-24?01:19??CompressImgsWindows\obj\Debug\CompressImgsWindows.Form1.resources
?????文件???????4608??2008-09-28?10:35??CompressImgsWindows\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
?????文件????????934??2008-09-27?12:36??CompressImgsWindows\obj\Debug\WindowsFormsApplication1.csproj.FileListAbsolute.txt
?????文件????????905??2008-08-28?16:22??CompressImgsWindows\obj\Debug\WindowsFormsApplication1.csproj.GenerateResource.Cache
?????文件????????180??2008-08-28?16:22??CompressImgsWindows\obj\Debug\WindowsFormsApplication1.Form2.resources
?????文件???????5999??2008-10-24?03:32??CompressImgsWindows\Program.cs
?????文件???????1388??2008-08-01?17:31??CompressImgsWindows\Properties\AssemblyInfo.cs
?????文件???????2848??2008-09-28?10:34??CompressImgsWindows\Properties\Resources.Designer.cs
?????文件???????5612??2008-08-01?17:31??CompressImgsWindows\Properties\Resources.resx
?????文件???????1110??2008-09-28?10:34??CompressImgsWindows\Properties\Settings.Designer.cs
?????文件????????249??2008-08-01?17:31??CompressImgsWindows\Properties\Settings.settings
?????文件??????30214??2008-09-29?20:35??CompressImgsWindows\VeryCD.ico
?????文件????1795072??2008-03-20?13:04??CompressImgsWindows\圖片壓縮.exe
............此處省略18個文件信息
評論
共有 條評論