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); }
public static List <PackRes_Def.BundleData> ParseResCfg(string pckCfgFile, string srcPath, string option, bool compress) { SectionDataCollection sectionList = GetSectsFromCfg(pckCfgFile); if (sectionList == null || sectionList.Count == 0) { return(null); } //get all settings List <PackRes_Def.BundleData> bundlelist = new List <PackRes_Def.BundleData>(); foreach (SectionData sect in sectionList) { PackRes_Def.BundleData bundledata = new PackRes_Def.BundleData(); bundledata.bundleFile = sect.SectionName.Trim(PackRes_Def.trim); bundledata.bundleFile = PackRes_Def.GetPlatformPathString(bundledata.bundleFile); bundledata.option = option; bundledata.compress = compress; string source = GetValFromCfg(sect, "source"); if (source == null || source == "") { throw new PackRes_Def.PckException("can not get source file in section: " + sect); } else { string[] files = source.Split('|'); List <string> srcFiles = new List <string>(); List <string> srcNames = new List <string>(); foreach (string file in files) { string tmp = file.Trim(PackRes_Def.trim); string name = Path.GetFileName(tmp); if (name.StartsWith("*.")) { string path = Path.GetDirectoryName(tmp); string[] names = Directory.GetFiles(Path.Combine(srcPath, path), name, SearchOption.AllDirectories); foreach (string n in names) { string n0 = Path.GetFileName(n); srcFiles.Add(n); //(Path.Combine(srcPath, Path.Combine(path, n0))); srcNames.Add(n0); } } else { srcNames.Add(name); srcFiles.Add(Path.Combine(srcPath, tmp)); } } bundledata.srcFiles = srcFiles.ToArray(); bundledata.names = srcNames.ToArray(); } bundlelist.Add(bundledata); } return(bundlelist); }