public void Start(string root, string fillname, Action <HttpDownload, long> update = null, Action <HttpDownload, bool> finish = null, Action <HttpDownload, enDownloadErrorState> error = null) { Abort(); Root = root; LocalName = fillname; IsDone = false; Length = 0; CompleteLength = 0; update_callback = update; finish_callback = finish; error_callback = error; ErrorCode = enDownloadErrorState.None; m_content = new DownLoadContent(FullName); Download(); }
private void OnFailed(enDownloadErrorState state) { lock (lock_obj){ if (m_content != null) { m_content.State = enDownloadState.Failed; m_content.Close(); m_content = null; } if (m_httpwebrequest != null) { m_httpwebrequest.Abort(); m_httpwebrequest = null; } IsDone = true; ErrorCode = state; if (error_callback != null) { error_callback(this, ErrorCode); } } }