少年修仙传客户端代码仓库
client_linchunjie
2018-08-14 c6689f941359227f0b99b20b9400ccbab81b671c
System/AssetVersion/RemoteFile.cs
@@ -234,7 +234,7 @@
        }
        catch (Exception ex)
        {
            DesignDebug.LogError(ex.Message);
            DebugEx.LogError(ex.Message);
            ret = false;
        }
#endif
@@ -314,7 +314,7 @@
                    }
                    catch (Exception ex)
                    {
                        DesignDebug.LogWarning("ERROR: " + ex);
                        DebugEx.LogWarning("ERROR: " + ex);
                        mHadError = true;
                    }
                    finally
@@ -332,8 +332,8 @@
        }
        catch (WebException webEx)
        {
            DesignDebug.LogWarning("<color=red>Request File Head ERROR: " + mRemoteFile + "</color>");
            DesignDebug.LogWarning("ERROR: " + webEx);
            DebugEx.LogWarning("<color=red>Request File Head ERROR: " + mRemoteFile + "</color>");
            DebugEx.LogWarning("ERROR: " + webEx);
            mHadError = true;
            gDownloadIsRunningCount--;
            done = true;
@@ -341,8 +341,8 @@
        }
        catch (System.Exception e)
        {
            DesignDebug.LogWarning("<color=red>Request File Head ERROR: " + mRemoteFile + "</color>");
            DesignDebug.LogWarning("ERROR: " + e);
            DebugEx.LogWarning("<color=red>Request File Head ERROR: " + mRemoteFile + "</color>");
            DebugEx.LogWarning("ERROR: " + e);
            mHadError = true;
            gDownloadIsRunningCount--;
            done = true;
@@ -364,7 +364,7 @@
            float dur = System.Environment.TickCount - tick1;
            if (dur > timeOut)
            {
                DesignDebug.LogWarningFormat("获取远程文件{0} 信息超时!", mRemoteFile);
                DebugEx.LogWarningFormat("获取远程文件{0} 信息超时!", mRemoteFile);
                mHadError = true;
                break;
            }
@@ -372,7 +372,7 @@
        }
        if (mHadError)
        {
            DesignDebug.LogWarningFormat("获取远程文件{0} 信息失败!", mRemoteFile);
            DebugEx.LogWarningFormat("获取远程文件{0} 信息失败!", mRemoteFile);
            headRequest.Abort();
            done = true;
            gDownloadIsRunningCount--;
@@ -396,10 +396,10 @@
            }
            else if (localFileSize > mRemoteFileSize || outDated)
            {
                if (!outDated) DesignDebug.LogWarning("Local file is larger than remote file, but not outdated. PANIC!");
                if (!outDated) DebugEx.LogWarning("Local file is larger than remote file, but not outdated. PANIC!");
                if (outDated)
                {
                    DesignDebug.LogWarning(mLocalFileTemp + " Local file is outdated, deleting");
                    DebugEx.LogWarning(mLocalFileTemp + " Local file is outdated, deleting");
                }
                try
                {
@@ -408,8 +408,8 @@
                }
                catch (System.Exception e)
                {
                    DesignDebug.LogWarning("<color=red>Could not delete local file</color>");
                    DesignDebug.LogError(e);
                    DebugEx.LogWarning("<color=red>Could not delete local file</color>");
                    DebugEx.LogError(e);
                }
                while (File.Exists(mLocalFileTemp))
@@ -441,8 +441,8 @@
            }
            catch (System.Exception e)
            {
                DesignDebug.LogWarning("<color=red>Could not delete local file</color>");
                DesignDebug.LogWarning(e);
                DebugEx.LogWarning("<color=red>Could not delete local file</color>");
                DebugEx.LogWarning(e);
            }
            while (File.Exists(localFile))
            {
@@ -489,8 +489,8 @@
        }
        catch (System.Exception ex)
        {
            DesignDebug.LogWarning("BeginGetResponse exception: " + ex.Message);
            DesignDebug.LogWarning(ex);
            DebugEx.LogWarning("BeginGetResponse exception: " + ex.Message);
            DebugEx.LogWarning(ex);
            if (fileRequest != null)
            {
                fileRequest.Abort();
@@ -518,7 +518,7 @@
            float dur = System.Environment.TickCount - tick1;
            if (dur > timeOut)
            {
                DesignDebug.LogWarningFormat("下载远程文件{0} 超时!", mRemoteFile);
                DebugEx.LogWarningFormat("下载远程文件{0} 超时!", mRemoteFile);
                mHadError = true;
                break;
            }
@@ -527,7 +527,7 @@
        if (mHadError)
        {
            DesignDebug.LogWarningFormat("[RemoteFile] 远程文件{0} 下载失败! ", localFile);
            DebugEx.LogWarningFormat("[RemoteFile] 远程文件{0} 下载失败! ", localFile);
            if (fileRequest != null)
            {
                fileRequest.Abort();
@@ -557,8 +557,8 @@
        }
        catch (Exception ex)
        {
            DesignDebug.LogWarning("<color=red>ERROR: " + mRemoteFile + "</color>");
            DesignDebug.LogWarning(ex);
            DebugEx.LogWarning("<color=red>ERROR: " + mRemoteFile + "</color>");
            DebugEx.LogWarning(ex);
            if (inStream != null)
            {
                inStream.Close();
@@ -596,7 +596,7 @@
                if (dura > timeOut)
                {
                    fileWriteState = FileWriteState.Timeout;
                    DesignDebug.LogWarningFormat("[RemoteFile] 远程文件{0} 读取超时{1}!", mRemoteFile, dura);
                    DebugEx.LogWarningFormat("[RemoteFile] 远程文件{0} 读取超时{1}!", mRemoteFile, dura);
                    break;
                }
            }
@@ -610,7 +610,7 @@
        }
        if (fileWriteState == FileWriteState.Error || fileWriteState == FileWriteState.Timeout)
        {
            DesignDebug.LogWarningFormat("[RemoteFile] 远程文件{0} 下载失败! ", localFile);
            DebugEx.LogWarningFormat("[RemoteFile] 远程文件{0} 下载失败! ", localFile);
            if (fileResponse != null)
            {
                fileResponse.Close();
@@ -631,7 +631,7 @@
                if (localTempFileInfo.Length != mRemoteFileSize && mRemoteFileSize != 0L)
                {
                    mHadError = true;
                    DesignDebug.LogError(string.Format(localFile + " 下载完成后, 但是大小{0} 和远程文件不一致 {1}", localTempFileInfo.Length, mRemoteFileSize));
                    DebugEx.LogError(string.Format(localFile + " 下载完成后, 但是大小{0} 和远程文件不一致 {1}", localTempFileInfo.Length, mRemoteFileSize));
                }
                else
                {  //大小一致 
@@ -651,7 +651,7 @@
        }
        catch (Exception ex)
        {
            DesignDebug.LogError(ex);
            DebugEx.LogError(ex);
            mHadError = true;
        }
    }
@@ -709,8 +709,8 @@
        {
            if (!processErroring)
            {
                DesignDebug.LogWarning(ex);
                DesignDebug.LogWarning("ReadDataCallback 异常信息: " + ex.Message);
                DebugEx.LogWarning(ex);
                DebugEx.LogWarning("ReadDataCallback 异常信息: " + ex.Message);
            }
            if (fs != null)
            {
@@ -745,29 +745,29 @@
        {
            if (result == null)
            {
                DesignDebug.LogError("Asynch result is null!");
                DebugEx.LogError("Asynch result is null!");
                mHadError = true;
            }
            HttpWebRequest webRequest = (HttpWebRequest)result.AsyncState;
            if (webRequest == null)
            {
                DesignDebug.LogError("Could not cast to web request");
                DebugEx.LogError("Could not cast to web request");
                mHadError = true;
            }
            fileResponse = webRequest.EndGetResponse(result) as HttpWebResponse;
            if (fileResponse == null)
            {
                DesignDebug.LogError("Asynch response is null!");
                DebugEx.LogError("Asynch response is null!");
                mHadError = true;
            }
        }
        catch (Exception ex)
        {
            mHadError = true;
            DesignDebug.LogWarning(ex);
            DesignDebug.LogWarning("[RemoteFile] AsynchCallback 异常: " + ex.Message);
            DebugEx.LogWarning(ex);
            DebugEx.LogWarning("[RemoteFile] AsynchCallback 异常: " + ex.Message);
        }
    }
#endif