C# Class KEngine.KHttpDownloader

多线程+断点续传 http下载器, 注意用完后要Dispose TODO: 线程的回调Callback有点难看,以后弄个KHttpDownloader2(本类稳定就不改本类)
Inheritance: UnityEngine.MonoBehaviour, IDisposable
显示文件 Open project: mr-kelly/KEngine Class Usage Examples

Public Properties

Property Type Description
Progress float
TotalSize int

Public Methods

Method Description
Dispose ( ) : void
GetDatas ( ) : byte[]
GetFullSavePath ( string relativePath ) : string
Load ( string fullUrl, string saveFullPath, bool useContinue = false, bool useCache = false, int expireDays = 1, int timeout = 5 ) : KHttpDownloader

Load ( string fullUrl, string saveFullPath, int expireDays, int timeout = 5 ) : KHttpDownloader

Private Methods

Method Description
Init ( string fullUrl, string saveFullPath, bool useContinue, bool useCache = false, int expireDays = 1, int timeout = 10 ) : void
KHttpDownloader ( ) : System
OnDestroy ( ) : void
OnFinish ( ) : void
StartDownload ( string fullUrl ) : IEnumerator
ThreadableResumeDownload ( string url, int>.Action stepCallback, System.Action errorCallback, System.Action successCallback ) : void

Method Details

Dispose() public method

public Dispose ( ) : void
return void

GetDatas() public method

public GetDatas ( ) : byte[]
return byte[]

GetFullSavePath() public static method

public static GetFullSavePath ( string relativePath ) : string
relativePath string
return string

Load() public static method

public static Load ( string fullUrl, string saveFullPath, bool useContinue = false, bool useCache = false, int expireDays = 1, int timeout = 5 ) : KHttpDownloader
fullUrl string
saveFullPath string 完整的保存路径!
useContinue bool 是否断点续传
useCache bool 如果存在则不下载了!
expireDays int
timeout int
return KHttpDownloader

Load() public static method

public static Load ( string fullUrl, string saveFullPath, int expireDays, int timeout = 5 ) : KHttpDownloader
fullUrl string
saveFullPath string
expireDays int
timeout int
return KHttpDownloader

Property Details

Progress public_oe property

public float Progress
return float

TotalSize public_oe property

public int TotalSize
return int