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); } }
static void Main(string[] args) { var svcStorage = new StorageSvc(); var outbox = svcStorage.GetOutBox( ProgramConfig.QueueName, ProgramConfig.DefaultPriority); outbox.Init( new Config() { StorageFolder = ProgramConfig.StorageFolder, ConStr = ProgramConfig.ConStr, DbFile = ProgramConfig.DbFile }); var transportMongo = new TransportMongo.TransportMongo( ProgramConfig.TransportFolder, ProgramConfig.TransportUrl ); transportMongo.OnSent += (int itemId) => { outbox.Send(new OutItem() { Id = itemId }); Console.Write($"Sent items:{string.Join(",", outbox.Sent().Select(x => x.Id.ToString()))}\n"); }; outbox.OnAddItem += (string queue, IOutItem item) => { Console.Write($"Outgoing items:{string.Join(",", outbox.Unsent().Select(x => x.Id.ToString()))}\n"); var itemStream = outbox.Read(item); transportMongo.SendMessage(item.Id, queue, itemStream); }; var newItem = outbox.Add("-"); try { using (var msgStream = outbox.AddWrite(newItem)) { using (var biosStream = SmBiosExtractor.OpenRead()) { biosStream.CopyTo(msgStream); } } outbox.AddCommit(newItem); } catch (Exception) { outbox.AddRollback(newItem); } Console.ReadLine(); }
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(); } } }