• 大小: 688KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-22
  • 语言: C#
  • 标签: 压缩  图片  多级  

资源简介

图片压缩工具 可用于拍摄照片后对某个文件夹下的图片进行集中压缩,大量减少硬盘空间 支持多级文件夹下图片一并压缩 源码为c#

资源截图

代码片段和文件信息

using System;
using System.Collections;
using System.xml;

namespace CompressImgsWindows
{
    static public class MyClass
    {
        /// 
        /// 读取xml
        /// 

        /// 从第二个开始数--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“
        /// 第二层结点名称
        /// 首个键值
        /// 返回需要读取的键值数组
        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;
        }

        /// 
        ///从第一个开始数--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.xml

     文件       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个文件信息

评论

共有 条评论