Exemplo n.º 1
0
        public void CreateVersionFile(List <BundleInfo> bundles, bool copyToStreamingAssets = false)
        {
            string        destPath = copyToStreamingAssets ? ResourcesPath : BuildPath;
            VersionConfig vc       = new VersionConfig();

            vc.versionNum         = DateTime.Now.ToString();
            vc.bundleRelativePath = BundleConfig.bundleRelativePath;


            if (!copyToStreamingAssets)
            {
                foreach (var item in bundles)
                {
                    if (!item.isExist())
                    {
                        vc.bundles.Add(item);
                    }
                }
            }
            else
            {
                vc.bundles = bundles;
            }
            string verJson = JsonMapper.ToJson(vc);

            using (MemoryStream memeory = new MemoryStream())
            {
                StreamUtils.Write(memeory, verJson);
                BundleEncode.CreateBinaryFileAndHead(destPath + "/" + BundleConfig.versionFileName, memeory.ToArray());
            }

            // 对比后的新文件
            //BundleManager.GetInstance ().UpdateLocalVersionConfig (vc, destPath + "/" + BundleConfig.versionFileName + BundleConfig.suffix);
        }
Exemplo n.º 2
0
        public void CreateVersionFile(List <BundleInfo> bundles, bool copyToStreamingAssets = false)
        {
            string destPath = "";

            if (copyToStreamingAssets)
            {
                destPath = ResourcesPath + "/" + BundleConfig.versionFileName + BundleConfig.suffix;
            }
            else
            {
                destPath = BuildPath + BundleConfig.versionFileName;
            }

            VersionConfig vc = new VersionConfig();

            vc.versionNum         = DateTime.Now.ToString();
            vc.bundleRelativePath = BundleConfig.bundleRelativePath;


            if (!copyToStreamingAssets)
            {
                foreach (var item in bundles)
                {
                    if (!item.isExist())
                    {
                        vc.bundles.Add(item);
                    }
                }
            }
            else
            {
                vc.bundles = bundles;
            }
            string verJson = JsonMapper.ToJson(vc);

            BundleEncode.CreateBinaryFileAndHead(destPath, verJson);
            // Diff version file
            //BundleManager.GetInstance ().UpdateLocalVersionConfig (vc, destPath + "/" + BundleConfig.versionFileName + BundleConfig.suffix);
        }