private void HandleReceiveFile()
 {
     if (!m_ReceiveFile)
     {
         return;
     }
     if (Time.time - m_LastSpeedTime >= 1)
     {
         m_LastSpeedTime = Time.time;
         m_ReceiveSpeed  = m_LastSpeedByte;
         m_LastSpeedByte = 0;
     }
     if (Time.time - m_LastCheckTime > 0.1f)
     {
         m_LastCheckTime = Time.time;
         var currSize = RemoteDebugUtil.GetFileSize(m_ReceiveFilePath);
         if (currSize == m_ReceiveFileSize)
         {
             m_ReceiveFileStream.Flush();
             m_ReceiveFileStream.Close();
             m_ReceiveFile = false;
             var md5 = RemoteDebugUtil.GetFileMd5(m_ReceiveFilePath);
             if (md5.Equals(m_ReceiveFileMd5))
             {
                 HandleMsg_Patch_GetFileList();
                 m_Client.Send(string.Format("{0}#{1}|{2}$", (int)RemoteDebugMsg.Patch_LocalUploadEnd, m_ReceiveFileName, 0));
             }
             else
             {
                 m_Client.Send(string.Format("{0}#{1}|{2}$", (int)RemoteDebugMsg.Patch_LocalUploadEnd, m_ReceiveFileName, 1));
             }
         }
         else
         {
             m_Client.Send(string.Format("{0}#{1}|{2}|{3}$",
                                         (int)RemoteDebugMsg.Patch_LocalUpload, m_ReceiveFileName, currSize, m_ReceiveSpeed));
         }
     }
 }
        public void UploadNextFile(bool flag = true, string successedFileName = null)
        {
            if (!string.IsNullOrEmpty(successedFileName))
            {
                if (flag)
                {
                    m_UploadCurrCount++;
                    m_UploadCurrSize  = 0;
                    m_UploadFileSize += (int)RemoteDebugUtil.GetFileSize(m_LocalPath + "/" + successedFileName);
                    m_Parent.UpdateLogStatus(m_LocalPath + "/" + successedFileName, "");
                    if (m_UploadFileSize == m_UploadTotalSize)
                    {
                        RemoteDebugWindow.Instance.ShowNotification(new GUIContent("Upload All File Success"));
                    }
                }
                else
                {
                    m_Parent.UpdateLogStatus(m_LocalPath + "/" + successedFileName, "failed: not same md5.");
                }
            }
            Debug.LogError("UploadNextFile:" + m_WaitingUploadFileInfos.Count);
            if (m_WaitingUploadFileInfos.Count == 0)
            {
                m_IsUploaded    = true;
                m_UploadEndTick = DateTime.Now.Ticks;
                return;
            }
            var info = m_WaitingUploadFileInfos[0];

            m_WaitingUploadFileInfos.RemoveAt(0);
            var filePath = m_LocalPath + "/" + info.name;
            var fileSize = 0L;
            var md5      = RemoteDebugUtil.GetFileMd5(filePath, out fileSize);

            server?.RequestPatchUploadStart(clientIndex, info.name, (int)fileSize, md5);
            server?.RequestPatchUploadFile(clientIndex, filePath);
            m_Parent.AddLog(filePath, (int)fileSize);
            m_IsUploading = true;
        }