Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
0
        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);
                }
            }
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        private static void ShowABManifest(string manifestFile)
        {
            ABManifest manifest = ABManifest.Deserialize(manifestFile);

            Debug.LogFormat("manifestFile:{0} content:\n{1}", manifestFile, manifest.ToString());
        }