• 大小: 3.78MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-12
  • 语言: 其他
  • 标签: 地图下载  

资源简介

地图下载工具代码,可以下载各个图层的地图切片

资源截图

代码片段和文件信息

using System;
using System.Drawing;
using System.IO;


namespace ColorProcess
{
    public class CountSizeAndSingleColor
    {
     
       
        private long totalFileSize;
        private long total;
        private long single;
        private string targetdir;
        private string[] singleImageSize = new string[]{“908““122“};

        public CountSizeAndSingleColor(string targetdir)
        {
            this.targetdir = targetdir;
        }

        public CountSizeAndSingleColor(string text string[] singleImageSize)
        {
            this.singleImageSize = singleImageSize;
            targetdir = text;
        }
        public void start()
        {
            doWork(targetdir);
            string r = string.Format(“统计完毕:单色文件{0} 总数{1} 除去单色后总大小{2:.##}m“ single total totalFileSize/(1024*1024.0));
            File.WriteAllText(targetdir+“\\统计结果.txt“r);
          
        }

        private  void doWork(string dir)
        {
           
            string[] fs = Directory.GetFiles(dir “*.gif“);

            foreach (string f in fs)
            {
                total += 1;
                FileInfo fileInfo = new FileInfo(f);

                //if (Array.IndexOf(singleImageSizefileInfo.Length.ToString())!=-1)
                if (fileInfo.Length==908)
                {
                    try
                    {
                        Image image = Image.FromFile(f);
                        Bitmap bitmap = new Bitmap(image);
                        Color rgb;
                        //bool isSingle = MapCache.IsSingleColor(image out rgb);
                        rgb = bitmap.GetPixel(0 0);
                        image.Dispose();
                        //如果是同色图片

                        Byte[] buf = new byte[] { rgb.R rgb.G rgb.B };

                        File.WriteAllBytes(f buf);
                        single++;






                    }
                    catch (Exception e)
                    {

                    }

                }
                else
                {
                    totalFileSize += fileInfo.Length;
                }
               


            }
            string[] folders = Directory.GetDirectories(dir);
            foreach (string folder in folders)
            {
                doWork(folder);
            }


        }

    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        144  2013-04-26 10:32  GMapClient\app.config

     文件       6144  2013-04-26 10:33  GMapClient\bin\Debug\ColorProcess.exe

     文件        144  2013-04-26 10:32  GMapClient\bin\Debug\ColorProcess.exe.config

     文件      17920  2013-04-26 10:33  GMapClient\bin\Debug\ColorProcess.pdb

     文件      37888  2013-04-26 16:44  GMapClient\bin\Debug\GMapClient.exe

     文件        144  2013-04-26 10:32  GMapClient\bin\Debug\GMapClient.exe.config

     文件      71168  2013-04-26 16:44  GMapClient\bin\Debug\GMapClient.pdb

     文件      11592  2013-05-14 10:40  GMapClient\bin\Debug\GMapClient.vshost.exe

     文件        144  2013-04-26 10:32  GMapClient\bin\Debug\GMapClient.vshost.exe.config

     文件        490  2010-03-17 22:39  GMapClient\bin\Debug\GMapClient.vshost.exe.manifest

     文件      24576  2008-09-17 11:38  GMapClient\bin\Debug\ImageQuantization.dll

     文件      38400  2008-09-17 11:38  GMapClient\bin\Debug\ImageQuantization.pdb

     文件        110  2008-10-16 14:18  GMapClient\bin\Debug\k.gif

     文件      37376  2013-04-26 16:44  GMapClient\bin\Debug\MapLib.dll

     文件     173568  2013-04-26 16:44  GMapClient\bin\Debug\MapLib.pdb

     文件        160  2008-10-09 20:55  GMapClient\bin\Debug\vssver.scc

     文件      94938  2008-10-31 18:05  GMapClient\bin\Debug.rar

     文件       2420  2008-10-30 09:59  GMapClient\FileOpreator\CountSizeAndSingleColor.cs

     文件       1699  2008-10-31 17:06  GMapClient\FileOpreator\FileProcessMake.cs

     文件      20243  2013-04-26 11:30  GMapClient\Form1.cs

     文件      54765  2013-04-26 11:24  GMapClient\Form1.Designer.cs

     文件       6437  2013-04-26 11:24  GMapClient\Form1.resx

     文件       5580  2013-04-26 10:32  GMapClient\GMapClient.csproj

     文件        452  2013-04-26 10:32  GMapClient\GMapClient.csproj.user

     文件       5847  2013-04-26 16:44  GMapClient\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        204  2013-04-26 11:24  GMapClient\obj\Debug\GenerateResource.read.1.tlog

     文件        502  2013-04-26 11:24  GMapClient\obj\Debug\GenerateResource.write.1.tlog

     文件       3674  2013-05-14 10:40  GMapClient\obj\Debug\GMapClient.csproj.FileListAbsolute.txt

     文件        847  2008-10-31 17:34  GMapClient\obj\Debug\GMapClient.csproj.GenerateResource.Cache

     文件      37888  2013-04-26 16:44  GMapClient\obj\Debug\GMapClient.exe

............此处省略577个文件信息

评论

共有 条评论