| | |
| | | } |
| | | } |
| | | |
| | | AssetVersion assetVersion; |
| | | public AssetVersion assetVersion { get; private set; } |
| | | protected string mRemoteFile; |
| | | protected string localFile; |
| | | bool speedLimit = false; |
| | |
| | | |
| | | public static void Prepare()
|
| | | {
|
| | | gDownloadIsRunningCount = 0;
|
| | | gStartTickcount = System.Environment.TickCount;
|
| | | TotalDownloadedSize = 0L;
|
| | | downloadSpeedRef = 0f;
|
| | |
| | | }
|
| | |
|
| | | stop = true;
|
| | |
|
| | | if (headRequest != null)
|
| | | try
|
| | | {
|
| | | headRequest.Abort();
|
| | | headRequest = null;
|
| | | if (headRequest != null)
|
| | | {
|
| | | headRequest.Abort();
|
| | | headRequest = null;
|
| | | }
|
| | |
|
| | | if (headResponse != null)
|
| | | {
|
| | | headResponse.Close();
|
| | | headResponse = null;
|
| | | }
|
| | |
|
| | | if (fileRequest != null)
|
| | | {
|
| | | fileRequest.Abort();
|
| | | fileRequest = null;
|
| | | }
|
| | |
|
| | | if (fileResponse != null)
|
| | | {
|
| | | fileResponse.Close();
|
| | | fileResponse = null;
|
| | | }
|
| | |
|
| | | if (fs != null)
|
| | | {
|
| | | fs.Flush();
|
| | | fs.Close();
|
| | | fs = null;
|
| | | }
|
| | |
|
| | | if (inStream != null)
|
| | | {
|
| | | inStream.Close();
|
| | | inStream = null;
|
| | | }
|
| | | }
|
| | |
|
| | | if (headResponse != null)
|
| | | catch (Exception ex)
|
| | | {
|
| | | headResponse.Close();
|
| | | headResponse = null;
|
| | | Debug.Log(ex);
|
| | | }
|
| | |
|
| | | if (fileRequest != null)
|
| | | finally
|
| | | {
|
| | | fileRequest.Abort();
|
| | | fileRequest = null;
|
| | | }
|
| | |
|
| | | if (fileResponse != null)
|
| | | {
|
| | | fileResponse.Close();
|
| | | fileResponse = null;
|
| | | }
|
| | |
|
| | | if (fs != null)
|
| | | { |
| | | fs.Flush(); |
| | | fs.Close(); |
| | | fs = null; |
| | | } |
| | | |
| | | if (inStream != null)
|
| | | { |
| | | inStream.Close(); |
| | | inStream = null; |
| | | } |
| | | |
| | | onCompleted = null; |
| | | mHadError = false;
|
| | |
|
| | | if (state == State.Working)
|
| | | {
|
| | | gDownloadIsRunningCount--;
|
| | | onCompleted = null;
|
| | | mHadError = false;
|
| | | if (state == State.Working)
|
| | | {
|
| | | gDownloadIsRunningCount--;
|
| | | }
|
| | | }
|
| | | } |
| | |
|
| | |
| | | headResponse.Close(); |
| | | headResponse = null; |
| | | } |
| | | headRequest.Abort(); |
| | | if (headRequest != null)
|
| | | {
|
| | | headRequest.Abort();
|
| | | headRequest = null;
|
| | | } |
| | | } |
| | | |
| | | }, headRequest); |
| | |
| | | if (mHadError)
|
| | | { |
| | | DebugEx.LogWarningFormat("获取远程文件{0} 信息失败!", mRemoteFile); |
| | | headRequest.Abort(); |
| | | if (headRequest != null)
|
| | | {
|
| | | headRequest.Abort();
|
| | | headRequest = null;
|
| | | } |
| | | |
| | | done = true; |
| | | gDownloadIsRunningCount--; |
| | | yield break; |