Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        private static string GetIndexFilePath(PackRes_Def.PackSetting packSetting, string pPlatform)
        {
            string exp_r_path = "../";
            string exp_path   = Path.GetFullPath(exp_r_path);
            string temp       = Path.Combine(exp_path, pPlatform);

            temp = Path.Combine(temp, packSetting.res_idx_path);
            temp = Path.Combine(temp, packSetting.index_file);

            return(temp);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
 private static void ParseSetting()
 {
     packSetting = PackRes_Common.ParsePackSetting(Path.GetFullPath(SCENE_PACK_CONFIG_PATH));
 }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
        public static PackRes_Def.PackSetting ParsePackSetting(string configFilePath)
        {
            FileIniDataParser iniParser = new FileIniDataParser();
            IniData           data      = iniParser.LoadFile(configFilePath);

            PackRes_Def.PackSetting packSetting = new PackRes_Def.PackSetting();

            SectionData sectionData = data.Sections.GetSectionData("global_settings");


            packSetting.cfg_path = GetValFromCfg(sectionData, "cfg_path");
            packSetting.cfg_path = PackRes_Def.GetPlatformPathString(packSetting.cfg_path);

            packSetting.cfg_file = GetValFromCfg(sectionData, "cfg_file");
            packSetting.cfg_file = PackRes_Def.GetPlatformPathString(packSetting.cfg_file);

            packSetting.res_path = GetValFromCfg(sectionData, "res_path");
            packSetting.res_path = PackRes_Def.GetPlatformPathString(packSetting.res_path);

            packSetting.option   = GetValFromCfg(sectionData, "option");
            packSetting.exp_path = Path.GetFullPath(GetValFromCfg(sectionData, "exp_path"));
            packSetting.exp_path = PackRes_Def.GetPlatformPathString(packSetting.exp_path);

            packSetting.bundle_path  = GetValFromCfg(sectionData, "bundle_path");
            packSetting.bundle_path  = PackRes_Def.GetPlatformPathString(packSetting.bundle_path);
            packSetting.res_idx_path = GetValFromCfg(sectionData, "res_idx_path");
            packSetting.res_idx_path = PackRes_Def.GetPlatformPathString(packSetting.res_idx_path);

            packSetting.index_file = GetValFromCfg(sectionData, "index_file");

            packSetting.policy = GetValFromCfg(sectionData, "policy");

            string compress_str = GetValFromCfg(sectionData, "compress");

            if (compress_str == "false")
            {
                packSetting.compress = false;
            }
            else if (compress_str == "true")
            {
                packSetting.compress = true;
            }
            else
            {
                Debug.LogError("invalid compress setting");
            }

            //parse the file type list
            packSetting.fileTypeList = new List <string>();
            string type_str = GetValFromCfg(sectionData, "res_type_list");

            string[] type_arry = type_str.Split('|');
            foreach (string ty in type_arry)
            {
                if (ty != null && ty != "")
                {
                    packSetting.fileTypeList.Add(ty);
                }
            }
            return(packSetting);
        }