void Download() { DownloadSubTask subTask = task_.GetSubTask(); while (subTask != null) { byte[] data = HttpDownloadRange.Download(subTask.RemotePath, subTask.from, subTask.to); if (data == null) { Console.WriteLine("download error"); break; } subTask.data = data; var b = task_.UpdateTaskState(subTask, 2); if (b) { Console.WriteLine("download finish"); break; } subTask = task_.GetSubTask(); } }