Exemple #1
0
 public Item(int itemId)
 {
     ItemDb itemDb = new ItemDb ();
     var itm = itemDb.GetItemFromSQL (ItemId);
     this.ItemId = itm.ItemId;
     this.ID = itm.ID;
     this.Name = itm.Name;
     this.LocalName = itm.LocalName;
     this.ImageUrl = itm.ImageUrl;
 }
		public async Task<List<PlayerStatsUpdate_2>> ParseMatch(DotaMatchInfo dotaMatchInfo,CancellationToken  token)
		{
			var playersStatsUp=new List<PlayerStatsUpdate_2>();
			var ResDpi = new ResouceDpi ();
			try{
				var players=dotaMatchInfo.Players;
				for(int i=0;i<players.Count();i++)
				{
					token.ThrowIfCancellationRequested ();
					var itemDb = new ItemDb ();
					var heroDb =new HeroDb();
					var player=players[i];
					var playerStatsUp = new PlayerStatsUpdate_2 ();
					var hero  = heroDb .GetHeroFromSQL (player.Hero_id);
					playerStatsUp.HeroImage = BitmapFactory.DecodeByteArray (hero.ImageHero, 0, hero.ImageHero.Length);
					playerStatsUp.Color = ColorsOnMatch.GetColorPlayer (i);
					playerStatsUp.HeroName = hero.LocalName;
					playerStatsUp.Hero_id = (int)player.Hero_id;
					playerStatsUp.Player_slot = i;
					playerStatsUp.Account_id = (int)player.Account_id;
					playerStatsUp.PlayerName=player.PlayerName;
					var item0 = itemDb.GetItemFromSQL (player.Item0Id);
					var item1 = itemDb.GetItemFromSQL (player.Item1Id);
					var item2 = itemDb.GetItemFromSQL (player.Item2Id);
					var item3 = itemDb.GetItemFromSQL (player.Item3Id);
					var item4 = itemDb.GetItemFromSQL (player.Item4Id);
					var item5 = itemDb.GetItemFromSQL (player.Item5Id);
					playerStatsUp.Item0 = BitmapFactory.DecodeByteArray (item0.ImageByte, 0, item0.ImageByte.Length);
					playerStatsUp.Item1 = BitmapFactory.DecodeByteArray (item1.ImageByte, 0, item1.ImageByte.Length);
					playerStatsUp.Item2 = BitmapFactory.DecodeByteArray (item2.ImageByte, 0, item2.ImageByte.Length);
					playerStatsUp.Item3 = BitmapFactory.DecodeByteArray (item3.ImageByte, 0, item3.ImageByte.Length);
					playerStatsUp.Item4 = BitmapFactory.DecodeByteArray (item4.ImageByte, 0, item4.ImageByte.Length);
					playerStatsUp.Item5 = BitmapFactory.DecodeByteArray (item5.ImageByte, 0, item5.ImageByte.Length);
					playerStatsUp.Item0Id = item0.ItemId;
					playerStatsUp.Item1Id = item1.ItemId;
					playerStatsUp.Item2Id = item2.ItemId;
					playerStatsUp.Item3Id = item3.ItemId;
					playerStatsUp.Item4Id = item4.ItemId;
					playerStatsUp.Item5Id = item5.ItemId;
					playerStatsUp.Gold = player.Gold;
					playerStatsUp.Level = player.Level;
					playerStatsUp.Assists = player.Assists;
					playerStatsUp.Death = player.Death;
					playerStatsUp.Denies = player.Denies;
					playerStatsUp.Gold_per_min = player.Gold_per_min;
					playerStatsUp.Kills = player.Kills;
					playerStatsUp.Last_hits = player.Last_hits;
					playerStatsUp.Net_worth = player.Net_worth;
					playerStatsUp.Xp_per_min = player.Xp_per_min;

					playersStatsUp.Add(playerStatsUp);
				}

			}catch{
				return playersStatsUp;
			}

			return playersStatsUp;
		}