コード例 #1
0
        public override void Enter(ApkUpdateMonitor target)
        {
            string SavePath = target.Inter.GetNewApkSavePath();

            if (string.IsNullOrEmpty(SavePath))
            {
                target.OnError(ApkUpdateState.CheckLocalNewApk, ApkUpdateError.Get_Local_ApkSavePath_Error);
                return;
            }
            string diffMd5 = target.GetNewApkDiffMd5();

            // 删除其他APK
            target.ClearApk(diffMd5);
            string apkFileName = string.Format("{0}/{1}.apk", SavePath, diffMd5);

            if (File.Exists(apkFileName))
            {
                // 文件存在
                // 插件文件MD5
                CheckApkMd5(apkFileName);
            }
            else
            {
                // 文件不存在
                // 检查差异ZIP是否存在
                target.ChangeState(ApkUpdateState.CheckLocalNewZip);
            }
        }
コード例 #2
0
        public override void Enter(ApkUpdateMonitor target)
        {
            base.Enter(target);
            string savePath = target.Inter.GetDiffZipSavePath();

            if (string.IsNullOrEmpty(savePath))
            {
                target.OnError(ApkUpdateState.CheckLocalNewZip, ApkUpdateError.Get_Local_DiffZipSavePath_Error);
                return;
            }

            string md5Zip = target.GetNewZipDiffMd5();

            target.ClearZip(md5Zip);
            string diffZipFileName = string.Format("{0}/{1}.zip", savePath, md5Zip);

            if (File.Exists(diffZipFileName))
            {
                CheckDiffZip(diffZipFileName);
            }
            else
            {
                var    serverInfo   = target.GetDiffApkInfo();
                string jsonFileName = Path.ChangeExtension(diffZipFileName, ".json");
                DownloadDiffZip(serverInfo, diffZipFileName, jsonFileName);
            }
        }
コード例 #3
0
        public override void Enter(ApkUpdateMonitor target)
        {
            base.Enter(target);
            Clear();
            string url = target.Inter.Get_Https_ApkDiffs();

            if (string.IsNullOrEmpty(url))
            {
                target.OnError(ApkUpdateState.CheckApkDiff, ApkUpdateError.Get_Server_ApkDiff_Url_Error);
                return;
            }
            url     = HttpHelper.AddTimeStamp(url);
            m_Https = HttpHelper.OpenUrl <HttpClientStrResponse>(url, new HttpClientStrResponse(), OnHttpEnd);
        }
コード例 #4
0
        public override void Enter(ApkUpdateMonitor target)
        {
            base.Enter(target);
            Clear();

            // 重新请求
            string url = ApkUpdateMonitor.GetInstance().Https_CurApkVer;

            if (string.IsNullOrEmpty(url))
            {
                target.OnError(this.Id, ApkUpdateError.Get_Server_Version_Url_Error);
                return;
            }
            url     = HttpHelper.AddTimeStamp(url);
            m_Https = HttpHelper.OpenUrl <HttpClientStrResponse>(url, new HttpClientStrResponse(), OnHttpsCallBack);
        }