Ejemplo n.º 1
0
        ByteFileInfoList GetNeedDownloadFiles(List <ByteFileInfo> pList)
        {
            if (pList == null || pList.Count == 0)
            {
                return(null);
            }


            var tcmp = new ByteFileInfoList();

            tcmp.AddRange(pList);

            string tdedfile  = GameCore.CombinePath(GameCore.PersistentResDataPath, downloadedfile);
            var    tdedinfo  = new ByteFileInfoList(tdedfile);
            var    tneedList = tdedinfo.Comparison(tcmp);

            if (tneedList.Count == 0)
            {
                UpdateLocalList();
                return(null);
            }
            else
            {
                ByteFileInfoList ret = new ByteFileInfoList();
                ret.AddRange(tneedList);
                return(ret);
            }
        }
Ejemplo n.º 2
0
        void DownLoadCheckFileFail(DownLoader dloader, CheckComplete onComplete, bool useCache, bool needRetry)
        {
            isChecking = false;
            string tfilePath  = GameCore.CombinePath(GameCore.PersistentResDataPath, GetCheckFileName());
            bool   isfileExit = File.Exists(tfilePath);

            if (dloader.IsCompleteDownLoad && isfileExit)
            {
                DownLoadCheckFileFinished(onComplete);
            }
            else
            {
                if (ReTryCheckCount >= ReTryMaxCount)
                {
                    needRetry = false;
                }

                if (needRetry)
                {
                    ReTryCheckCount++;
                    if (autoUseCacheCheck && isfileExit)
                    {
                        StartCoroutine(WaitRetryCheck(0.1f, onComplete, true, needRetry));
                    }
                    else
                    {
                        StartCoroutine(WaitRetryCheck(3, onComplete, useCache, needRetry));
                    }
                }
                else
                {
                    CallCheckOnComplete(onComplete, null);
                }
            }
        }
Ejemplo n.º 3
0
 void OnUpdateOneComplete(ByteFileInfo pInfo)
 {
     if (pInfo == null)
     {
         return;
     }
     try
     {
         string        tline  = UnityEngine.JsonUtility.ToJson(pInfo);
         List <string> tlines = new List <string>();
         tlines.Add(tline);
         string tdedfile = GameCore.CombinePath(GameCore.PersistentResDataPath, downloadedfile);
         File.AppendAllLines(tdedfile, tlines);
     }
     catch (System.Exception erro)
     {
         Debug.LogError(erro.Message);
     }
 }
Ejemplo n.º 4
0
        IEnumerator CheckingUpdate(CheckComplete onComplete, bool useCache, bool needRetry)
        {
            ReleaseCheckLoader();

            string tuf        = GetServerUrl(LoaderManager.byteFileInfoFileName + BaseBundle.sSuffixName);
            string tcheckfile = GetCheckFileName();
            string tfilePath  = GameCore.CombinePath(GameCore.PersistentResDataPath, tcheckfile);

            if (!useCache || !File.Exists(tfilePath))
            {
                checkLoader = DownLoadManager.DownLoadFileAsync(tuf, GameCore.PersistentResDataPath, tcheckfile, null, 0, null);
                while (!checkLoader.IsDone)
                {
                    yield return(null);
                }
                DownLoadCheckFileEnd(checkLoader, onComplete, useCache, needRetry);
            }
            else
            {
                DownLoadCheckFileFinished(onComplete);
            }
        }
Ejemplo n.º 5
0
        void UpdateLocalList()
        {
            string tfilePath = GameCore.CombinePath(GameCore.PersistentResDataPath, GetCheckFileName());
            string tsavefile = GameCore.CombinePath(GameCore.PersistentResDataPath, LoaderManager.byteFileInfoFileName + BaseBundle.sSuffixName);

            if (File.Exists(tfilePath))
            {
                if (File.Exists(tsavefile))
                {
                    File.Delete(tsavefile);
                }
                File.Copy(tfilePath, tsavefile);

                LoaderManager.ReLoadResInfo();
            }

            string tdedfile = GameCore.CombinePath(GameCore.PersistentResDataPath, downloadedfile);

            if (File.Exists(tdedfile))
            {
                File.Delete(tdedfile);
            }
        }
Ejemplo n.º 6
0
        List <ByteFileInfo> GetUpdateList()
        {
            List <ByteFileInfo> ret = null;
            var    tinfo            = new ByteFileInfoList();
            string tfilePath        = GameCore.CombinePath(GameCore.PersistentResDataPath, GetCheckFileName());

            if (File.Exists(tfilePath))
            {
                AssetBundle tinfobundle = AssetBundle.LoadFromFile(tfilePath);
                if (tinfobundle != null)
                {
                    TextAsset tass = tinfobundle.LoadAsset <TextAsset>(LoaderManager.byteFileInfoFileName);
                    if (tass != null)
                    {
                        tinfo.Load(tass.bytes);
                    }
                    tinfobundle.Unload(false);
                }
            }

            ret = LoaderManager.ByteInfoData.Comparison(tinfo);
            return(ret);
        }