private void calcSize()
        {
            this.workers = new List<Worker>();
            HttpWebResponse res = HttpUtil.getInstance().get(url, 0, SysConfig.DOWNLOAD_UNIT);
            HttpStatusCode status = res.StatusCode;
            res.GetResponseStream().Close();
            res.Close();
            if (status == HttpStatusCode.OK)
            {
                Worker worker = new Worker(this, new DownloadRange(0, size - 1));
                worker.onWorkerStatusChanged += this.OnWorkerStatusChanged;
                this.size = res.ContentLength;
                workers.Add(worker);
            }
            else if (status == HttpStatusCode.PartialContent)
            {
                string contentRange = res.Headers["Content-Range"];
                int lenIndex = contentRange.LastIndexOf('/');
                string lenStr = contentRange.Substring(lenIndex + 1, contentRange.Length - 1 - lenIndex);// = contentRange.Substring();//bytes 0-100/12690720
                this.size = Int32.Parse(lenStr);
                List<DownloadRange> ranges = DownloadRange.splitRange(0, size, SysConfig.WORKERS_NUM);
                foreach (DownloadRange range in ranges)
                {
                    Worker worker = new Worker(this, range);
                    worker.onWorkerStatusChanged += this.OnWorkerStatusChanged;
                    workers.Add(worker);
                    Console.WriteLine(range.from + "," + range.to);
                }
            }
            else
            {

                throw new Exception("error http status:" + status);
            }
        }
 public void rebootWorker(Worker worker)
 {
     worker.doWork();
 }