public static bool TryParse(string rawdatastring, Infos.PSO2VersionCheckResult baseUrl, out PSO2File _pso2file) { string[] splitbuffer = null; if (rawdatastring.IndexOf(Microsoft.VisualBasic.ControlChars.Tab) > -1) { splitbuffer = rawdatastring.Split(_tabonly, 5, StringSplitOptions.RemoveEmptyEntries); } else if (rawdatastring.IndexOf(" ") > -1) { splitbuffer = rawdatastring.Split(_spaceonly, 5, StringSplitOptions.RemoveEmptyEntries); } if (splitbuffer != null && splitbuffer.Length >= 4) { if (Leayal.StringHelper.IsEqual(splitbuffer[3], "m", true)) { _pso2file = new PSO2File(splitbuffer[0], splitbuffer[2], splitbuffer[1], baseUrl.MasterURL); } else { _pso2file = new PSO2File(splitbuffer[0], splitbuffer[2], splitbuffer[1], baseUrl.PatchURL); } return(true); } else { _pso2file = null; return(false); } }
protected virtual System.Collections.Concurrent.ConcurrentDictionary <string, PSO2File> ParseFilelist(MemoryFileCollection filelist, Infos.PSO2VersionCheckResult patchinfo) { Dictionary <string, PSO2File> result = new Dictionary <string, PSO2File>(); if (filelist != null && filelist.Count > 0) { string linebuffer; PSO2File pso2filebuffer; this.ProgressTotal = filelist.Count; this.CurrentStep = LanguageManager.GetMessageText("PSO2UpdateManager_BuildingFileList", "Building file list"); int i = 0; foreach (var _pair in filelist.GetEnumerator()) { i++; using (StreamReader sr = new StreamReader(_pair.Value)) while (!sr.EndOfStream) { linebuffer = sr.ReadLine(); if (!string.IsNullOrWhiteSpace(linebuffer)) { if (_pair.Key == DefaultValues.PatchInfo.called_masterlist) { if (PSO2File.TryParse(linebuffer, patchinfo.MasterURL, out pso2filebuffer)) { if (!result.ContainsKey(pso2filebuffer.WindowFilename)) { result.Add(pso2filebuffer.WindowFilename, pso2filebuffer); } } } else { if (PSO2File.TryParse(linebuffer, patchinfo, out pso2filebuffer)) { if (!result.ContainsKey(pso2filebuffer.WindowFilename)) { result.Add(pso2filebuffer.WindowFilename, pso2filebuffer); } else { if (_pair.Key == DefaultValues.PatchInfo.file_patch) { result[pso2filebuffer.WindowFilename] = pso2filebuffer; } } } } } } this.ProgressCurrent = i; } } return(new System.Collections.Concurrent.ConcurrentDictionary <string, PSO2File>(result)); }
public static bool TryParse(string rawdatastring, string baseUrl, out PSO2File _pso2file) { string[] splitbuffer = null; if (rawdatastring.IndexOf(Microsoft.VisualBasic.ControlChars.Tab) > -1) { splitbuffer = rawdatastring.Split(_tabonly, 5, StringSplitOptions.RemoveEmptyEntries); } else if (rawdatastring.IndexOf(" ") > -1) { splitbuffer = rawdatastring.Split(_spaceonly, 5, StringSplitOptions.RemoveEmptyEntries); } if (splitbuffer != null && splitbuffer.Length >= 4) { _pso2file = new PSO2File(splitbuffer[0], splitbuffer[2], splitbuffer[1], baseUrl); return(true); } else { _pso2file = null; return(false); } }