public override void CollectMetric() { var end = DateTime.Now.AddDays(1); var begin = end.AddDays(-5); var vso = this.config[SolutionConfigName.VSO_NAME].ToString(); var project = this.config[SolutionConfigName.VSO_PROJECT_NAME].ToString(); var token = this.config[SolutionConfigName.PERSONAL_ACCESS_TOKEN].ToString(); var releaseId = this.config[SolutionConfigName.FUNCTIONAL_TEST_RELEASE_DEFINITION_ID].ToString(); var releases = ReleaseUtil.GetReleaseByReleaseDefinitionId(vso, project, begin, end, releaseId, token); var metricList = new List <Metric>(); //Get release test result foreach (var rel in releases) { var item = TestRunUtil.GetReleaseTestRunDataModel(vso, project, releaseId, rel.id, rel.CreationDate, token); if (item != null) { var detail = new Dictionary <string, object>(); detail["VSO"] = item.VSO; detail["Project"] = item.Project; detail["BuildOrReleaseId"] = rel.id; detail["RunId"] = item.RunId; detail["PassedTestNum"] = item.PassedTestNum; detail["TotalTestNum"] = item.TotalTestNum; detail["CreationDate"] = item.CreationDate; var metric = new Metric("TestRun", MetricType.TestRun, detail); metricList.Add(metric); } } writer.Write(metricList); }
void InitAbStartup() { AssetBundleConfig.InitConfig(true); AssetBundleUtil.SetExternAssetBundleDir(GetAbDir()); #if UNITY_IPHONE XFileUtil.SetFolderNoSaveImp((folderPath) => { UnityEngine.iOS.Device.SetNoBackupFlag(folderPath); }); #endif AssetBundleUtil.m_abHashMd5 = false; GameCoreConfig.UseAssetBundle = true; #if UNITY_EDITOR AssetBundleUtil.traceAssetBundleDebug = false; #endif InitFileProtocol(); BLogger.Info("******dataPath: {0}", Application.dataPath); BLogger.Info("******streamingAssetsPath:{0}", Application.streamingAssetsPath); BLogger.Info("******temporaryCachePath:{0}", Application.temporaryCachePath); BLogger.Info("******persistentDataPath:{0}", Application.persistentDataPath); BLogger.Info("******asset bundle dir: {0}", GetAbDir()); BLogger.Info("******storage free space:{0}", ReleaseUtil.GetStorageFreeSpace()); }
private void StartEnterGameScene() { ShowText(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_GAME_ETNERING)); //m_process.gameObject.SetActive(false); ReleaseUtil.OnGameEnter(); StartCoroutine(DelayLoadScene()); }
/// <summary> /// 点击手动下载 /// </summary> public void OnManualUpdate() { AssetUpdater updater = AssetUpdater.Instance; AssetVerInfo verInfo = updater.svrVerInfo; BLogger.Assert(verInfo != null); ReleaseUtil.StartManualDownLoadProg(verInfo.m_progUrl); }
// Use this for initialization void Start() { Screen.sleepTimeout = SleepTimeout.NeverSleep; DodSdkListener.Init(); ///初始native库 DodNativeMgr.Init(); ///初始化基础库 BaseLibMgr.InitLib(); AssetVersionMgr.Instance.Init(); if (XGameStartParamData.fromGrayUpdate) { StartCoroutine(CrtUpdateFromGrayUpdate(XGameStartParamData.grayVerInfo)); return; } if (XGameStartParamData.fromRepairClient) { StartCoroutine(CrtUpdateFromRepairClient()); return; } InitAbStartup(); EventLogReport.Instance.ReportEvent(EventLogType.event_startup); ///判断是否有可用的存储空间 string dataPath = ReleaseUtil.GetDataDir(); if (string.IsNullOrEmpty(dataPath)) { EventLogReport.Instance.ReportEvent(EventLogType.event_fail_startup, "find sdcard failed"); ShowText(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_FIND_SDCARD_FAILD)); return; } //添加logo 处理 var imgLogo = DUnityUtil.FindChildComponent <Image>(transform, "Logo"); if (imgLogo != null) { UIReleaseTextureHelper.SetReleaseLogo(imgLogo, UIReleaseTextureHelper.LOGO_TEXTURE_NAME, true); } var imgBg = DUnityUtil.FindChildComponent <Image>(transform, "Background1"); if (imgBg != null) { UIReleaseTextureHelper.SetReleaseLogo(imgBg, UIReleaseTextureHelper.START_TEXTURE_NAME, false); } StartCoroutine(GameStartup()); }
/// <summary> /// 开始下载整包 /// </summary> /// <returns></returns> IEnumerator ContinueDownloadProg(AssetVerInfo svrVerInfo) { OnManualUpdate(); yield break; // yield return null; // //yield return null; // BLogger.Error("StartDownload prog: {0}", svrVerInfo.m_progUrl); // ReleaseUtil.StartDownLoadProg(svrVerInfo.m_progUrl); // yield return null; //如果是Ios的话,就可以直接返回了 #if !UNITY_ANDROID DodLib.DoQuit(); yield break; #endif SetProgress(0, 100); bool isDownRun = true; while (isDownRun) { ProgDownloadState stateData = ReleaseUtil.GetDownloadState(svrVerInfo.m_progUrl); if (stateData == null || stateData.status == ProgDownloadStatus.STATUS_NONE) { ShowText(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_UPDATE_FINISH)); isDownRun = false; ShowManualDownload(); break; } if (stateData.totalSize > 0) { SetProgress((uint)stateData.downloadedSize, (uint)stateData.totalSize); } switch (stateData.status) { case ProgDownloadStatus.STATUS_FAILED: { isDownRun = false; ShowText(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_DOWNLOAD_PROG_FAILED, stateData.statusReason)); ShowManualDownload(); } break; case ProgDownloadStatus.STATUS_PAUSED: { ShowText(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_DOWNLOAD_PROG_PAUSE, stateData.statusReason)); ShowManualDownload(); } break; case ProgDownloadStatus.STATUS_PENDING: { ShowText(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_DOWNLOAD_PROG_WAIT)); ShowManualDownload(); } break; case ProgDownloadStatus.STATUS_RUNNING: { if (stateData.totalSize > 0) { ShowText(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_DOWNLOAD_PROG_PROGRESS, GetDataSize(stateData.downloadedSize) + "/" + GetDataSize(stateData.totalSize))); } else { ShowText(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_DOWNLOAD_PROG_START)); } } break; case ProgDownloadStatus.STATUS_SUCCESSFUL: { isDownRun = false; ShowText(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_DOWNLOAD_PROG_SUCCESS)); #if UNITY_ANDROID //当前下载任务正在进行中 //直接调用安装 bool ret = DodLib.InstallApk(svrVerInfo.m_progUrl); BLogger.Assert(ret); #endif } break; default: break; } yield return(null); yield return(null); yield return(null); } }
//获取AB路径 private string GetAbDir() { return(ReleaseUtil.GetDataDir() + "/StreamingAssets/ab/"); }
public IEnumerator DownloadLatestIndex(string urlPath) { //清理数据 m_downIndexList.Clear(); m_downAssetMd5Dict.Clear(); m_latestAssetMd5Dict.Clear(); //清理文件 ReleaseUtil.DeleteFolder(downTempDir); //md5索引文件的总表 string urlMd5Root = urlPath + "/" + AssetBundleUtil.MD5HASH_FILE_ROOT_NAME; BLogger.Info("DownloadLatestIndex:{0}", urlMd5Root); WWW wwwRoot = new WWW(urlMd5Root); yield return(wwwRoot); if (wwwRoot.error != null) { BLogger.Warning("www request failed, Url:{0}, error:{1}", urlMd5Root, wwwRoot.error); m_error = String.Format(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_UPDATE_READ_LOCAL_FAILED, 1, wwwRoot.error)); wwwRoot.Dispose(); yield break; } List <AssetMd5FileInfo> listMd5Index = ParseAssetMd5List(urlMd5Root, wwwRoot.text); if (null == listMd5Index) { BLogger.Warning("ParseAssetMd5List, Url:{0}", urlMd5Root); m_error = StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_UPDATE_READ_LOCAL_FAILED_NO_ERRORCODE, 2); wwwRoot.Dispose(); yield break; } //临时目录写入root文件 bool ret = AssetBundleUtil.WriteToFile(downTempDir, AssetBundleUtil.MD5HASH_FILE_ROOT_NAME, wwwRoot.bytes); wwwRoot.Dispose(); if (!ret) { BLogger.Warning("Write root file failed"); m_error = StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_UPDATE_WRITE_FAILED, (downTempDir + AssetBundleUtil.MD5HASH_FILE_ROOT_NAME)); yield break; } ///记录最新的assetbundle所有信息 Dictionary <string, AssetMd5FileInfo> latestAssetInfo = m_latestAssetMd5Dict; Crc32 crc = new Crc32(); foreach (AssetMd5FileInfo indexFileInfo in listMd5Index) { BLogger.Info("new index file[{0}]", indexFileInfo.m_md5FilePath); //循环读取配置 //如果是内置资源的方式,则需要把所有的index文件给读取下来 if (IsNeedUpdate(indexFileInfo)) { m_downIndexList.Add(indexFileInfo.m_md5FilePath); string urlItem = urlPath + "/" + indexFileInfo.m_md5FilePath; WWW www = new WWW(urlItem); yield return(www); if (www.error != null) { BLogger.Warning("update [{0}] failed[{1}]", urlItem, www.error); m_error = String.Format("读取资源配置文件失败(3)[{0}]", www.error); yield break; } ret = AssetBundleUtil.WriteToFile(downTempDir, indexFileInfo.m_md5FilePath, www.bytes); if (!ret) { m_error = StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_UPDATE_WRITE_FAILED, (downTempDir + indexFileInfo.m_md5FilePath)); yield break; } //检查crc校验 if (indexFileInfo.m_crc != 0 && !CheckFileCrc(crc, downTempDir + indexFileInfo.m_md5FilePath, indexFileInfo.m_crc)) { m_error = StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_UPDATE_CRC_CHECK_FAILED, (downTempDir + indexFileInfo.m_md5FilePath)); yield break; } BLogger.Info("check index crc ok, index file: " + indexFileInfo.m_md5FilePath + ",expcect: " + indexFileInfo.m_crc); indexFileInfo.m_downLoad = true; List <AssetMd5FileInfo> listAsset = ParseAssetMd5List(urlItem, www.text); if (null == listAsset) { yield break; } www.Dispose(); //增加到待更新列表中 for (int i = 0; i < listAsset.Count; i++) { AssetMd5FileInfo eachAsset = listAsset[i]; m_latestAssetMd5Dict.Add(eachAsset.m_md5FilePath, eachAsset); } } } }