Beispiel #1
0
        private static void loadPackVersionOver()
        {
            BytesReadStream stream = _loader.getBytesRead();

            if (stream != null && stream.checkVersion(ShineGlobal.versionInfoVersion))
            {
                _packVersionData = new VersionSaveData();
                _packVersionData.readBytes(stream);
            }

            _loader.unload();

            //初次下载
            if (_versionData == null)
            {
                _versionData = _packVersionData;

                if (_versionData == null)
                {
                    ShineSetup.exit("没有可用的versionInfo数据,请重新打包");
                    return;
                }

                makeVersionFirst();
            }
            //更新app或调试版
            else if (_packVersionData.resourceVersion > _versionData.resourceVersion || !_packVersionData.isRelease)
            {
                if (!ShineSetting.isRelease && ShineSetting.needDebugResourceVersion)
                {
                    //其他动作
                }
                else
                {
                    //新包覆盖
                    if (ShineSetting.newPackNeedCover)
                    {
                        _versionData = _packVersionData;
                        // deleteAllCache();
                        deleteAllPackageCache();
                        makeVersionFirst();
                    }
                    else
                    {
                        mergeVersion(_packVersionData);
                        checkResourceExists();
                    }
                }
            }

            Action func = _overCall;

            _overCall = null;

            if (func != null)
            {
                func();
            }
        }
Beispiel #2
0
        /** 读取本地版本数据(如已存在则不再读取) */
        public static void loadVersion(Action overFunc)
        {
            if (_versionData != null)
            {
                if (overFunc != null)
                {
                    overFunc();
                }
                return;
            }

            _overCall = overFunc;

            BytesReadStream stream = FileUtils.readFileForBytesReadStream(_versionPath);

            //存在
            if (stream != null && stream.checkVersion(ShineGlobal.versionInfoVersion))
            {
                _versionData = new VersionSaveData();
                _versionData.readBytes(stream);

                //本地纠正
                if (!ShineSetting.isRelease)
                {
                    makeVersionFirst();
                }
            }
            else
            {
                _versionData = null;
            }

            if (!ShineSetting.isRelease && ShineSetting.localLoadWithOutBundle)
            {
                if (_versionData == null)
                {
                    _versionData                 = new VersionSaveData();
                    _versionData.appVersion      = 1;
                    _versionData.resourceVersion = 1;
                    _versionData.version         = "1.01";
                }

                if (overFunc != null)
                {
                    overFunc();
                }
                return;
            }

            _loader.setCompleteCall(loadPackVersionOver);
            _loader.loadStreamingAsset(ShineGlobal.versionInfoPath);
        }
Beispiel #3
0
        private static void loadCDNVersionOver()
        {
            BytesReadStream stream = _loader.getBytesRead();

            VersionSaveData data = null;

            if (stream != null && stream.checkVersion(ShineGlobal.versionInfoVersion))
            {
                data = new VersionSaveData();
                data.readBytes(stream);
            }

            _loader.unload();

            Action <VersionSaveData> func = _overCall2;

            _overCall2 = null;

            if (func != null)
            {
                func(data);
            }
        }