Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        static void Main()
        {
            var want = TableFlags.All;

            //want = TableFlags.BaseBoard | TableFlags.Processor;
            using (var stream = SmBiosExtractor.OpenRead())
            {
                using (var reader = new SmBiosReader(stream, stream.Version, want))
                {
                    var bios = reader.ReadBios();
                    var json = bios.ToString();
                    System.Console.WriteLine(json);
                    System.Console.ReadKey();
                }
            }
        }