示例#1
0
        private void doCopyOne(string targetPath, string fileName)
        {
            string tt = fileName.Substring(targetPath.Length + 1);

            ResourceSaveExData data = _newVersion.getBundleEx(tt);

            //data==null的时候,比如version.bin的情况

            //复制到streamingAssets
            if (data == null || data.saveType == ResourceSaveType.InStreamingAsset)
            {
                FileUtils.copyFile(fileName, ShineToolGlobal.streamingAssetsPath + "/" + tt);
            }

            bool needCopyToCDN = false;

            //发布版本
            if (_isReleasePack)
            {
                //没有数据 或 (是最新版本,并且不是 全更app中的包资源)
                if (data == null || (data.version == _newVersion.resourceVersion && !(_isAppNeedUpdate && ResourceSaveType.isStreamingAsset(data.saveType))))
                {
                    needCopyToCDN = true;
                }
            }

            if (needCopyToCDN)
            {
                FileUtils.copyFile(fileName, getTargetCDNSourcePath() + "/resource_" + _newVersion.resourceVersion + "/" + tt);
            }
        }
示例#2
0
        private void doBundleSaveOne(string bundleName, int type)
        {
            ResourceSaveExData data = _newVersion.getBundleEx(bundleName);

            if (data != null)
            {
                if (ShineToolSetting.bundlePackNeedPutDependAlsoIntoStreamingAssets && type == ResourceSaveType.InStreamingAsset && data.saveType != type)
                {
                    data.saveType = type;
                }
            }
            else
            {
                data = doFileSaveData(getTargetSourcePath(), bundleName, type);

                if (ShineToolSetting.bundlePackNeedPutDependAlsoIntoStreamingAssets)
                {
                    int resourceID = LoadControl.getResourceIDByName(data.name);

                    BundleInfoData bundleInfoData = LoadControl.getBundleInfo(resourceID);

                    foreach (int d in bundleInfoData.depends)
                    {
                        string pName = LoadControl.getResourceNameByID(d);

                        //父类型
                        doBundleSaveOne(pName, type);
                    }
                }
            }
        }
示例#3
0
        private ResourceSaveExData doFileSaveData(string front, string fileName, int type)
        {
            //本地强制进包
            if (!_isReleasePack)
            {
                type = ResourceSaveType.InStreamingAsset;
            }

            string path = front + "/" + fileName;

            string md5 = FileUtils.getFileMD5(path);
//			string md5=_manifest.GetAssetBundleHash(FileUtils.getFileName(fileName)).ToString();

            FileInfo fileInfo = new FileInfo(path);

            ResourceSaveExData lastData = _lastTargetVersion.getBundleEx(fileName);

            ResourceSaveExData data = new ResourceSaveExData();

            data.name     = fileName;
            data.size     = fileInfo.Exists ? (int)fileInfo.Length : 0;       //强转int,最大支持2G文件
            data.saveType = type;
            data.md5      = md5;

            if (lastData != null)
            {
                if (lastData.md5.Equals(md5))
                {
                    data.version = lastData.version;
                }
                else
                {
                    data.version = _newVersion.resourceVersion;
                }

                //进包变成不进包
                if (ResourceSaveType.isStreamingAsset(lastData.saveType) && !ResourceSaveType.isStreamingAsset(data.saveType))
                {
                    //更新资源版本
                    data.version = _newVersion.resourceVersion;
                }
            }
            else
            {
                data.version = _newVersion.resourceVersion;
            }

            _newVersion.resourceDic.put(data.name, data);

            return(data);
        }