From eda22bcd9683f3a94e0744da60d23808272c627f Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期一, 13 八月 2018 17:28:00 +0800
Subject: [PATCH] 1528 冰晶矿脉里面角色死亡复活后怪物血条位置显示异常

---
 System/AssetVersion/RemoteFile.cs |  564 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 282 insertions(+), 282 deletions(-)

diff --git a/System/AssetVersion/RemoteFile.cs b/System/AssetVersion/RemoteFile.cs
index f66ec9d..069e94e 100644
--- a/System/AssetVersion/RemoteFile.cs
+++ b/System/AssetVersion/RemoteFile.cs
@@ -8,11 +8,11 @@
 using System;
 using System.Threading;
 
-public class RemoteFile
-{
+public class RemoteFile
+{
     static bool m_ProcessErroring = false;
-    public static bool processErroring {
-        get { return m_ProcessErroring; }
+    public static bool processErroring {
+        get { return m_ProcessErroring; }
     }
 
     public static int maxDownLoadTask = 48;
@@ -29,8 +29,8 @@
         get {
             return System.Threading.Interlocked.Read(ref gTotalDownloadSize);
         }
-        set {
-            gTotalDownloadSize = value;
+        set {
+            gTotalDownloadSize = value;
         }
     }
 
@@ -40,34 +40,34 @@
     public static string DownloadSpeed {
         get {
             float speed = downloadSpeedRef;
-            if (RemoteFile.gStartTickcount != 0)
+            if (RemoteFile.gStartTickcount != 0)
             {
                 float second = Mathf.Abs(System.Environment.TickCount - RemoteFile.gStartTickcount) / 1000f;
-                if (second > 1f || (downloadSpeedRef <= 0.1f && TotalDownloadedSize > 0))
+                if (second > 1f || (downloadSpeedRef <= 0.1f && TotalDownloadedSize > 0))
                 {
-                    if (second > 0f)
+                    if (second > 0f)
                     {
                         var delta = TotalDownloadedSize - downloadSizeRef;
-                        downloadSizeRef = TotalDownloadedSize;
-
-                        speed = (delta / second + downloadSpeedRef) * 0.5f;
-                        downloadSpeedRef = speed;
-                        RemoteFile.gStartTickcount = System.Environment.TickCount;
+                        downloadSizeRef = TotalDownloadedSize;
+
+                        speed = (delta / second + downloadSpeedRef) * 0.5f;
+                        downloadSpeedRef = speed;
+                        RemoteFile.gStartTickcount = System.Environment.TickCount;
                     }
                 }
-            }
-
-            if (speed > 1048576f)
-            {
-                return StringUtility.Contact((speed / 1048576f).ToString("f1"), " M/S");
-            }
-            else if (speed > 1024f)
-            {
-                return StringUtility.Contact((speed / 1024f).ToString("f1"), " KB/S");
-            }
-            else
-            {
-                return StringUtility.Contact(speed.ToString("f1"), " B/S");
+            }
+
+            if (speed > 1048576f)
+            {
+                return StringUtility.Contact((speed / 1048576f).ToString("f1"), " M/S");
+            }
+            else if (speed > 1024f)
+            {
+                return StringUtility.Contact((speed / 1024f).ToString("f1"), " KB/S");
+            }
+            else
+            {
+                return StringUtility.Contact(speed.ToString("f1"), " B/S");
             }
         }
     }
@@ -85,15 +85,15 @@
     public static long TotalRemoteFileSize = 0L;
 
     const int bufferSize = 8192;
-    byte[] buff;
-
-    HttpWebRequest headRequest;
-    HttpWebResponse headResponse;
-    HttpWebRequest fileRequest = null;
-    HttpWebResponse fileResponse = null;
-
-    Action<bool, AssetVersion> onCompleted;
-
+    byte[] buff;
+
+    HttpWebRequest headRequest;
+    HttpWebResponse headResponse;
+    HttpWebRequest fileRequest = null;
+    HttpWebResponse fileResponse = null;
+
+    Action<bool, AssetVersion> onCompleted;
+
     protected bool mHadError = false;
     public bool HaveError {
         get { return mHadError; }
@@ -102,17 +102,17 @@
     bool m_Done = false;
     public bool done {
         get { return m_Done; }
-        private set {
-            m_Done = value;
-            if (value)
-            {
-                state = State.Stoped;
-                if (onCompleted != null)
-                {
-                    onCompleted(!HaveError, assetVersion);
-                    onCompleted = null;
-                }
-            }
+        private set {
+            m_Done = value;
+            if (value)
+            {
+                state = State.Stoped;
+                if (onCompleted != null)
+                {
+                    onCompleted(!HaveError, assetVersion);
+                    onCompleted = null;
+                }
+            }
         }
     }
 
@@ -121,147 +121,147 @@
     int read_Stream_startTickcount = 0; //璇锋眰鎿嶄綔寮�濮�,鐢ㄤ簬瓒呮椂鍒ゆ柇
     int timeOut = 5000; //瓒呮椂鏃堕棿
 
-    public static void Prepare()
-    {
-        gStartTickcount = System.Environment.TickCount;
-        TotalDownloadedSize = 0L;
-        downloadSpeedRef = 0f;
-        downloadSizeRef = 0L;
+    public static void Prepare()
+    {
+        gStartTickcount = System.Environment.TickCount;
+        TotalDownloadedSize = 0L;
+        downloadSpeedRef = 0f;
+        downloadSizeRef = 0L;
     }
 
-    public void Init(string remoteFile, string _localFile, AssetVersion _assetVersion, bool _speedLimit = false)
-    {
+    public void Init(string remoteFile, string _localFile, AssetVersion _assetVersion, bool _speedLimit = false)
+    {
         mRemoteFile = remoteFile;
         localFile = _localFile;
         assetVersion = _assetVersion;
         this.speedLimit = _speedLimit;
     }
 
-    public void Begin(Action<bool, AssetVersion> _onCompleted)
-    {
-        onCompleted = _onCompleted;
-        SnxxzGame.Instance.StartCoroutine(Co_DownloadRemoteFile());
-    }
-
-    bool stop = false;
-
-    public void Stop()
-    {
-        if (stop)
-        {
-            return;
-        }
-
-        stop = true;
-
-        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)
+    public void Begin(Action<bool, AssetVersion> _onCompleted)
+    {
+        onCompleted = _onCompleted;
+        SnxxzGame.Instance.StartCoroutine(Co_DownloadRemoteFile());
+    }
+
+    bool stop = false;
+
+    public void Stop()
+    {
+        if (stop)
+        {
+            return;
+        }
+
+        stop = true;
+
+        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)
+        if (inStream != null)
         {
             inStream.Close();
             inStream = null;
         }
 
         onCompleted = null;
-        mHadError = false;
-
-        if (state == State.Working)
-        {
-            gDownloadIsRunningCount--;
-        }
+        mHadError = false;
+
+        if (state == State.Working)
+        {
+            gDownloadIsRunningCount--;
+        }
     }
-
-    private void OnDispose()
-    {
-
-    }
-
-    void MakeSureDirectory(string filePath)
+
+    private void OnDispose()
+    {
+
+    }
+
+    void MakeSureDirectory(string filePath)
     {
         string dir = Path.GetDirectoryName(filePath);
-        if (!Directory.Exists(dir))
-        {
-            Directory.CreateDirectory(dir);
+        if (!Directory.Exists(dir))
+        {
+            Directory.CreateDirectory(dir);
         }
     }
 
-    bool Move(string sourceFile, string destFile)
+    bool Move(string sourceFile, string destFile)
     {
         bool ret = true;
 #if !UNITY_WEBPLAYER
-        try
-        {
-            if (speedLimit)
-            {
-                ThreadPool.QueueUserWorkItem((object _obj) =>
-                {
-                    File.Move(sourceFile, destFile);
-                });
-            }
-            else
-            {
-                File.Move(sourceFile, destFile);
-            }
+        try
+        {
+            if (speedLimit)
+            {
+                ThreadPool.QueueUserWorkItem((object _obj) =>
+                {
+                    File.Move(sourceFile, destFile);
+                });
+            }
+            else
+            {
+                File.Move(sourceFile, destFile);
+            }
         }
-        catch (Exception ex)
-        {
+        catch (Exception ex)
+        {
             DesignDebug.LogError(ex.Message);
             ret = false;
         }
 #endif
         return ret;
-    }
+    }
+
+    IEnumerator Co_DownloadRemoteFile()
+    {
+        done = false;
 
-    IEnumerator Co_DownloadRemoteFile()
-    {
-        done = false;
-
-        while (gDownloadIsRunningCount >= maxDownLoadTask)
-        {
-            if (stop)
-            {
-                yield break;
-            }
-            //瓒呰繃鏈�澶т换鍔℃暟鏃�,鍏堢瓑寰�
-            yield return null;
+        while (gDownloadIsRunningCount >= maxDownLoadTask)
+        {
+            if (stop)
+            {
+                yield break;
+            }
+            //瓒呰繃鏈�澶т换鍔℃暟鏃�,鍏堢瓑寰�
+            yield return null;
         }
 
-        while (assetVersion != null && assetVersion.extersion == ".manifest" && !AssetVersionUtility.GetAssetVersion(assetVersion.relativePath.Replace(".manifest", "")).localValid)
-        {
-            if (stop)
-            {
-                yield break;
-            }
-            yield return null;
+        while (assetVersion != null && assetVersion.extersion == ".manifest" && !AssetVersionUtility.GetAssetVersion(assetVersion.relativePath.Replace(".manifest", "")).localValid)
+        {
+            if (stop)
+            {
+                yield break;
+            }
+            yield return null;
         }
 
         state = State.Working;
@@ -275,10 +275,10 @@
         mLocalLastModified = DateTime.MinValue;
         long localFileSize = 0L;
 #if !UNITY_WEBPLAYER
-        mLocalLastModified = File.GetLastWriteTime(mLocalFileTemp);
+        mLocalLastModified = File.GetLastWriteTime(mLocalFileTemp);
 #endif
         headRequest = (HttpWebRequest)System.Net.WebRequest.Create(mRemoteFile);
-        if (headRequest.ServicePoint.ConnectionLimit < RemoteFile.MaxConnectLimit)
+        if (headRequest.ServicePoint.ConnectionLimit < RemoteFile.MaxConnectLimit)
         {
             headRequest.ServicePoint.ConnectionLimit = RemoteFile.MaxConnectLimit;
         }
@@ -291,20 +291,20 @@
         bool headRequestOk = false; //鏄惁鏀寔鏂偣缁紶
 
         int tick1 = 0;
-        try
+        try
         {
             headRequest.BeginGetResponse( //鏀逛负寮傛鐨勬柟娉�
-                (x) =>
+                (x) =>
                 {
-                    try
+                    try
                     {
                         headResponse = (x.AsyncState as HttpWebRequest).EndGetResponse(x) as HttpWebResponse;
                         mRemoteLastModified = headResponse.LastModified;
                         mRemoteFileSize = headResponse.ContentLength;
-                        if (headResponse.Headers["Accept-Ranges"] != null)
+                        if (headResponse.Headers["Accept-Ranges"] != null)
                         {
                             string s = headResponse.Headers["Accept-Ranges"];
-                            if (s == "none")
+                            if (s == "none")
                             {
                                 isAcceptRange = false;
                             }
@@ -312,14 +312,14 @@
                         System.Threading.Interlocked.Add(ref RemoteFile.TotalRemoteFileSize, mRemoteFileSize);
                         headRequestOk = true;
                     }
-                    catch (Exception ex)
+                    catch (Exception ex)
                     {
                         DesignDebug.LogWarning("ERROR: " + ex);
                         mHadError = true;
                     }
-                    finally
+                    finally
                     {
-                        if (headResponse != null)
+                        if (headResponse != null)
                         {
                             headResponse.Close();
                             headResponse = null;
@@ -330,7 +330,7 @@
                 }, headRequest);
             tick1 = System.Environment.TickCount;
         }
-        catch (WebException webEx)
+        catch (WebException webEx)
         {
             DesignDebug.LogWarning("<color=red>Request File Head ERROR: " + mRemoteFile + "</color>");
             DesignDebug.LogWarning("ERROR: " + webEx);
@@ -339,7 +339,7 @@
             done = true;
             yield break;
         }
-        catch (System.Exception e)
+        catch (System.Exception e)
         {
             DesignDebug.LogWarning("<color=red>Request File Head ERROR: " + mRemoteFile + "</color>");
             DesignDebug.LogWarning("ERROR: " + e);
@@ -349,20 +349,20 @@
             yield break;
         }
 
-        while (!headRequestOk && !mHadError)
-        {
-            if (stop)
-            {
-                yield break;
+        while (!headRequestOk && !mHadError)
+        {
+            if (stop)
+            {
+                yield break;
             }
 
-            if (processErroring)
+            if (processErroring)
             {
                 mHadError = true;
                 break;
             }
             float dur = System.Environment.TickCount - tick1;
-            if (dur > timeOut)
+            if (dur > timeOut)
             {
                 DesignDebug.LogWarningFormat("鑾峰彇杩滅▼鏂囦欢{0} 淇℃伅瓒呮椂!", mRemoteFile);
                 mHadError = true;
@@ -370,7 +370,7 @@
             }
             yield return null;
         }
-        if (mHadError)
+        if (mHadError)
         {
             DesignDebug.LogWarningFormat("鑾峰彇杩滅▼鏂囦欢{0} 淇℃伅澶辫触!", mRemoteFile);
             headRequest.Abort();
@@ -380,77 +380,77 @@
         }
 
         //鍒ゆ柇鏄惁鏈夊凡缁忎笅杞介儴鍒嗙殑涓存椂鏂囦欢
-        if (File.Exists(mLocalFileTemp))
+        if (File.Exists(mLocalFileTemp))
         { // This will not work in web player!
             //鍒ゆ柇鏄惁鏂偣缁紶, 渚濇嵁涓存椂鏂囦欢鏄惁瀛樺湪,浠ュ強淇敼鏃堕棿鏄惁灏忎簬鏈嶅姟鍣ㄦ枃浠舵椂闂�
 #if !UNITY_WEBPLAYER
             localFileSize = (File.Exists(mLocalFileTemp)) ? (new FileInfo(mLocalFileTemp)).Length : 0L;
 #endif
             bool outDated = IsOutdated;
-            if (localFileSize == mRemoteFileSize && !outDated)
+            if (localFileSize == mRemoteFileSize && !outDated)
             {
                 gDownloadIsRunningCount--;
                 done = true;
                 mHadError = !Move(mLocalFileTemp, localFile);//鎶婁复鏃舵枃浠舵敼鍚嶄负姝e紡鏂囦欢
                 yield break; // We already have the file, early out
             }
-            else if (localFileSize > mRemoteFileSize || outDated)
+            else if (localFileSize > mRemoteFileSize || outDated)
             {
                 if (!outDated) DesignDebug.LogWarning("Local file is larger than remote file, but not outdated. PANIC!");
-                if (outDated)
+                if (outDated)
                 {
                     DesignDebug.LogWarning(mLocalFileTemp + " Local file is outdated, deleting");
                 }
-                try
+                try
                 {
                     if (File.Exists(mLocalFileTemp))
                         File.Delete(mLocalFileTemp);
                 }
-                catch (System.Exception e)
+                catch (System.Exception e)
                 {
                     DesignDebug.LogWarning("<color=red>Could not delete local file</color>");
                     DesignDebug.LogError(e);
                 }
 
-                while (File.Exists(mLocalFileTemp))
-                {
-                    if (stop)
-                    {
-                        yield break;
-                    }
-                    yield return null;
+                while (File.Exists(mLocalFileTemp))
+                {
+                    if (stop)
+                    {
+                        yield break;
+                    }
+                    yield return null;
                 }
 
                 localFileSize = 0;
             }
         }
 
-        if (mHadError)
+        if (mHadError)
         {
             gDownloadIsRunningCount--;
             done = true;
             yield break;
         }
 
-        if (File.Exists(localFile))
+        if (File.Exists(localFile))
         {
-            try
+            try
             {
                 if (File.Exists(localFile))
                     File.Delete(localFile);
             }
-            catch (System.Exception e)
+            catch (System.Exception e)
             {
                 DesignDebug.LogWarning("<color=red>Could not delete local file</color>");
                 DesignDebug.LogWarning(e);
             }
-            while (File.Exists(localFile))
-            {
-                if (stop)
-                {
-                    yield break;
-                }
-                yield return null;
+            while (File.Exists(localFile))
+            {
+                if (stop)
+                {
+                    yield break;
+                }
+                yield return null;
             }
         }
 
@@ -465,10 +465,10 @@
         }
         mHadError = !Move(mLocalFileTemp, localFile);//鎶婁复鏃舵枃浠舵敼鍚嶄负姝e紡鏂囦欢
 #else
-        try
+        try
         {
             fileRequest = (HttpWebRequest)HttpWebRequest.Create(mRemoteFile);
-            if (fileRequest.ServicePoint.ConnectionLimit < RemoteFile.MaxConnectLimit)
+            if (fileRequest.ServicePoint.ConnectionLimit < RemoteFile.MaxConnectLimit)
             {
                 fileRequest.ServicePoint.ConnectionLimit = RemoteFile.MaxConnectLimit;
             }
@@ -477,7 +477,7 @@
             fileRequest.Proxy = null;
             fileRequest.KeepAlive = false;
 
-            if (localFileSize != 0L && isAcceptRange)
+            if (localFileSize != 0L && isAcceptRange)
             {
                 fileRequest.AddRange((int)localFileSize, (int)mRemoteFileSize - 1);
             }
@@ -487,11 +487,11 @@
             fileRequest.BeginGetResponse(AsynchCallback, fileRequest);
             tick1 = System.Environment.TickCount;
         }
-        catch (System.Exception ex)
+        catch (System.Exception ex)
         {
             DesignDebug.LogWarning("BeginGetResponse exception: " + ex.Message);
             DesignDebug.LogWarning(ex);
-            if (fileRequest != null)
+            if (fileRequest != null)
             {
                 fileRequest.Abort();
                 fileRequest = null;
@@ -502,21 +502,21 @@
             yield break;
         }
 
-        while (fileResponse == null && !mHadError)
-        { // Wait for asynch to finish
-
-            if (stop)
-            {
-                yield break;
+        while (fileResponse == null && !mHadError)
+        { // Wait for asynch to finish
+
+            if (stop)
+            {
+                yield break;
             }
 
-            if (processErroring)
+            if (processErroring)
             {
                 mHadError = true;
                 break;
             }
             float dur = System.Environment.TickCount - tick1;
-            if (dur > timeOut)
+            if (dur > timeOut)
             {
                 DesignDebug.LogWarningFormat("涓嬭浇杩滅▼鏂囦欢{0} 瓒呮椂!", mRemoteFile);
                 mHadError = true;
@@ -525,15 +525,15 @@
             yield return null;
         }
 
-        if (mHadError)
+        if (mHadError)
         {
             DesignDebug.LogWarningFormat("[RemoteFile] 杩滅▼鏂囦欢{0} 涓嬭浇澶辫触! ", localFile);
-            if (fileRequest != null)
+            if (fileRequest != null)
             {
                 fileRequest.Abort();
                 fileRequest = null;
             }
-            if (fileResponse != null)
+            if (fileResponse != null)
             {
                 fileResponse.Close();
                 fileResponse = null;
@@ -543,11 +543,11 @@
             yield break;
         }
 
-        try
+        try
         {
             inStream = fileResponse.GetResponseStream();
             fs = new FileStream(mLocalFileTemp, (localFileSize > 0) ? FileMode.Append : FileMode.Create, FileAccess.Write, FileShare.ReadWrite);
-            if (buff == null)
+            if (buff == null)
             {
                 buff = new byte[bufferSize];
             }
@@ -555,21 +555,21 @@
             inStream.BeginRead(buff, 0, bufferSize, ReadDataCallback, null);
             read_Stream_startTickcount = System.Environment.TickCount;
         }
-        catch (Exception ex)
+        catch (Exception ex)
         {
             DesignDebug.LogWarning("<color=red>ERROR: " + mRemoteFile + "</color>");
             DesignDebug.LogWarning(ex);
-            if (inStream != null)
+            if (inStream != null)
             {
                 inStream.Close();
                 inStream = null;
             }
-            if (fs != null)
+            if (fs != null)
             {
                 fs.Close();
                 fs = null;
             }
-            if (fileResponse != null)
+            if (fileResponse != null)
             {
                 fileResponse.Close();
                 fileResponse = null;
@@ -578,22 +578,22 @@
             fileWriteState = FileWriteState.Error;
         }
 
-        while (fileWriteState == FileWriteState.Writting)
-        {
-            if (stop)
-            {
-                yield break;
+        while (fileWriteState == FileWriteState.Writting)
+        {
+            if (stop)
+            {
+                yield break;
             }
 
-            if (processErroring)
+            if (processErroring)
             {
                 fileWriteState = FileWriteState.Error;
                 break;
             }
-            if (downloadSpeedRef == 0)
+            if (downloadSpeedRef == 0)
             {
                 int dura = System.Environment.TickCount - read_Stream_startTickcount;
-                if (dura > timeOut)
+                if (dura > timeOut)
                 {
                     fileWriteState = FileWriteState.Timeout;
                     DesignDebug.LogWarningFormat("[RemoteFile] 杩滅▼鏂囦欢{0} 璇诲彇瓒呮椂{1}!", mRemoteFile, dura);
@@ -603,15 +603,15 @@
 
             yield return null;
         }
-        if (fileRequest != null)
+        if (fileRequest != null)
         {
             fileRequest.Abort();
             fileRequest = null;
         }
-        if (fileWriteState == FileWriteState.Error || fileWriteState == FileWriteState.Timeout)
+        if (fileWriteState == FileWriteState.Error || fileWriteState == FileWriteState.Timeout)
         {
             DesignDebug.LogWarningFormat("[RemoteFile] 杩滅▼鏂囦欢{0} 涓嬭浇澶辫触! ", localFile);
-            if (fileResponse != null)
+            if (fileResponse != null)
             {
                 fileResponse.Close();
                 fileResponse = null;
@@ -621,19 +621,19 @@
             gDownloadIsRunningCount--;
             yield break;
         }
-        try
-        {
+        try
+        {
             FileInfo localTempFileInfo = new FileInfo(mLocalFileTemp);
-            if (localTempFileInfo.Exists)
-            { //涓存椂鏂囦欢瀛樺湪,闇�瑕佸垽鏂ぇ灏忔槸鍚︿竴鑷�
-              //鍒ゆ柇涓存椂鏂囦欢鍜岃繙绋嬫枃浠秙ize鏄惁涓�鑷�
+            if (localTempFileInfo.Exists)
+            { //涓存椂鏂囦欢瀛樺湪,闇�瑕佸垽鏂ぇ灏忔槸鍚︿竴鑷�
+              //鍒ゆ柇涓存椂鏂囦欢鍜岃繙绋嬫枃浠秙ize鏄惁涓�鑷�
 #if !UNITY_WEBPLAYER
-                if (localTempFileInfo.Length != mRemoteFileSize && mRemoteFileSize != 0L)
+                if (localTempFileInfo.Length != mRemoteFileSize && mRemoteFileSize != 0L)
                 {
                     mHadError = true;
                     DesignDebug.LogError(string.Format(localFile + " 涓嬭浇瀹屾垚鍚�, 浣嗘槸澶у皬{0} 鍜岃繙绋嬫枃浠朵笉涓�鑷� {1}", localTempFileInfo.Length, mRemoteFileSize));
                 }
-                else
+                else
                 {  //澶у皬涓�鑷� 
                     mHadError = !Move(mLocalFileTemp, localFile);//鎶婁复鏃舵枃浠舵敼鍚嶄负姝e紡鏂囦欢
                 }
@@ -641,7 +641,7 @@
                 done = true;
 #endif
             }
-            else
+            else
             { //涓存椂鏂囦欢涓嶅瓨鍦�
                 mHadError = true;
                 gDownloadIsRunningCount--;
@@ -649,7 +649,7 @@
             }
 #endif
         }
-        catch (Exception ex)
+        catch (Exception ex)
         {
             DesignDebug.LogError(ex);
             mHadError = true;
@@ -664,7 +664,7 @@
         }
     }
 
-    enum FileWriteState
+    enum FileWriteState
     {
         None,
         Writting,
@@ -677,47 +677,47 @@
     FileStream fs;
     FileWriteState fileWriteState = FileWriteState.None;  //涓嬭浇鏂囦欢鍐欏叆鐘舵��
 
-    void ReadDataCallback(IAsyncResult ar)
+    void ReadDataCallback(IAsyncResult ar)
     {
-        try
+        try
         {
-            if (inStream != null)
-            {
-                int read = inStream.EndRead(ar);
-                lock (lockObj)
-                {
-                    gTotalDownloadSize += read;
-                }
-
-                if (read > 0)
-                {
-                    fs.BeginWrite(buff, 0, read, WriteDataCallBack, fs);
-                }
-                else
-                {
-                    fs.Close();
-                    fs = null;
-                    inStream.Close();
-                    inStream = null;
-                    fileResponse.Close();
-                    fileResponse = null;
-                    fileWriteState = FileWriteState.Completed;
-                }
-            }
+            if (inStream != null)
+            {
+                int read = inStream.EndRead(ar);
+                lock (lockObj)
+                {
+                    gTotalDownloadSize += read;
+                }
+
+                if (read > 0)
+                {
+                    fs.BeginWrite(buff, 0, read, WriteDataCallBack, fs);
+                }
+                else
+                {
+                    fs.Close();
+                    fs = null;
+                    inStream.Close();
+                    inStream = null;
+                    fileResponse.Close();
+                    fileResponse = null;
+                    fileWriteState = FileWriteState.Completed;
+                }
+            }
         }
-        catch (Exception ex)
+        catch (Exception ex)
         {
-            if (!processErroring)
+            if (!processErroring)
             {
                 DesignDebug.LogWarning(ex);
                 DesignDebug.LogWarning("ReadDataCallback 寮傚父淇℃伅: " + ex.Message);
             }
-            if (fs != null)
+            if (fs != null)
             {
                 fs.Close();
                 fs = null;
             }
-            if (inStream != null)
+            if (inStream != null)
             {
                 inStream.Close();
                 inStream = null;
@@ -726,11 +726,11 @@
         }
     }
 
-    void WriteDataCallBack(IAsyncResult _asyncResult)
-    {
-        fs.Flush();
-        inStream.BeginRead(buff, 0, bufferSize, new AsyncCallback(ReadDataCallback), null);
-        read_Stream_startTickcount = System.Environment.TickCount;
+    void WriteDataCallBack(IAsyncResult _asyncResult)
+    {
+        fs.Flush();
+        inStream.BeginRead(buff, 0, bufferSize, new AsyncCallback(ReadDataCallback), null);
+        read_Stream_startTickcount = System.Environment.TickCount;
     }
 
 #if UseWebClient //|| UNITY_IOS
@@ -739,31 +739,31 @@
 	}
 #else
     // Throwind an exception here will not propogate to unity!
-    protected void AsynchCallback(IAsyncResult result)
+    protected void AsynchCallback(IAsyncResult result)
     {
-        try
+        try
         {
-            if (result == null)
+            if (result == null)
             {
                 DesignDebug.LogError("Asynch result is null!");
                 mHadError = true;
             }
 
             HttpWebRequest webRequest = (HttpWebRequest)result.AsyncState;
-            if (webRequest == null)
+            if (webRequest == null)
             {
                 DesignDebug.LogError("Could not cast to web request");
                 mHadError = true;
             }
 
             fileResponse = webRequest.EndGetResponse(result) as HttpWebResponse;
-            if (fileResponse == null)
+            if (fileResponse == null)
             {
                 DesignDebug.LogError("Asynch response is null!");
                 mHadError = true;
             }
         }
-        catch (Exception ex)
+        catch (Exception ex)
         {
             mHadError = true;
             DesignDebug.LogWarning(ex);
@@ -772,11 +772,11 @@
     }
 #endif
 
-    public enum State
-    {
-        Wait,
-        Working,
-        Stoped,
+    public enum State
+    {
+        Wait,
+        Working,
+        Stoped,
     }
 }
 

--
Gitblit v1.8.0