/// <summary> /// 初期化 /// </summary> public IEnumerator Initialize(RuntimePlatform platform, AssetBundleConfig config) { m_saveDirRoot = config.GetSaveStorage(platform); m_versionFile = config.GetSaveFile(platform); var path = m_versionFile.FullPath; ChipstarLog.Log_InitStorageDB(path); var isExist = File.Exists(path); if (!isExist) { // なければ空データ BuildEmpty(m_versionFile); yield break; } try { // あったら読み込んで変換 var table = m_builder.Read(path); m_runtimeTable = table.List .ToDictionary( c => c.Identifier, c => new CachedFileData(c, m_saveDirRoot) ); } catch (Exception e) { // 読み込み失敗したのでとりあえず空でつくりなおし ChipstarLog.Assert(e.Message); BuildEmpty(m_versionFile); } yield return(null); }
//================================== // 関数 //================================== /// <summary> /// ローカルのファイルを取得 /// </summary> public static CriVersionTableJson ReadLocal(string path, Encoding encoding) { var isExist = File.Exists(path); if (!isExist) { //なければ空データ return(new CriVersionTableJson()); } try { var contents = File.ReadAllText(path, encoding); return(JsonUtility.FromJson <CriVersionTableJson>(contents)); } catch (Exception e) { // 失敗したらとりあえず空でやり直し ChipstarLog.Assert(e.Message); return(new CriVersionTableJson()); } }