Example #1
0
        private static void Pack()
        {
            List <PackRes_Def.BundleData> bundleDataList;

            if (packSetting.policy == PackRes_Def.packPolicy_configFile)
            {
                bundleDataList = InitCfgDataList();
            }
            else if (packSetting.policy == PackRes_Def.packPolicy_standalone)
            {
                bundleDataList = InitStandaloneDataList();
            }
            else
            {
                Debug.LogError("PackTexture not support policy: " + packSetting.policy);
                return;
            }

            foreach (PackRes_Def.BundleData data in bundleDataList)
            {
                PackRes_Common.PrintObjectInfo(data);
            }

            Dictionary <string, string> idxMap = new Dictionary <string, string>();

            PackRes_Common.PackBundle(bundleDataList, packSetting.GetPlatformBundleFullPath(platform), platform, idxMap);

            PackRes_Common.ExpIdxFile(packSetting.GetPlatformIdxFileFullPath(platform), idxMap, packSetting.index_file);
        }
Example #2
0
        private static List <PackRes_Def.BundleData> InitCfgDataList()
        {
            string localpath   = Path.Combine(packSetting.cfg_path, packSetting.cfg_file);
            string packCfgPath = Path.GetFullPath(localpath);
            List <PackRes_Def.BundleData> bundleList = PackRes_Common.ParseResCfg(packCfgPath, packSetting.res_path, packSetting.option, packSetting.compress);

            return(bundleList);
        }
Example #3
0
        private static void AddIdxFileToChecksum(ref Dictionary <string, BundleCheckSumData> checksumDict, string idxPath, string fileName)
        {
            string             dp          = PackRes_Common.GetOrCreateAbsPath(idxPath);
            string             dstFile     = Path.Combine(dp, fileName.Trim(PackRes_Def.trim));
            BundleCheckSumData idxChecksum = new BundleCheckSumData();

            idxChecksum.md5  = PackRes_Common.ComputeFileMD5Value(dstFile);
            idxChecksum.size = PackRes_Common.GetFileSize(dstFile);
            checksumDict.Add(fileName, idxChecksum);
        }
Example #4
0
        private static void ParseSetting()
        {
            string configpath = Path.GetFullPath(TEXTURE_PACK_CONFIG_PATH);

            Debug.Log(configpath);

            packSetting = PackRes_Common.ParsePackSetting(configpath);


            PackRes_Common.PrintObjectInfo(packSetting);
        }
Example #5
0
        private static void ParseSetting()
        {
            packSetting = PackRes_Common.ParsePackSetting(Path.GetFullPath(GUI_PACK_CONFIG_PATH));

//			packSetting.exp_path = Path.Combine(packSetting.exp_path, platform);
//
//			packSetting.res_idx_path = Path.Combine(packSetting.exp_path, packSetting.res_idx_path);
//
//			packSetting.exp_path = Path.Combine(packSetting.exp_path, packSetting.bundle_path);

            PackRes_Common.PrintObjectInfo(packSetting);
        }
Example #6
0
        private static void Pack()
        {
            string exppath = packSetting.GetPlatformBundleRelativePath(platform);

            PackRes_Common.PrintObjectInfo(packSetting);

            List <string> files = PackRes_Common.GetFileListRecursively(packSetting.res_path, packSetting.fileTypeList);

            foreach (string scene in files)
            {
                Debug.Log(scene);
            }
            Dictionary <string, string> idxMap = new Dictionary <string, string>();

            PackRes_Common.PackScenes(files, exppath, platform, idxMap);

            PackRes_Common.ExpIdxFile(packSetting.GetPlatformIdxFileFullPath(platform), idxMap, packSetting.index_file);
        }
Example #7
0
        private static List <PackRes_Def.BundleData> InitStandaloneDataList()
        {
            List <PackRes_Def.BundleData> bundleDataList = new List <PackRes_Def.BundleData>();

            List <string> files = PackRes_Common.GetFileListRecursively(packSetting.res_path, packSetting.fileTypeList);

            foreach (string file in files)
            {
                PackRes_Def.BundleData bundleData = new PackRes_Def.BundleData();
                bundleData.bundleFile  = PackRes_Def.bundlePrefix_standalone + Path.GetFileName(file) + ".bundle";
                bundleData.srcFiles    = new string[1];
                bundleData.srcFiles[0] = file;
                bundleData.names       = new string[1];
                bundleData.names[0]    = Path.GetFileName(file);
                bundleData.compress    = packSetting.compress;
                bundleData.option      = packSetting.option;

                bundleDataList.Add(bundleData);
            }
            return(bundleDataList);
        }
Example #8
0
 private static void ParseSetting()
 {
     packSetting = PackRes_Common.ParsePackSetting(Path.GetFullPath(SCENE_PACK_CONFIG_PATH));
 }
Example #9
0
        private static void GenerateIndexFile()
        {
            PackRes_Def.PackSetting textureSetting = PackRes_Textures.packSetting;
            PackRes_Def.PackSetting guiSetting     = PackRes_Gui.packSetting;
            PackRes_Def.PackSetting sceneSetting   = PackRes_Scene.packSetting;



            List <PackRes_Def.PackSetting> packSettingList = new List <PackRes_Def.PackSetting>();

            packSettingList.Add(textureSetting);
            packSettingList.Add(guiSetting);
            packSettingList.Add(sceneSetting);

            string platformDir = Path.Combine(Path.GetFullPath(binPath), platform);

            if (Directory.Exists(platformDir))
            {
                Directory.Delete(Path.Combine(Path.GetFullPath(binPath), platform), true);
            }
            Directory.CreateDirectory(Path.Combine(Path.GetFullPath(binPath), platform));

            Dictionary <string, BundleCheckSumData> bundleChecksumDict = new Dictionary <string, BundleCheckSumData>();
            Dictionary <string, string>             idxMap             = new Dictionary <string, string>();

            foreach (PackRes_Def.PackSetting packSetting in packSettingList)
            {
                string idxfile = packSetting.GetPlatformIdxFileFullPath(platform);
                idxfile = Path.Combine(idxfile, packSetting.index_file);

                string srcBundlePath  = packSetting.GetPlatformBundleFullPath(platform);
                string destBundlePath = Path.Combine(Path.GetFullPath(binPath), platform);

                Debug.Log("idxfile: " + idxfile);

                Dictionary <string, string> tempIdx = LoadIdxMapFile(idxfile);
                foreach (KeyValuePair <string, string> pair in tempIdx)
                {
                    if (idxMap.ContainsKey(pair.Key))
                    {
                        Debug.LogError("Dupilate asset : " + pair.Key + "  bundle: " + pair.Value);
                        throw new PackRes_Def.PckException("Dupilate asset : " + pair.Key + "  bundle: " + pair.Value);
                    }
                    else
                    {
                        idxMap.Add(pair.Key, pair.Value);

                        //copy the bundle file to bin path
                        string srcfile  = Path.Combine(srcBundlePath, pair.Value);
                        string destfile = Path.Combine(destBundlePath, pair.Value);
                        if (!File.Exists(srcfile))
                        {
                            Debug.LogError("srcfile not exist: " + srcfile);
                            throw new PackRes_Def.PckException("srcfile not exist: " + srcfile);
                        }
                        if (!File.Exists(destfile))
                        {
                            File.Copy(srcfile, destfile);
                        }

                        //create the bundleMD5Dict
                        if (!bundleChecksumDict.ContainsKey(pair.Value))
                        {
                            BundleCheckSumData checksum = new BundleCheckSumData();
                            checksum.md5  = PackRes_Common.ComputeFileMD5Value(destfile);
                            checksum.size = PackRes_Common.GetFileSize(destfile);
                            bundleChecksumDict.Add(pair.Value, checksum);
                        }
                    }
                }
            }
            string temppath = Path.Combine(binPath, platform);

            PackRes_Common.ExpIdxFile(temppath, idxMap, idxFileName);
            AddIdxFileToChecksum(ref bundleChecksumDict, temppath, idxFileName);
            PackRes_Common.ExpBundleCheckSumFile(temppath, bundleChecksumDict, bundleMd5FileName);
        }