bool Download(string name, string md5, bool isHide, bool ignore_sound) { string file = Config.GetPath(name); if (ignore_sound && (name.EndsWith(".mp3", StringComparison.OrdinalIgnoreCase) || name.EndsWith(".ogg", StringComparison.OrdinalIgnoreCase) || name.EndsWith(".wav", StringComparison.OrdinalIgnoreCase))) //ignores sound { Console.WriteLine("SOUND IGNORED:" + name); showProcess(num++, all_num); return(true); } if (File.Exists(file)) { if (md5 == MyUtil.MD5_File(file)) //一致 { Console.WriteLine("SKIPPED:" + name); showProcess(num++, all_num); return(true); } else if (MyUtil.checkList(Config.ignores, name)) //忽略更新 { Console.WriteLine("IGNORED:" + name); showProcess(num++, all_num); return(true); } } //线程已满 while (MyHttp.NUM >= MyHttp.MAX_NUM) { //System.Threading.Thread.Sleep(100); } //下载文件 new MyHttp(Config.GetUrl(name), file, new fileinfo(name, md5)).Start(); return(true); //return MyHttp.DownLoad(url_download+name,file); }
bool Download(string name, string md5, bool isHide) { string file = Config.GetPath(name); if (File.Exists(file)) { if (md5 == MyUtil.MD5_File(file)) //一致 { Console.WriteLine("SKIPPED:" + name); showProcess(num++, all_num); return(true); } else { if (MyUtil.checkList(Config.ignores, name)) //忽略更新 { Console.WriteLine("IGNORED:" + name); showProcess(num++, all_num); return(true); } } } //线程已满 while (MyHttp.NUM >= MyHttp.MAX_NUM) { //System.Threading.Thread.Sleep(100); } //下载文件 new MyHttp(Config.GetUrl(name), file, new fileinfo(name, md5)).Start(); return(true); //return MyHttp.DownLoad(url_download+name,file); }
void AddFile(string file) { string filename = Path.GetFileName(file); string exename = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; if (filename.EndsWith("Thumbs.db", StringComparison.OrdinalIgnoreCase) || filename.EndsWith(".gitignore", StringComparison.OrdinalIgnoreCase) || filename.EndsWith("LICENSE", StringComparison.OrdinalIgnoreCase) || filename.EndsWith("appveyor.yml", StringComparison.OrdinalIgnoreCase) || filename.EndsWith(".travis.yml", StringComparison.OrdinalIgnoreCase) || filename.EndsWith("circle.yml", StringComparison.OrdinalIgnoreCase) || filename.EndsWith("README.md", StringComparison.OrdinalIgnoreCase) || filename.EndsWith("web.config", StringComparison.OrdinalIgnoreCase) || filename.EndsWith("update-server.bat", StringComparison.OrdinalIgnoreCase) || filename.EndsWith("desktop.ini", StringComparison.OrdinalIgnoreCase) || filename.EndsWith("start.htm", StringComparison.OrdinalIgnoreCase) || filename.EndsWith("update.exe.config", StringComparison.OrdinalIgnoreCase) || file == exename || file == exename + ".config" ) { return; } //处理名字 string name = file.Replace(Config.workPath, ""); name = name.Replace(Path.DirectorySeparatorChar, '/'); if (name.IndexOf('/') == 0) { name = name.Substring(1); } if (MyUtil.checkList(Config.ignores, name)) { return; } string md5 = MyUtil.MD5_File(file); if (!ci) { Console.WriteLine("FILE: "+ name); Console.WriteLine("MD5: " + md5); } list.Add(new fileinfo(name, md5)); }