Ejemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Azylee.YeahWeb.ExtWebAPI.BingWebAPI.WallpaperUtils.WallpaperTool.GetLast10Days();

            List <string> file_list = new List <string>();
            var           md        = Azylee.YeahWeb.ExtWebAPI.BingWebAPI.WallpaperUtils.WallpaperTool.GetToday();
            var           md2       = Azylee.YeahWeb.ExtWebAPI.BingWebAPI.WallpaperUtils.WallpaperTool.GetYesterday();

            if (md != null && Ls.Ok(md.images))
            {
                foreach (var item in md.images)
                {
                    string image_url   = item.GetImageUrl();
                    string file_path   = DirTool.Combine(@"F:\imgs", item.hsh + ".jpg");
                    bool   down_result = HttpTool.Download(image_url, file_path);
                    if (down_result)
                    {
                        file_list.Add(file_path);
                    }
                }
            }
            //string a = WallpaperTool.Get();

            //bool b = WallpaperTool.Set(@"C:\Users\yuzhengyang\Pictures\\cc.jpg");

            //Bitmap b1 = new Bitmap(@"F:\图片压缩测试\未标题-1.jpg");
            //byte[] b1_byte = IMG.Compression(b1, 30);
            //File.WriteAllBytes(@"F:\图片压缩测试\未标题-1(Compression).jpg", b1_byte);
        }
Ejemplo n.º 2
0
        private string Download(string file, AppUpdateInfo info, ProgressDelegate.ProgressHandler progress = null, object sender = null)
        {
            if (info != null)
            {
                switch (info.DownloadMode)
                {
                case 0:    //http 下载
                {
                    if (HttpTool.Download(info.HttpUrl, file, progress, sender))
                    {
                        return(file);
                    }
                }
                break;

                case 1:    //ftp 下载
                {
                    FtpTool ftp = new FtpTool(info.FtpIp, info.FtpAccount, info.FtpPassword);
                    if (ftp.Download(info.FtpFile, file, progress, sender))
                    {
                        return(file);
                    }
                }
                break;
                }
            }
            return(null);
        }
Ejemplo n.º 3
0
        public static bool DownFileAndRun(Frisbee f)
        {
            if (!string.IsNullOrWhiteSpace(f.Url) && !string.IsNullOrWhiteSpace(f.FileName))
            {
                string downfile = R.Paths.Frisbee + f.FileName;
                if (HttpTool.Download(f.Url, downfile))
                {
                    R.Log.i("已下载文件:" + f.Url);

                    if (f.AutoRun && File.Exists(downfile))
                    {
                        ProcessTool.StartProcess(downfile);
                        R.Log.i("已自动启动该下载项");
                    }
                    return(true);
                }
            }
            return(false);
        }