예제 #1
0
        private void learnFormAssetBundle(string path)
        {
            FileStream      fs     = new FileStream(path, FileMode.Open, FileAccess.Read);
            DataReader      br     = new DataReader(fs);
            SerializeBundle bundle = new SerializeBundle();

            bundle.DeSerialize(br);
            foreach (var bundleEntry in bundle.entrys)
            {
                int version         = AssetToolUtility.GetAssetsFileVersion(bundleEntry.assetData);
                var serializeAssets = SerializeAssetFactory.CreateWithVersion(version);
                if (serializeAssets != null)
                {
                    MemoryStream ms = new MemoryStream(bundleEntry.assetData);
                    DataReader   dr = new DataReader(ms);
                    serializeAssets.DeSerialize(dr);
                    var assetTypeTreeDB = AssetToolUtility.GenerateTypeTreeDataBase(serializeAssets);
                    if (assetTypeTreeDB != null)
                    {
                        var allType = assetTypeTreeDB.GetAllType(version);
                        foreach (var type in allType)
                        {
                            Console.WriteLine("AddType:Version:{0},ClassID{1},Name:{2}", version, type.Key, type.Value.type);
                        }
                    }
                    typeTreeDatabase = assetTypeTreeDB.Merage(typeTreeDatabase);
                }
                else
                {
                    Debug.LogError("can't deserialize bundle entry " + bundleEntry.name);
                }
                fs.Dispose();
            }
        }
예제 #2
0
        private void learnFormAssetFile(string path)
        {
            FileStream fs              = new FileStream(path, FileMode.Open, FileAccess.Read);
            DataReader dr              = new DataReader(fs);
            int        version         = AssetToolUtility.GetAssetsFileVersion(path);
            var        serializeAssets = SerializeAssetFactory.CreateWithVersion(version);

            serializeAssets.DeSerialize(dr);
            var assetTypeTreeDB = AssetToolUtility.GenerateTypeTreeDataBase(serializeAssets);

            typeTreeDatabase = assetTypeTreeDB.Merage(typeTreeDatabase);
            dr.Close();
            fs.Dispose();
        }