private async void LoadBios() { string currentBios = this.pcsx2_ui.Read("Filenames", "BIOS").Unescape(); List <Bios> bios = new List <Bios>(); await Task.Run(delegate { foreach (string str in Directory.GetFiles(Settings.Default.pcsx2DataDir + @"\bios")) { using (StreamReader reader = new StreamReader(str)) { string str2; while ((str2 = reader.ReadLine()) != null) { if (str2.Contains("ROMconf")) { byte[] bytes = (from i in Encoding.UTF8.GetBytes(str2) where i != 0 select i).ToArray <byte>(); string src = Encoding.UTF8.GetString(bytes); string str4 = src.Between("OSDSYS", "@rom"); if (str4.IsEmpty()) { str4 = src.Between("OSDSYS", "@"); } Bios item = new Bios { DisplayInfo = this.GetValue(str4), Tag = str, Location = str }; bios.Add(item); } } } } }); bios.ForEach(b => this.lbBios.Items.Add(b)); IEnumerator enumerator = ((IEnumerable)this.lbBios.Items).GetEnumerator(); try { while (enumerator.MoveNext()) { object current = enumerator.Current; Bios bios = (Bios)current; if (bios.Tag.ToString() == currentBios) { this.lbBios.SelectedItem = bios; return; } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } }
private async void LoadBios() { string currentBios = this.pcsx2_ui.Read("Filenames", "BIOS").Unescape(); List<Bios> bios = new List<Bios>(); await Task.Run(delegate { foreach (string str in Directory.GetFiles(Settings.Default.pcsx2DataDir + @"\bios")) { using (StreamReader reader = new StreamReader(str)) { string str2; while ((str2 = reader.ReadLine()) != null) { if (str2.Contains("ROMconf")) { byte[] bytes = (from i in Encoding.UTF8.GetBytes(str2) where i != 0 select i).ToArray<byte>(); string src = Encoding.UTF8.GetString(bytes); string str4 = src.Between("OSDSYS", "@rom"); if (str4.IsEmpty()) { str4 = src.Between("OSDSYS", "@"); } Bios item = new Bios { DisplayInfo = this.GetValue(str4), Tag = str, Location = str }; bios.Add(item); } } } } }); bios.ForEach(b => this.lbBios.Items.Add(b)); IEnumerator enumerator = ((IEnumerable) this.lbBios.Items).GetEnumerator(); try { while (enumerator.MoveNext()) { object current = enumerator.Current; Bios bios = (Bios) current; if (bios.Tag.ToString() == currentBios) { this.lbBios.SelectedItem = bios; return; } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } }