public static IEnumerable <Conference> FillLeague() { using (var stream = SmBiosExtractor.OpenRead()) { using (var reader = new SmBiosReader(stream, stream.Version)) { Bios = reader.ReadBios(); } } PropertyInfo[] properties = typeof(BiosData).GetProperties(); foreach (PropertyInfo property in properties) { var attribute = property.GetCustomAttributes(typeof(DisplayNameAttribute), true) .Cast <DisplayNameAttribute>().Single(); string displayName = attribute.DisplayName; var p = new Conference(); p.ConferenceName = displayName; IList list = (IList)property.GetValue(Bios); foreach (Table z in list) { var team = new Team(); team.Table = z; team.TeamName = z.Name; p.Teams.Add(team); } yield return(p); } }
/// <summary>Parse whole SM-Bios into SmBios.Data.BiosData structure</summary> /// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the bios.</exception> public virtual BiosData ReadBios() { var result = new BiosData(); while (BaseStream.Position < BaseStream.Length) { var header = ReadHeader(); switch (header.Type) { case Const.DMI_TYPE_END: return(result); case Const.DMI_TYPE_BIOS: if (!Flags.HasFlag(TableFlags.Bios)) { break; } var readerBios = new ReaderBios <TableBios>(this, header); var tableBios = readerBios.Result; if (result.Bios == null) { result.Bios = new List <TableBios>(); } result.Bios.Add(tableBios); break; case Const.DMI_TYPE_BASEBOARD: if (!Flags.HasFlag(TableFlags.BaseBoard)) { break; } var readerBaseboard = new ReaderBaseboard <TableBaseboard>(this, header); var tableBaseboard = readerBaseboard.Result; if (result.BaseBoard == null) { result.BaseBoard = new List <TableBaseboard>(); } result.BaseBoard.Add(tableBaseboard); break; case Const.DMI_TYPE_MEMORY: if (!Flags.HasFlag(TableFlags.MemoryDevice)) { break; } var readerMemory = new ReaderMemory <TableMemoryDevice>(this, header); var tableMemory = readerMemory.Result; if (result.Memory == null) { result.Memory = new List <TableMemoryDevice>(); } result.Memory.Add(tableMemory); break; case Const.DMI_TYPE_PHYSMEM: if (!Flags.HasFlag(TableFlags.PhysMemory)) { break; } var readerPhysicalMemory = new ReaderPhysicalMemory <TablePhysicalMemory>(this, header); var tablePhysicalMemory = readerPhysicalMemory.Result; if (result.PhyMemory == null) { result.PhyMemory = new List <TablePhysicalMemory>(); } result.PhyMemory.Add(tablePhysicalMemory); break; case Const.DMI_TYPE_PROCESSOR: if (!Flags.HasFlag(TableFlags.Processor)) { break; } var readerProcessor = new ReaderProcessor <TableProcessor>(this, header); var tableProcessor = readerProcessor.Result; if (result.Processor == null) { result.Processor = new List <TableProcessor>(); } result.Processor.Add(tableProcessor); break; } BaseStream.Seek(Idx, SeekOrigin.Begin); } return(result); }