Example #1
0
 public PSO2UpdateManager()
 {
     this._LastKnownLatestVersion = string.Empty;
     this._isbusy     = false;
     this.syncContext = System.Threading.SynchronizationContext.Current;
     this.myWebClient = WebClientPool.GetWebClient_PSO2Download(true);
     this.myFileList  = new MemoryFileCollection();
     this.bWorker     = new BackgroundWorker();
     this.bWorker.WorkerReportsProgress      = true;
     this.bWorker.WorkerSupportsCancellation = true;
     this.bWorker.DoWork             += BWorker_DoWork;
     this.bWorker.RunWorkerCompleted += BWorker_RunWorkerCompleted;
 }
Example #2
0
        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));
        }