public bool Load(string strListFileName) { bool result; try { using (NDataReader nDataReader = new NDataReader()) { if (!nDataReader.Load(strListFileName)) { this.m_bLoadedOrSkipped = false; result = false; return(result); } this.FilesList.Clear(); NDataReader nDataReader2 = nDataReader; this.m_bLoadedOrSkipped = this.ReadFinalList2(ref nDataReader2); if (!this.m_bLoadedOrSkipped) { this.m_bLoadedOrSkipped = this.ReadFinalList(ref nDataReader2); } } result = this.m_bLoadedOrSkipped; } catch (Exception ex) { Console.WriteLine("The process failed: {0}", ex.ToString()); this.m_bLoadedOrSkipped = false; result = false; } return(result); }
public bool LoadFromGroupListContext(string strContext, string strFilePath, string sectinName = "[TextFiles]") { try { NDataReader nDataReader = new NDataReader(); if (nDataReader.LoadFrom(strContext)) { bool result; if (nDataReader.BeginSection(sectinName)) { foreach (NDataReader.Row row in nDataReader) { string str = row[0].str; string str2 = row[1].str; if (!this.LoadTextGroup(str, str2, strFilePath, false)) { result = false; return(result); } } } result = true; return(result); } } catch (Exception output) { this._OutputDebugLine(output); } return(false); }
public bool LoadFromText(string strText) { bool result; try { using (NDataReader nDataReader = new NDataReader()) { if (!nDataReader.LoadFrom(strText)) { this._OutputDebug(string.Format("NDataReader.LoadFromText failed: {0}", strText)); this.m_bLoadedOrSkipped = false; result = false; return(result); } this.FilesList.Clear(); NDataReader nDataReader2 = nDataReader; this.m_bLoadedOrSkipped = this.ReadFinalList2(ref nDataReader2); if (!this.m_bLoadedOrSkipped) { this.m_bLoadedOrSkipped = this.ReadFinalList(ref nDataReader2); } } result = this.m_bLoadedOrSkipped; } catch (Exception arg) { this._OutputDebug(string.Format("The process failed: {0}", arg)); this.m_bLoadedOrSkipped = false; result = false; } return(result); }
public static bool NDataReader_LoadFromText() { string strContext = Example.NDataReader_MakeTestContext(); NDataReader nDataReader = new NDataReader(); bool result = nDataReader.LoadFrom(strContext); int num = 0; foreach (NDataReader.Row row in nDataReader["Table"]) { num++; Console.WriteLine(row.ToDataString()); } NDataSection nDataSection = nDataReader["Table"]; object[] array = new object[] { 0, string.Empty, 0f }; foreach (NDataReader.Row row2 in nDataSection) { result = row2.GetColumn(ref array); } return(result); }
public static float GetLocalResourceVersion(string localPath) { int num = 0; string text = Path.Combine(localPath, "PatchLevel.ini"); if (File.Exists(text)) { NDataReader nDataReader = new NDataReader(); if (nDataReader.Load(text)) { num = nDataReader["Local"]["PatchLevel"]; } } string text2 = Path.Combine(localPath, string.Format("PatchedVersion.{0}.txt", num)); if (!File.Exists(text2)) { return(-1f); } NDataReader nDataReader2 = new NDataReader(); if (nDataReader2.Load(text2)) { return(nDataReader2["Local"]["PatchedVersion"]); } return(-1f); }
public bool LoadFromDataReader(string path, string sectionName) { bool bAutoReplace = this.m_owner.CRLFReplaceTime == NTextManager.CRLFReplaceTimeType.LOADING; try { NDataReader nDataReader = new NDataReader(); nDataReader.UseFileNameEncryption = this.m_UseFileNameEncryption; nDataReader.Load(path); NDataSection nDataSection = nDataReader[sectionName]; foreach (NDataReader.Row row in nDataSection) { int textKeyStartColumnIndex = NTextManager.TextKeyStartColumnIndex; string column = row.GetColumn(textKeyStartColumnIndex, bAutoReplace); string column2 = row.GetColumn(textKeyStartColumnIndex + 1, bAutoReplace); this.SetText(column, column2); } return(true); } catch (Exception output) { this._OutputDebugLine(output); } return(false); }
public bool LoadFromText(string strText, IUpdateCustomCacheInfo updateCustomCacheInfo) { if (updateCustomCacheInfo != null) { this.UpdateCustomCacheInfo = updateCustomCacheInfo; } bool result; try { NDataReader nDataReader = new NDataReader(); if (!nDataReader.LoadFrom(strText)) { this._OutputDebug(string.Format("NDataReader.LoadFromText failed: {0}", strText)); this.m_bLoadedOrSkipped = false; result = false; } else { this.FilesList.Clear(); this.m_bLoadedOrSkipped = this.ReadFinalList2(ref nDataReader); result = this.m_bLoadedOrSkipped; } } catch (Exception arg) { this._OutputDebug(string.Format("The process failed: {0}", arg)); this.m_bLoadedOrSkipped = false; result = false; } return(result); }
private bool ReadFinalList(ref NDataReader dr) { this._OutputDebug(string.Format("$$$SysConfig:ReadFinalPatchList! TsCaching.useCustomCacheOnly = {0}", TsCaching.useCustomCacheOnly)); this.m_LoadPatchListVersion = 0; this.m_LoadPatchListVersion = dr["[Header]"]["PatchVersion"]; TsPlatform.FileLog("test 1 m_LoadPatchListVersion = " + this.m_LoadPatchListVersion.ToString()); if (dr.BeginSection("[FinalList]")) { while (!dr.IsEndOfSection()) { NDataReader.Row currentRow = dr.GetCurrentRow(); if (currentRow.LineType == NDataReader.Row.TYPE.LINE_DATA) { PatchFileInfo patchFileInfo = new PatchFileInfo(); patchFileInfo.Version = ((1 >= currentRow.Values.Count) ? 0 : Convert.ToInt32(currentRow.GetColumn(1))); patchFileInfo.FileSize = ((2 >= currentRow.Values.Count) ? 0 : Convert.ToInt32(currentRow.GetColumn(2))); string text = currentRow.GetColumn(0).ToLower(); patchFileInfo.bUseCustomCache = this.CheckCustomCache(text); if (this.FilesList.ContainsKey(text)) { this._OutputDebug(string.Format("이미 등록된 파일명입니다!! {0}", text)); return(false); } this.FilesList.Add(text, patchFileInfo); } dr.NextLine(); } return(true); } return(false); }
public static void NDataReader_Performance(string strTestFileName, bool bUseOptimize, bool bLoadFromFile, int nTestMax, bool bDataPrint) { NDataReader.UseOptimize = bUseOptimize; TimeSpan t = TimeSpan.MinValue; TimeSpan t2 = TimeSpan.MaxValue; TimeSpan t3 = TimeSpan.Zero; for (int i = 0; i < nTestMax; i++) { using (NDataReader nDataReader = new NDataReader()) { Stopwatch stopwatch = new Stopwatch(); if (bLoadFromFile) { stopwatch.Reset(); stopwatch.Start(); nDataReader.Load(strTestFileName); stopwatch.Stop(); } else { using (StreamReader streamReader = new StreamReader(strTestFileName, Encoding.Default, true)) { string strContext = streamReader.ReadToEnd(); stopwatch.Reset(); stopwatch.Start(); nDataReader.BeginSection("[Table]"); nDataReader.LoadFrom(strContext); stopwatch.Stop(); streamReader.Close(); } } if (t < stopwatch.Elapsed) { t = stopwatch.Elapsed; } if (stopwatch.Elapsed < t2) { t2 = stopwatch.Elapsed; } t3 += stopwatch.Elapsed; if (bDataPrint) { foreach (NDataReader.Row value in nDataReader) { Console.WriteLine(value); } } } } Console.WriteLine("##### 최적화 여부 : {0} , 로드방식 : {1} #####", NDataReader.UseOptimize, (!bLoadFromFile) ? "컨텍스트로부터" : "파일로부터"); Console.WriteLine(" * Test Amount : {0}", nTestMax); Console.WriteLine(" * Max Time : {0} tick ({1})", t.Ticks, t.ToString()); Console.WriteLine(" * Min Time : {0} tick ({1})", t2.Ticks, t2.ToString()); Console.WriteLine(" * Avg Time : {0} tick ({1})", t3.Ticks / (long)nTestMax, TimeSpan.FromTicks(t3.Ticks / (long)nTestMax).ToString()); Console.WriteLine(); }
public static bool Load(string ndtfile, ITable table, NDataGenericLoader.DataCtor ctor, bool useFileNameEncryption = false) { NDataReader nDataReader = new NDataReader(); nDataReader.UseFileNameEncryption = useFileNameEncryption; if (nDataReader.Load(ndtfile)) { NDataGenericLoader.CommonParse(nDataReader, table, ctor); return(true); } return(false); }
private static void CommonParse(NDataReader dr, ITable table, NDataGenericLoader.DataCtor ctor) { if (!dr.BeginSection("[Table]")) { return; } foreach (NDataReader.Row data in dr) { ISetRow setRow = ctor(); setRow.SetData(data); table.Add(setRow); } }
public string ParseParamString(string strParamString, NTextManager kTextManager = null) { NDataReader nDataReader = new NDataReader(); this.Clear(); this.m_sb_ParamString.Append("(ParamStringError)"); if (nDataReader.LoadFrom(strParamString)) { if (nDataReader.BeginSection(this.SECTION_FORMAT)) { this.m_sb_ParamString.Length = 0; foreach (NDataReader.Row row in nDataReader.CurrentSection) { if (this.TXTKEY.Equals(row[0])) { string text = row[1]; text = this.__get_text_at_textmanager(kTextManager, text); this.m_sb_ParamString.Append(text); break; } this.m_sb_ParamString.Append(row.ToDataString()); this.m_sb_ParamString.AppendFormat("{0}", this.LINE); } } if (nDataReader.BeginSection(this.SECTION_PARAMS)) { foreach (NDataReader.Row row2 in nDataReader.CurrentSection) { string oldValue = row2[0]; string text2 = row2[1]; if (this.TXTKEY.Equals(text2)) { text2 = row2.GetColumn(2); text2 = this.__get_text_at_textmanager(kTextManager, text2); } this.m_sb_ParamString = this.m_sb_ParamString.Replace(oldValue, text2); } this.m_sb_ParamString = this.m_sb_ParamString.Replace("{\\r\\n}", "\r\n"); } else { this.__output_error(string.Format("{0} 섹션이 없습니다.", this.SECTION_PARAMS)); } } else { this.__output_error("Load Failed!"); } return(this.m_sb_ParamString.ToString()); }
public bool Load(string filename) { using (NDataReader nDataReader = new NDataReader()) { nDataReader.Load(filename); NDataSection nDataSection = nDataReader["Table"]; foreach (NDataReader.Row row in nDataSection) { if (!this.ParseRowData(row)) { return(false); } } } return(true); }
public static void NDataReader_Load_Instantly() { string strFileName = "D:\\quest.ndt"; Example.TestBindee testBindee = new Example.TestBindee(); using (NDataReader nDataReader = new NDataReader()) { bool flag = nDataReader.Load(strFileName, "[table]", testBindee); if (flag) { } } foreach (NDataReader.Row current in testBindee.m_kRows) { Console.WriteLine(current); } }
public bool Load(string strListFileName, IUpdateCustomCacheInfo updateCustomCacheInfo) { if (updateCustomCacheInfo != null) { this.UpdateCustomCacheInfo = updateCustomCacheInfo; } bool result; try { if (Path.GetExtension(strListFileName).ToLower() == ".zip") { using (FileStream fileStream = new FileStream(strListFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { using (BinaryReader binaryReader = new BinaryReader(fileStream)) { byte[] gzData = binaryReader.ReadBytes((int)fileStream.Length); result = this.LoadFromComp(gzData, updateCustomCacheInfo); return(result); } } } NDataReader nDataReader = new NDataReader(); if (!nDataReader.Load(strListFileName)) { this.m_bLoadedOrSkipped = false; result = false; } else { this.FilesList.Clear(); this.m_bLoadedOrSkipped = this.ReadFinalList2(ref nDataReader); result = this.m_bLoadedOrSkipped; } } catch (Exception ex) { Console.WriteLine("The process failed: {0}", ex.ToString()); this.m_bLoadedOrSkipped = false; result = false; } return(result); }
public static bool IsNeedBundlePatch(string urlPath, string versionStr) { string arg = "final.client.version.txt"; int num = 0; if (versionStr.Contains(".")) { versionStr.Replace(".", string.Empty); } int num2 = Convert.ToInt32(versionStr); string requestUriString = string.Format("{0}/apk/{1}", urlPath, arg); bool result; try { HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(requestUriString); httpWebRequest.Timeout = 10000; HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); Stream responseStream = httpWebResponse.GetResponseStream(); NDataReader nDataReader = new NDataReader(); if (nDataReader.LoadFrom(responseStream, Encoding.UTF8)) { num = nDataReader["Header"]["bundleversion"]; } httpWebResponse.Close(); if (num2 >= num) { result = false; } else { result = true; } } catch (Exception ex) { Util._OutputDebug(ex.ToString()); result = false; } return(result); }
public bool LoadFromGroupList(string groupListPath, bool useFileNameEncryption = false, string sectinName = "[TextFiles]") { try { bool result; if (groupListPath == null) { result = false; return(result); } string strFilePath = groupListPath.Substring(0, groupListPath.ToLower().IndexOf("/ndt/") + 1); NDataReader nDataReader = new NDataReader(); nDataReader.UseFileNameEncryption = useFileNameEncryption; if (nDataReader.Load(groupListPath)) { if (nDataReader.BeginSection(sectinName)) { foreach (NDataReader.Row row in nDataReader) { string str = row[0].str; string str2 = row[1].str; if (!this.LoadTextGroup(str, str2, strFilePath, useFileNameEncryption)) { result = false; return(result); } } } result = true; return(result); } result = false; return(result); } catch (Exception output) { this._OutputDebugLine(output); } return(false); }
public static Util.eCheckResourcePatch CheckRsourcePatchForLOH(string patchSerialPath, string localRoot) { Util.eCheckResourcePatch result; try { HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(patchSerialPath); httpWebRequest.Timeout = 5000; HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); Stream responseStream = httpWebResponse.GetResponseStream(); NDataReader nDataReader = new NDataReader(); if (nDataReader.LoadFrom(responseStream)) { float num = 0f; nDataReader.ReadKeyData("patch_serial", out num); float localResourceVersion = Util.GetLocalResourceVersion(localRoot); if (num > localResourceVersion) { result = Util.eCheckResourcePatch.NEED; } else { result = Util.eCheckResourcePatch.NOT_NEED; } } else { result = Util.eCheckResourcePatch.NOT_CONNECT; } } catch (Exception ex) { Util._OutputDebug(ex.ToString()); result = Util.eCheckResourcePatch.NOT_CONNECT; } return(result); }
public NoSectionException(NDataReader owner, string sectionName) : base(string.Format("NoSectionException: FileName : {0}, SectionName : {1}", (!(owner.FileName != string.Empty)) ? "[DownloadString]" : owner.FileName, sectionName)) { this.strNoSectionException = this.Message; Debug.LogError(this.strNoSectionException); }
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); }
private void SetServiceAreaInfo(ref NkServiceAreaInfo pkServiceAreaInfo) { string text = pkServiceAreaInfo.szServiceKey; string path = string.Format("Common/ServiceSettings/ServiceSetting_{0}", NrGlobalReference.strLangType); TextAsset textAsset = Resources.Load(path) as TextAsset; if (textAsset == null) { TsLog.LogError("serviceFileAsset != null", new object[0]); return; } NDataReader nDataReader = new NDataReader(); if (!nDataReader.LoadFrom(textAsset.text)) { TsLog.LogError("파일 로드에 실패 하였습니다. \n{0}", new object[] { textAsset.text }); return; } string text2 = string.Empty; bool flag = false; if (NrGlobalReference.strLiteCheck.Equals("on")) { text += "_LITE"; } while (!nDataReader.IsEOF()) { string column = nDataReader.GetCurrentRow().GetColumn(0); if (column.Length == 0) { nDataReader.NextLine(); } else if (column[0] == '#') { nDataReader.NextLine(); } else if (column[0] == '[') { flag = column.ToLower().Equals("[" + text.ToLower() + "]"); nDataReader.NextLine(); } else if (!flag) { nDataReader.NextLine(); } else { string[] array = column.Split(new char[] { '=' }); if (array[0].ToLower().Equals("protocol")) { text2 = array[1]; if (text2.Equals("file")) { pkServiceAreaInfo.eProtocolType = Protocol.FILE; pkServiceAreaInfo.szPrefsKey = NrPrefsKey.LOCAL_WWW_PATH; } else { pkServiceAreaInfo.eProtocolType = Protocol.HTTP; pkServiceAreaInfo.szPrefsKey = NrPrefsKey.INTERNET_WWW_PATH; } } if (array[0].ToLower().Equals("originaldatacdnpath")) { pkServiceAreaInfo.szOriginalDataCDNPath = array[1]; } if (array[0].ToLower().Equals("edgedatacdnpath")) { pkServiceAreaInfo.szEdgeDataCDNPath = array[1]; } if (array[0].ToLower().Equals("loginip")) { pkServiceAreaInfo.szLoginIP[0] = array[1]; pkServiceAreaInfo.szLoginIP[1] = array[1]; pkServiceAreaInfo.szLoginIP[2] = array[1]; } if (array[0].ToLower().Equals("loginip1")) { pkServiceAreaInfo.szLoginIP[0] = array[1]; } if (array[0].ToLower().Equals("loginip2")) { pkServiceAreaInfo.szLoginIP[1] = array[1]; } if (array[0].ToLower().Equals("loginip3")) { pkServiceAreaInfo.szLoginIP[2] = array[1]; } if (array[0].ToLower().Equals("webdomain")) { pkServiceAreaInfo.szWebDomain = array[1]; } if (array[0].ToLower().Equals("privateip")) { pkServiceAreaInfo.szPrivateIP = array[1]; } if (array[0].ToLower().Equals("privatedomain")) { pkServiceAreaInfo.szPrivateDomain = array[1]; } if (array[0].ToLower().Equals("imageurl")) { pkServiceAreaInfo.szImageURL = array[1]; } nDataReader.NextLine(); } } }
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 void ReadyService() { if (!TsPlatform.IsMobile) { return; } string text = string.Empty; string text2 = string.Empty; string text3 = string.Empty; string text4 = string.Empty; string text5 = string.Empty; string text6 = string.Empty; string path = "Common/ServiceSettings/ServiceInfo"; if (TsPlatform.IsIPhone) { path = "Common/ServiceSettings/ServiceInfo_IOS"; } TextAsset textAsset = Resources.Load(path) as TextAsset; if (textAsset != null) { NDataReader nDataReader = new NDataReader(); if (!nDataReader.LoadFrom(textAsset.text)) { TsLog.LogError("파일 로드에 실패 하였습니다. \n{0}", new object[] { textAsset.text }); return; } nDataReader.FirstLine(); while (!nDataReader.IsEOF()) { string column = nDataReader.GetCurrentRow().GetColumn(0); if (column.Length == 0) { nDataReader.NextLine(); } else { string[] array = column.Split(new char[] { '=' }); if (array[0].Trim().ToLower().Equals("langtype")) { text = array[1]; TsLog.LogWarning("langtype : {0}", new object[] { text }); } if (array[0].Trim().ToLower().Equals("servicecode")) { text2 = array[1]; TsLog.LogWarning("servicecode : {0}", new object[] { text2 }); } if (array[0].Trim().ToLower().Equals("apkversion")) { text3 = array[1]; TsLog.LogWarning("apkversion : {0}", new object[] { text3 }); } if (array[0].Trim().ToLower().Equals("packagesuffix")) { text4 = array[1]; TsLog.LogWarning("packagesuffix : {0}", new object[] { text4 }); } if (array[0].Trim().ToLower().Equals("litecheck")) { text5 = array[1]; TsLog.LogWarning("litecheck : {0}", new object[] { text5 }); } if (array[0].Trim().ToLower().Equals("appidfix")) { text6 = array[1]; TsLog.LogWarning("appidfix : {0}", new object[] { text6 }); } nDataReader.NextLine(); } } if (text4.Length > 0) { NrGlobalReference.strPackageSuffix = text4.Trim().ToLower(); } if (text5.Equals("on") || text5.Equals("fix")) { NrGlobalReference.strLiteCheck = text5.Trim().ToLower(); } if (text.Length > 0) { NrGlobalReference.strLangType = text.Trim().ToLower(); } if (text6.Length > 0) { NrGlobalReference.MobileIDAdd = text6.Trim().ToLower(); } if (text2.Length > 0) { NrGlobalReference.SERVICECODE = text2.Trim(); if (TsPlatform.IsMobile) { TsPlatform.Operator.SetMobileIdentifier(); } } if (text3.Length > 0) { if (TsPlatform.IsAndroid) { TsPlatform.APP_VERSION_AND = text3.Trim(); this.strMobileVer = TsPlatform.APP_VERSION_AND; } else if (TsPlatform.IsIPhone) { TsPlatform.APP_VERSION_IOS = text3.Trim(); this.strMobileVer = TsPlatform.APP_VERSION_IOS; } if (TsPlatform.IsMobile && !TsPlatform.IsEditor) { string rootPath = string.Format("{0}/at2/cacheroot/", TsPlatform.Operator.GetFileDir()); Option.SetProtocolRootPath(Protocol.FILE, rootPath); } } } }
private void _OnCompleteDownload(IDownloadedItem wItem, object obj) { if (wItem.canAccessString) { try { string safeString = wItem.safeString; NDataReader nDataReader = new NDataReader(); if (!nDataReader.LoadFrom(safeString)) { TsLog.LogWarning(string.Format("NDataReader.LoadFromText failed: {0}", safeString), new object[0]); return; } SortedDictionary <string, PatchFileInfo> sortedDictionary = new SortedDictionary <string, PatchFileInfo>(); StringBuilder stringBuilder = new StringBuilder(512); StringBuilder stringBuilder2 = new StringBuilder(512); StringBuilder stringBuilder3 = new StringBuilder(512); if (nDataReader.BeginSection("[FinalList2]")) { while (!nDataReader.IsEndOfSection()) { NDataReader.Row currentRow = nDataReader.GetCurrentRow(); if (currentRow.LineType == NDataReader.Row.TYPE.LINE_DATA) { stringBuilder.Length = 0; stringBuilder.Append(currentRow.GetColumn(0)); stringBuilder = PatchFinalList.ReplaceWord(stringBuilder, false); if (stringBuilder[0] == '?') { stringBuilder.Remove(0, 1); stringBuilder3.Length = 0; stringBuilder3.Append(stringBuilder.ToString()); } else { PatchFileInfo patchFileInfo = new PatchFileInfo(currentRow); stringBuilder2.Length = 0; stringBuilder2.AppendFormat("{0}/{1}", stringBuilder3, stringBuilder); stringBuilder2 = stringBuilder2.Replace("//", "/"); string text = stringBuilder2.ToString(); if (!text.Contains("duplicationfilelist")) { if (sortedDictionary.ContainsKey(text)) { PatchFileInfo patchFileInfo2 = new PatchFileInfo(); sortedDictionary.TryGetValue(text, out patchFileInfo2); TsLog.Log(string.Format("Warning - duplicated patch list item : {0} / already:{1} new:{2}", text, patchFileInfo2.nVersion, patchFileInfo.nVersion), new object[0]); if (patchFileInfo2.nVersion < patchFileInfo.nVersion) { sortedDictionary[text] = patchFileInfo; } } else { sortedDictionary.Add(text, patchFileInfo); } } } } nDataReader.NextLine(); } } NrTSingleton <AssetBundleURLInfo> .Instance.CollectBundleInfo(sortedDictionary.Keys); } catch (Exception arg) { TsLog.LogWarning(string.Format("The process failed: {0}", arg), new object[0]); } } NrTSingleton <AssetBundleURLInfo> .Instance.IsLoad = true; UnityEngine.Object.Destroy(base.gameObject); }
public bool LoadServerList(string url, ref string errorMessage) { bool result; try { IL_00: this.m_serverListSelectIndex = 0; this.m_serverList.Clear(); if (!url.StartsWith("http")) { url = string.Format("http://{0}", url); } HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url); httpWebRequest.Timeout = 5000; HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); Stream responseStream = httpWebResponse.GetResponseStream(); NDataReader nDataReader = new NDataReader(); if (nDataReader.LoadFrom(responseStream, Encoding.UTF8)) { NDataSection nDataSection = nDataReader["list"]; int dataCount = nDataSection.DataCount; int[] array = new int[dataCount]; for (int i = 0; i < dataCount; i++) { array[i] = 0; } Random random = new Random(DateTime.Now.Millisecond); foreach (NDataReader.Row row in nDataSection) { ParallelServer.ServerInfo item = default(ParallelServer.ServerInfo); item.serverIP = row.GetColumn(0); item.serverPORT = Convert.ToInt32(row.GetColumn(1)); int num; do { num = random.Next(dataCount); }while (array[num] != 0); item.index = num; array[num] = 1; this.m_serverList.Add(item); } this.m_serverList.Sort((ParallelServer.ServerInfo a1, ParallelServer.ServerInfo a2) => a1.index.CompareTo(a2.index)); result = true; } else { result = false; } } catch (Exception ex) { if (this.m_retryCount++ < this.m_retryCountMax) { goto IL_00; } errorMessage = ex.Message; result = false; } return(result); }
internal NDataSection(NDataReader owner, string sectionName) { this._owner = owner; this.FindSection(sectionName); }
private bool ReadFinalList2(ref NDataReader dr) { this._OutputDebug(string.Format("$$$SysConfig:ReadFinalPatchList2! TsCaching.useCustomCacheOnly = {0}", TsCaching.useCustomCacheOnly)); this.m_LoadPatchListVersion = 0; string text = string.Empty; text = dr["[Header]"]["PatchVersion"]; if (text.ToLower().Equals("final")) { this.m_LoadPatchListVersion = PatchFileInfo.VER_FINAL; } else { int.TryParse(text, out this.m_LoadPatchListVersion); } this._OutputDebug("test 3 m_LoadPatchListVersion = " + this.m_LoadPatchListVersion.ToString()); TsPlatform.FileLog("test 3 m_LoadPatchListVersion = " + this.m_LoadPatchListVersion.ToString()); bool result; try { StringBuilder stringBuilder = new StringBuilder(512); StringBuilder stringBuilder2 = new StringBuilder(512); StringBuilder stringBuilder3 = new StringBuilder(512); if (dr.BeginSection("[FinalList2]")) { while (!dr.IsEndOfSection()) { NDataReader.Row currentRow = dr.GetCurrentRow(); if (currentRow.LineType == NDataReader.Row.TYPE.LINE_DATA) { stringBuilder.Length = 0; stringBuilder.Append(currentRow.GetColumn(0)); stringBuilder = PatchFinalList.ReplaceWord(stringBuilder, false); if (stringBuilder[0] == '?') { stringBuilder.Remove(0, 1); stringBuilder3.Length = 0; stringBuilder3.Append(stringBuilder.ToString()); } else { PatchFileInfo patchFileInfo = new PatchFileInfo(currentRow); stringBuilder2.Length = 0; stringBuilder2.AppendFormat("{0}/{1}", stringBuilder3, stringBuilder); stringBuilder2 = stringBuilder2.Replace("//", "/"); string text2 = stringBuilder2.ToString(); patchFileInfo.bUseCustomCache = this.CheckCustomCache(text2); patchFileInfo.szMD5 = currentRow.GetColumn(4); if (!text2.Contains("duplicationfilelist")) { 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.nVersion, patchFileInfo.nVersion)); if (patchFileInfo2.nVersion < patchFileInfo.nVersion) { this.FilesList[text2] = patchFileInfo; } } else { this.FilesList.Add(text2, patchFileInfo); } } } } dr.NextLine(); } result = true; } else { result = false; } } catch (Exception ex) { this._OutputDebug(ex.ToString()); result = false; } return(result); }