//バイナリからデータを上書き・追加 public void Read(BinaryReader reader) { int magicID = reader.ReadInt32(); if (magicID != MagicID) { throw new System.Exception("Read File Error " + magicID); } FileLists.Clear(); int version = reader.ReadInt32(); if (version == Version) { int count = reader.ReadInt32(); for (int i = 0; i < count; ++i) { string key = reader.ReadString(); ConvertFileInfoDictionary assetBundleDictionary = new ConvertFileInfoDictionary(this, key); assetBundleDictionary.Read(reader); FileLists.Add(assetBundleDictionary.Key, assetBundleDictionary); } } else { throw new System.Exception(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version)); } }
//独自定義ファイルをバージョンアップする。バージョンアップチェックはしない(Eidtor上のみ使用可能) public void EditorVersionUp(string key, List <CusomFileVersionUpInfo> cusomFileVersionUpInfoList) { ConvertFileInfoDictionary oldInfoList; FileLists.TryGetValue(key, out oldInfoList); ConvertFileInfoDictionary newInfoList = new ConvertFileInfoDictionary(this, key); foreach (var versionUpInfo in cusomFileVersionUpInfoList) { ConvertFileInfo info; if (oldInfoList != null && oldInfoList.TryGetValue(versionUpInfo.Name, out info)) { if (versionUpInfo.IsVersionUp) { info.VersionUp(); } } else { info = new ConvertFileInfo(versionUpInfo.Name, newInfoList); } if (newInfoList.ContainsKey(info.Name)) { Debug.LogError(info.Name + " is already contains "); continue; } newInfoList.Add(info.Name, info); } FileLists.Remove(key); FileLists.Add(key, newInfoList); }
//データをバージョンアップする(Eidtor上のみ使用可能) public int EditorVersionUpAssetBundle(AssetBundleManifest manifest, UnityEditor.BuildTarget buildTarget) { int count = 0; string buildTargetKey = AssetBundleHelper.BuildTargetToBuildTargetFlag(buildTarget).ToString(); ConvertFileInfoDictionary oldInfoList; FileLists.TryGetValue(buildTargetKey, out oldInfoList); ConvertFileInfoDictionary newInfoList = new ConvertFileInfoDictionary(this, buildTargetKey); foreach (string assetBundleName in manifest.GetAllAssetBundles()) { ConvertFileInfo info; if (oldInfoList != null && oldInfoList.TryGetValue(assetBundleName, out info)) { if (info.VersionUp(manifest)) { ++count; } } else { info = new ConvertFileInfo(assetBundleName, manifest, newInfoList); ++count; } newInfoList.Add(info.Name, info); } FileLists.Remove(newInfoList.Key); FileLists.Add(newInfoList.Key, newInfoList); return(count); }
//独自定義のファイルの情報作成 public ConvertFileInfo(string name, ConvertFileInfoDictionary list) { this.Name = name; this.Version = 0; this.AllDependencies = new string[0]; this.DirectDependencies = new string[0]; this.List = list; }
//アセットバンドルマニフェストから作成 public ConvertFileInfo(string name, AssetBundleManifest manifest, ConvertFileInfoDictionary list) { this.Name = name; this.Version = 0; this.Hash = manifest.GetAssetBundleHash(name); this.AllDependencies = manifest.GetAllDependencies(name); this.DirectDependencies = manifest.GetDirectDependencies(name); this.List = list; }
public ConvertFileInfo(BinaryReader reader, ConvertFileInfoDictionary list) { this.List = list; Read(reader); }