Beispiel #1
0
    public void tStart()
    {
        Utils.SB.Append(UnityUtil.PersistentPath);
        Utils.SB.Append(DownloadCachePath);
        Utils.SB.Append("/");
        Utils.SB.Append(DownloadOverFileName);
        string path = Utils.SB.ToString();

        Utils.ClearSB();

        if (!FileHelper.BeFileExist(path))
        {
            LogMgr.I("CopyRes", "tStart", "下载中目录不存在下载完成标志,掠过资源覆盖阶段,直接进入updateComplete");
            //没有下载完成标识文件,不需要复制过程,
            UpdateMgr.GetIns().SetState(UpdateMgr.CheckVerState.updateComplete);
            return;
        }

        //NTODO 这里需要返回进度,另外要最后再移动resVer

        //有下载完成标识,准备开始移动覆盖文件
        Utils.SB.Append(UnityUtil.PersistentPath);
        Utils.SB.Append(DownloadCachePath);
        string _srcPath = Utils.SB.ToString();

        Utils.ClearSB();

        Listener <float> progressCB = (progress) =>
        {
            //发出进度事件
            float progress1 = progress * 0.9f;
            LogMgr.I("CopyRes", "tStart", "移动文件夹进度:" + progress + " 整体copy进度:" + progress1, BeShowLog);
            ntools.Messenger.Broadcast <float>("updateLoadingProgress", progress1);
        };

        Listener onComplete = () =>
        {
            LogMgr.I("CopyRes", "tStart", "移动文件夹完毕", BeShowLog);
            ntools.Messenger.Broadcast <float>("updateLoadingProgress", 0.9f);
            ProcessResVer();
        };

        List <string> ignroeFileList = new List <string>();

        ignroeFileList.Add("resVer.txt");

        LogMgr.I("CopyRes", "tStart", "移动srcPath:" + _srcPath + " 到目标路径:" + UnityUtil.PersistentPath, BeShowLog);
        FileMove.GetIns().MoveFoldersFiles(_srcPath, UnityUtil.PersistentPath, progressCB, onComplete, ignroeFileList);
    }
Beispiel #2
0
    public void SetState(UnCompressState state)
    {
        if (state == curState)
        {
            return;
        }

        LogMgr.I("UnCompress", "SetState", "SetState切换状态到:" + state, BeShowLog);

        preState = curState;
        StateExit(preState);
        curState = state;

        switch (curState)
        {
        case UnCompressState.checkPersistResVer:
            CheckPersistResVer();
            break;

        case UnCompressState.checkStreamResVer:
            CheckStreamResVer();
            break;

        case UnCompressState.compareResVerPersist_Stream:
            CompareLocalResVer();
            break;

        case UnCompressState.readStreamResInfoList:
            ReadStreamResInfoList();
            break;

        case UnCompressState.unCompressStreamRes:
            UnCompressStreamRes2Persistent();
            break;

        case UnCompressState.readPersistResVerAfterUnCompress:
            ReadPersistResVerAfterUnCompress();
            break;

        case UnCompressState.unCompressComplete:
            Clear();
            ntools.Messenger.Broadcast <float>("updateLoadingProgress", 1f);
            UpdateMgr.GetIns().SetState(UpdateMgr.CheckVerState.downLoad);
            break;
        }
    }
Beispiel #3
0
    private void ProcessResVer()
    {
        //最后更新沙盒版本号
        Utils.SB.Append(UnityUtil.PersistentPath);
        Utils.SB.Append(DownloadCachePath);
        Utils.SB.Append("/resVer.txt");
        string srcResVerPath = Utils.SB.ToString();

        Utils.SB.Clear();

        Utils.SB.Append(UnityUtil.PersistentPath);
        Utils.SB.Append("/resVer.txt");
        string destResVerPath = Utils.SB.ToString();

        Utils.SB.Clear();

        LogMgr.I("CopyRes", "ProcessResVer", "移动resVer:" + srcResVerPath + " 到目标路径:" + destResVerPath, BeShowLog);
        FileHelper.MoveFile(srcResVerPath, destResVerPath);

        ntools.Messenger.Broadcast <float>("updateLoadingProgress", 1f);

        //清理下载中目录,其实不需要清理,因为都移走了
        UpdateMgr.GetIns().SetState(UpdateMgr.CheckVerState.updateComplete);
    }
Beispiel #4
0
    public void SetState(DownloadResState state)
    {
        if (state == curState)
        {
            return;
        }

        LogMgr.I("DownloadRes", "SetState", "SetState切换状态到:" + state, BeShowLog);

        preState = curState;
        StateExit(preState);
        curState = state;

        switch (curState)
        {
        case DownloadResState.checkRemoteResVer:
            CheckRemoteResVer();
            break;

        case DownloadResState.compareResVerPersist_Remote:
            CompareResVerPersist_Remote();
            break;

        case DownloadResState.checkPersistDownloadingRes:
            CheckPersistDownloadingRes();
            break;

        case DownloadResState.pullRemoteResInfoList:
            PullRemoteResInfoList();
            break;

        case DownloadResState.readPersistResInfoList:
            ReadPersistResInfoList();
            break;

        case DownloadResState.compareResInfoListPersist_Remote:
            CompareResInfoListPersist_Remote();
            break;

        case DownloadResState.checkBreakpoint:
            CheckBreakpoint();
            break;

        case DownloadResState.filterUpdateResInfoList:
            FilterUpdateResInfoList();
            break;

        case DownloadResState.saveRemoteResVer2Downloading:
            SaveRemoteResVer2Downloading();
            break;

        case DownloadResState.startDownload:
            StartDownload();
            break;

        case DownloadResState.saveResInfoList2DownloadingFoler:
            SaveResInfoList2DownloadingFoler();
            break;

        case DownloadResState.generateDownloadOverFlagFile:
            GenerateDownloadOverFlagFile();
            break;

        case DownloadResState.downloadComplete:
            Clear();
            //这里的100即可是版本检测的100也可是下载的100
            Messenger.Broadcast <float>("updateLoadingProgress", 1f);
            UpdateMgr.GetIns().SetState(UpdateMgr.CheckVerState.copyRess);
            break;
        }
    }