Exemplo n.º 1
0
        /// <summary>
        /// 根据检测模式检测已下载的文件.
        /// </summary>
        /// <returns><c>true</c>, OK, <c>false</c> NG.</returns>
        /// <param name="iTarget">目标信息.</param>
        /// <param name="iDownloadFileFullPath">已经下载到本地的路径.</param>
        private bool CheckFileByCheckMode(DownloadTargetInfo iTarget, string iDownloadFileFullPath)
        {
            if (File.Exists(iDownloadFileFullPath) == false)
            {
                return(false);
            }

            bool isCheckOK = true;

            switch (UploadList.GetInstance().CheckMode)
            {
            case TCheckMode.Unity3d_Hash128:
            {
                this.Info("CheckFileByCheckMode()::The Unity3d_Hash128 of check mode has not been supported yet!!!");
                isCheckOK = false;
            }
            break;

            case TCheckMode.Custom_Md5:
            {
                string md5 = UploadList.GetFileMD5(iDownloadFileFullPath);
                if ((true == string.IsNullOrEmpty(md5)) ||
                    (false == md5.Equals(iTarget.CheckCode)))
                {
                    isCheckOK = false;
                }
            }
            break;

            default:
                break;
            }

            return(isCheckOK);
        }