/// <summary> /// Called just before the thread finishes, regardless of status, to take any /// necessary action on the downloaded file. /// </summary> /// <param name="state"> /// The state. /// </param> /// <param name="finalStatus"> /// The final Status. /// </param> private static void CleanupDestination(State state, ExpansionDownloadStatus finalStatus) { CloseDestination(state); if (state.Filename != null && finalStatus.IsError() && File.Exists(state.Filename)) { File.Delete(state.Filename); state.Filename = null; } }
/// <summary> /// Returns whether the download has completed (either with success or /// error). /// </summary> /// <param name="status"> /// The status. /// </param> /// <returns> /// The is status completed. /// </returns> public static bool IsCompleted(this ExpansionDownloadStatus status) { return(status.IsSuccess() || status.IsError()); }