public static ABManifest Deserialize(string fileName) { using (Stream sr = File.OpenRead(fileName)) { XmlSerializer serializer = new XmlSerializer(typeof(ABManifest)); ABManifest manifest = (ABManifest)serializer.Deserialize(sr); return(manifest); } }
static ABManager() { string manifestFile = Path.Combine(ABRootPath, ABManifest.FileName); if (File.Exists(manifestFile)) { Debug.LogFormat("ABManager(), manifestFile:{0} content:\n{1}", manifestFile, File.ReadAllText(manifestFile)); ABManifest manifest = ABManifest.Deserialize(manifestFile); foreach (var item in manifest.abItems) { configs.Add(item.name, item); } } }
private static void BuildAssetBundlesXMLManifest(string rootPath) { ABManifest manifest = new ABManifest(); foreach (var abName in AssetDatabase.GetAllAssetBundleNames()) { ABItem aBItem = new ABItem(); aBItem.name = abName; string abFile = Path.Combine(rootPath, abName); aBItem.fileSizeInBytes = new FileInfo(abFile).Length; aBItem.md5 = FileUtils.GetMD5HashFromFile(abFile); aBItem.dependencies = AssetDatabase.GetAssetBundleDependencies(abName, false); manifest.abItems.Add(aBItem); } string manifestXmlFile = Path.Combine(rootPath, ABManifest.FileName); manifest.Serialize(manifestXmlFile); ShowABManifest(manifestXmlFile); }
private static void ShowABManifest(string manifestFile) { ABManifest manifest = ABManifest.Deserialize(manifestFile); Debug.LogFormat("manifestFile:{0} content:\n{1}", manifestFile, manifest.ToString()); }