const int Version1 = 1; //キャッシュ情報のファイルバージョン /// <summary> /// キャッシュデータテーブルをバイナリ読み込み /// </summary> /// <param name="reader">バイナリリーダー</param> void Read(BinaryReader reader, AssetFileManagerSettings settings, ConvertFileListManager convertFileListManager) { int magicID = reader.ReadInt32(); if (magicID != MagicID) { throw new System.Exception("Read File Id Error"); } int fileVersion = reader.ReadInt32(); if (fileVersion == Version) { cacheFileID = reader.ReadInt32(); int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { Add(new AssetFileInfo(reader, settings, convertFileListManager)); } } else if (fileVersion == Version1) { cacheFileID = reader.ReadInt32(); int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { Add(AssetFileInfo.ReadOld(reader, settings, convertFileListManager)); } } else { throw new System.Exception(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, fileVersion)); } }
internal void SetConvertFileInfo(ConvertFileListManager convertFileListManager) { foreach (var fileInfo in Values) { fileInfo.SetConvertFileInfo(convertFileListManager); } }
/// <summary> /// コンストラクタ /// </summary> /// <param name="reader"></param> /// <param name="fileVersion">バイナリリーダー</param> public AssetFileInfo(BinaryReader reader, AssetFileManagerSettings settings, ConvertFileListManager assetBundleManager) { string key = reader.ReadString(); this.cacheVersion = reader.ReadInt32(); this.cachePath = reader.ReadString(); InitSub(key, settings, assetBundleManager); }
//コンバートファイル情報を設定 public void SetConvertFileInfo(ConvertFileListManager convertFileListManager) { //コンバートファイル情報を取得 if (convertFileListManager.TryGetValue(Key, EncodeType, out this.convertFileInfo)) { this.Version = convertFileInfo.Version; if (this.Version > 0) { // Debug.Log(Key + "Version Up to " + Version); } } else { if (EncodeType == AssetFileEncodeType.AssetBundle) { Debug.LogError("NotFound AssetBundle path : " + filePath); } } }
void InitSub(string path, AssetFileManagerSettings settings, ConvertFileListManager convertFileListManager) { InitKey(path); this.filePath = Key; //ファイル設定を取得 this.setting = settings.FindSettingFromPath(FilePath); if (FileType == AssetFileType.Csv && FilePathUtil.CheckExtentionWithOutDouble(FilePath, ExtensionUtil.TSV, ExtensionUtil.UtageFile)) { loadFlags |= AssetFileLoadFlags.Tsv; } //保存場所の設定 this.strageType = ParseStrageType(); //コンバートファイル情報を設定 if (convertFileListManager.IsInitialized) { SetConvertFileInfo(convertFileListManager); } }
//起動時初期化 internal void BootInit(AssetFileManagerSettings settings, ConvertFileListManager convertFileListManager) { #if !(UNITY_WEBPLAYER || UNITY_WEBGL) this.Clear(); if (!AssetFileManager.DontUseCache) { if (!FileIOManger.ReadBinaryDecode(CacheTblPath, (reader) => Read(reader, settings, convertFileListManager))) { this.Clear(); } } #endif if (AssetFileManager.isDebugBootDeleteChacheAll) { DeleteCacheFileAllSub(); } else if (AssetFileManager.isDebugBootDeleteChacheTextAndBinary) { DeleteCacheFileAllSub(AssetFileType.Text); DeleteCacheFileAllSub(AssetFileType.Bytes); DeleteCacheFileAllSub(AssetFileType.Csv); } }
/// <summary> /// ファイルリストをロードして初期化する /// </summary> void LoadInitFileListSub(List <string> pathList, int version) { ConvertFileListManager.LoadStart(pathList, version, OnLoadCompleteFileList); }
internal AssetFileUtage CreateFile(string path, AssetFileManagerSettings settings, StringGridRow rowData, ConvertFileListManager convertFileListManager) { //ファイル情報を取得or作成 AssetFileInfo fileInfo; if (!TryGetValue(path, out fileInfo)) { if (string.IsNullOrEmpty(path)) { Debug.LogError(path); } fileInfo = new AssetFileInfo(path, settings, convertFileListManager); this.Add(fileInfo); } //ロードファイルクラスを作成 return(new AssetFileUtage(this, fileInfo, rowData, FileIOManger)); }
/// <summary> /// コンストラクタ /// </summary> /// <param name="reader"></param> /// <param name="fileVersion">バイナリリーダー</param> public static AssetFileInfo ReadOld(BinaryReader reader, AssetFileManagerSettings settings, ConvertFileListManager assetBundleManager) { string key = reader.ReadString(); reader.ReadInt32(); AssetFileInfo info = new AssetFileInfo(key, settings, assetBundleManager); info.cacheVersion = reader.ReadInt32(); info.cachePath = reader.ReadString(); reader.ReadInt32(); return(info); }
public AssetFileInfo(string path, AssetFileManagerSettings settings, ConvertFileListManager convertFileListManager) { InitSub(path, settings, convertFileListManager); }