Ejemplo n.º 1
0
 static public Image LoadImageFromResources(TeamMatchesDataPlayer player)
 {
     if (!File.Exists(ResourcesPath + player.Name + ".png"))
     {
         return(DefaultPlayerImage);
     }
     else
     {
         return(new Bitmap(ResourcesPath + player.Name + ".png"));
     }
 }
Ejemplo n.º 2
0
 void LoadSavedFavPlayers(TeamMatchesDataPlayer player, string FifaCode)
 {
     try
     {
         if (Configuration.FavoritePlayers.ContainsKey(FifaCode))
         {
             if (Configuration.FavoritePlayers[FifaCode].Contains(player.Name))
             {
                 player.isFavorite = true;
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 3
0
 static public void AddImageToResources(TeamMatchesDataPlayer player)
 {
     if (!Directory.Exists(ResourcesPath))
     {
         Directory.CreateDirectory(ResourcesPath);
     }
     //if (File.Exists((ResourcesPath + player.Name + ".bmp")))
     //{
     using (MemoryStream memory = new MemoryStream())
     {
         using (FileStream fs = new FileStream((ResourcesPath + player.Name + ".png"), FileMode.Create, FileAccess.ReadWrite))
         {
             player.PlayerImage.Save(memory, ImageFormat.Png);
             byte[] bytes = memory.ToArray();
             fs.Write(bytes, 0, bytes.Length);
         }
     }
     //}
     //else
     //{
     //    player.PlayerImage.Save((ResourcesPath + player.Name + ".bmp"));
     //}
 }