public bool MoveNext() { uint num = (uint)_PC; _PC = -1; switch (num) { case 0: Debug.Log("DataManager : readMasterData ver " + dataVersion); readMasterDataResult = ReadMasterDataResult.BUSY; useProtobuf = 1; if (!f__this.CheckWaitforFrame()) { break; } current = new WaitForEndOfFrame(); _PC = 1; goto Label_0384; case 1: break; case 2: goto Label_025D; case 3: goto Label_032D; case 4: goto Label_035F; default: goto Label_0382; } var readOldTable = f__this.readMasterDataListFile(); Debug.LogError("start read data...."); mainDataFileName__2 = getCacheFileName(); mainPBDataFileName__3 = getCachePBFileName(); if (!File.Exists(mainDataFileName__2)) { if (!File.Exists(mainPBDataFileName__3)) { goto Label_0338; } try { bytes2__11 = ResDataManager.Instance.ReadDataConfig(mainPBDataFileName__3); arr2__12 = MST_DATA_ARRAY.Parser.ParseFrom(bytes2__11); masterDataObject = new MST_DATA(); masterDataObject = arr2__12.Items[0]; } catch (Exception exception2) { e__13 = exception2; Debug.LogError("exception : " + e__13.Message); f__this.ClearPBSaveDataList(); readMasterDataResult = ReadMasterDataResult.READ_ERROR; goto Label_0382; } if (f__this.CheckWaitforFrame()) { current = new WaitForEndOfFrame(); _PC = 3; goto Label_0384; } goto Label_032D; } try { br__4 = new BinaryReader(File.OpenRead(mainDataFileName__2)); try { forCnt__5 = f__this.saveNameList.Count; i__6 = 0; while (i__6 < forCnt__5) { mainCryptString__7 = br__4.ReadString(); mainKey__8 = f__this.getMdk(f__this.saveNameList[i__6], dataVersion); mainDataString__9 = MdcStr.Dc(mainCryptString__7, mainKey__8, new uint?(f__this.saveCrcList[i__6])); f__this.saveCrcList.Add(0); f__this.saveDataList.Add(mainDataString__9); i__6++; } } finally { if (br__4 != null) { ((IDisposable)br__4).Dispose(); } } } catch (Exception exception) { e__10 = exception; Debug.LogError("exception : " + e__10.Message); f__this.ClearSaveDataList(); readMasterDataResult = ReadMasterDataResult.READ_ERROR; goto Label_0382; } if (f__this.CheckWaitforFrame()) { current = new WaitForEndOfFrame(); _PC = 2; goto Label_0384; } Label_025D: readMasterDataResult = ReadMasterDataResult.OK; goto Label_0382; Label_032D: readMasterDataResult = ReadMasterDataResult.OK; goto Label_0382; Label_0338: if (f__this.CheckWaitforFrame()) { current = new WaitForEndOfFrame(); _PC = 4; goto Label_0384; } Label_035F: f__this.ClearSaveDataList(); f__this.ClearPBSaveDataList(); readMasterDataResult = ReadMasterDataResult.EMPTY_MASTER_ERROR; _PC = -1; Label_0382: return false; Label_0384: return true; }
public bool readMasterDataListFile() { saveNameList.Clear(); saveCrcList.Clear(); saveDataList.Clear(); if (!ManagerConfig.UseMock) { string path = string.Empty; path = getCacheListFileName(); if (File.Exists(path)) { if (_DispLog) { Debug.Log("DataManager load list [" + path + "]"); } string s = null; string[] strArray = null; string message = null; int num = 3; while (num-- > 0) { try { message = null; uint? crc = null; s = MdcStr.Dc(File.ReadAllText(path), 0, crc); break; } catch (Exception exception) { Debug.LogError("error " + exception.Message); s = null; message = exception.Message; continue; } } if (s != null) { try { char[] trimChars = new char[] { (char)0xfe, (char)0xff }; s = s.Trim(trimChars); char[] anyOf = new char[] { '\r', '\n' }; int length = s.IndexOfAny(anyOf); if (length > 1) { string str4 = s.Substring(0, length); if (str4.StartsWith("~")) { str4 = str4.Substring(1); s = s.Substring(length + 1); uint num3 = Crc32.Compute(Encoding.UTF8.GetBytes(s)); if (_DispLog) { Debug.Log(string.Concat(new object[] { "CRC (cache) :[", s.Length, "] ", str4, " ", num3 })); } if (uint.Parse(str4) == num3) { char[] separator = new char[] { '\r', '\n' }; strArray = s.Split(separator, StringSplitOptions.RemoveEmptyEntries); } else { message = "DataManager boot load crc error : チェックサム値が不一致"; } } else { message = "DataManager boot load error : 読み込んだファイルの先頭がチェックサムデータではなかった"; } } else { message = "DataManager boot load error : ファイル先頭の1行目の内容が空"; } } catch (Exception exception2) { message = "DataManager boot load error : " + exception2.Message; } } if (strArray != null) { if ((strArray.Length > 0) && strArray[0].StartsWith("@")) { char[] chArray4 = new char[] { ',' }; string[] strArray2 = strArray[0].Split(chArray4); string str5 = strArray2[0].Substring(1); if (ManagerConfig.MasterDataCacheVer != str5) { string[] textArray1 = new string[] { "master data versiton different (", str5, ") -> (", ManagerConfig.MasterDataCacheVer, ")" }; message = string.Concat(textArray1); } else if (strArray2.Length != 3) { message = "DataManager boot load error : list file parameter error"; } else { dataVersion = int.Parse(strArray2[1]); dateVersion = long.Parse(strArray2[2]); int num4 = strArray.Length; for (int i = 1; i < num4; i++) { char[] chArray5 = new char[] { ',' }; strArray2 = strArray[i].Split(chArray5); if (strArray2.Length != 2) { break; } string item = strArray2[0]; saveNameList.Add(item); uint num6 = uint.Parse(strArray2[1].Trim()); saveCrcList.Add(num6); } } } else { message = "DataManager boot load error : list file break"; } } if (message != null) { Debug.LogError(message); } else { return true; } } ClearSaveDataList(); } return false; }