public bool ReadPatchList(ref NDataReader dr) { bool result; try { StringBuilder stringBuilder = new StringBuilder(512); StringBuilder stringBuilder2 = new StringBuilder(512); StringBuilder stringBuilder3 = new StringBuilder(512); if (dr.BeginSection("[FinalList2]")) { ListCompressor listCompressor = new ListCompressor(); foreach (NDataReader.Row row in dr) { if (row.LineType == NDataReader.Row.TYPE.LINE_DATA) { stringBuilder.Length = 0; stringBuilder.Append(row[0].str); stringBuilder = listCompressor.ReplaceWord(stringBuilder, false); if (stringBuilder[0] == '?') { stringBuilder.Remove(0, 1); stringBuilder3.Length = 0; stringBuilder3.Append(stringBuilder.ToString()); } else { PatchFileInfo patchFileInfo = new PatchFileInfo(); patchFileInfo.SetDataFrom(this, row); stringBuilder2.Length = 0; stringBuilder2.AppendFormat("{0}/{1}", stringBuilder3, stringBuilder); stringBuilder2 = stringBuilder2.Replace("//", "/"); string text = stringBuilder2.ToString(); if (this.UpdateCustomCacheInfo != null) { patchFileInfo.bUseCustomCache = this.UpdateCustomCacheInfo.CheckCustomCacheInfo(text); } if (!text.Contains("duplicationfilelist")) { if (this.FilesList.ContainsKey(text)) { PatchFileInfo patchFileInfo2 = new PatchFileInfo(); this.FilesList.TryGetValue(text, out patchFileInfo2); this._OutputDebug(string.Format("Warning - duplicated patch list item : {0} / already:{1} new:{2}", text, patchFileInfo2.Version, patchFileInfo.Version)); if (patchFileInfo2.Version < patchFileInfo.Version) { this.FilesList[text] = patchFileInfo; } } this.FilesList.Add(text, patchFileInfo); } } } } result = true; } else { result = false; } } catch (Exception ex) { this._OutputDebug(ex.ToString()); result = false; } return(result); }
private bool ReadFinalList2(ref NDataReader dr) { this.m_LoadPatchListVersion = 0f; string text = string.Empty; NDataSection nDataSection = dr["Header"]; text = nDataSection["PatchVersion"]; bool bUserReplaceWord = nDataSection["UseListCompressor"]; if (text.ToLower().Equals("final")) { this.m_LoadPatchListVersion = PatchFileInfo.VER_FINAL; } else { float.TryParse(text, out this.m_LoadPatchListVersion); } bool result; try { ListCompressor listCompressor = new ListCompressor(bUserReplaceWord); StringBuilder stringBuilder = new StringBuilder(512); StringBuilder stringBuilder2 = new StringBuilder(512); StringBuilder stringBuilder3 = new StringBuilder(512); this.UseFieldNames = dr.ReadFieldNames(); if (this.UseFieldNames) { this._idx_CRC = dr.GetFieldIndex("CRC"); this._idx_PatchLevel = dr.GetFieldIndex("PatchLevel"); this._idx_LangCode = dr.GetFieldIndex("LangCode"); this._idx_Prepack = dr.GetFieldIndex("UsePrepack"); } if (dr.BeginSection("[FinalList2]")) { foreach (NDataReader.Row row in dr) { if (row.LineType == NDataReader.Row.TYPE.LINE_DATA) { stringBuilder.Length = 0; stringBuilder.Append(row[0].str); stringBuilder = listCompressor.ReplaceWord(stringBuilder, false); if (stringBuilder[0] == '?') { stringBuilder.Remove(0, 1); stringBuilder3.Length = 0; stringBuilder3.Append(stringBuilder.ToString()); } else { PatchFileInfo patchFileInfo = new PatchFileInfo(); patchFileInfo.SetDataFrom(this, row); stringBuilder2.Length = 0; stringBuilder2.AppendFormat("{0}/{1}", stringBuilder3, stringBuilder); stringBuilder2 = stringBuilder2.Replace("//", "/"); string text2 = stringBuilder2.ToString(); if (this.UpdateCustomCacheInfo != null) { patchFileInfo.bUseCustomCache = this.UpdateCustomCacheInfo.CheckCustomCacheInfo(text2); } if (this.FilesList.ContainsKey(text2)) { PatchFileInfo patchFileInfo2 = new PatchFileInfo(); this.FilesList.TryGetValue(text2, out patchFileInfo2); this._OutputDebug(string.Format("Warning - duplicated patch list item : {0} / already:{1} new:{2}", text2, patchFileInfo2.Version, patchFileInfo.Version)); if (patchFileInfo2.Version < patchFileInfo.Version) { this.FilesList[text2] = patchFileInfo; } } if (patchFileInfo.bUsePrepack && !this.preResourceLastVersionList.Contains(patchFileInfo.VersionString)) { this.preResourceLastVersionList.Add(patchFileInfo.VersionString); } this.FilesList.Add(text2, patchFileInfo); } } } this.preResourceLastVersionList.Sort(); if (dr.BeginSection("[prepackVersionList]")) { string text3 = string.Empty; foreach (NDataReader.Row row2 in dr) { text3 = row2.GetColumn(0); if (!this.preResourceAllVersionList.Contains(text3)) { this.preResourceAllVersionList.Add(text3); } } this.preResourceAllVersionList.Sort(); } result = true; } else { result = false; } } catch (Exception ex) { this._OutputDebug(ex.ToString()); result = false; } return(result); }