/// <summary> /// Cancel downloader, now only can stop the stream read process /// </summary> public void Cancel() { if (Requester != null) { Requester.Cancel(); } Error = new CancelException(); IsFinished = true; }
/// <summary> /// Force stop the requester /// </summary> public void Cancel() { if (Response != null) { Response.Close(); } if (ResponseStream != null) { ResponseStream.Close(); // 注意,要用close而不是disposed进行取消操作! } // if (DataStream != null) // { // DataStream.Close(); // } if (!IsFinished) { Error = new CancelException(); IsFinished = true; } }