public HeroDataConverter()
		{
			heroesName = new List<string>();
			heroesUrl = new List<string>();
			skillImages = new List<string>();
			skillNames = new List<string>();
			skillDescriptions = new List<string>();
			skillRemainingValuesDescriptions = new List<string>();
			primaryStatsImages = new List<string>();
			primaryStatsValues = new Dictionary<string, string>();
			manaCostDictionary = new List<KeyValuePair<string, string>>();
			coolDownList = new List<KeyValuePair<string, string>>();
			abilityCastType = new List<KeyValuePair<string, string>>();
			skillTargetAffectedType = new List<KeyValuePair<string, string>>();
			skillDamageType = new List<KeyValuePair<string, string>>();
			skillRemainingValues = new Dictionary<Skill, Dictionary<string, string>>();
			heroCreator = new HeroCreator();
			skillCreator = new SkillCreator();
			agilityPackHelper = new AgilityPackHelper();

			heroesName = GetHeroesName();

			foreach (var heroName in heroesName)
			{
				currentHero = heroCreator.getHeroByName(heroName);
				if (!isInsert)
					getDataFromHtml(heroName);

				createSkillEffectName(heroName);
				//heroCreator.createHero(heroName, biography);
				createSkill();
				//createPrimaryAttributes();
			}
		}
        public Hero createHero(string name, List<string> primaryStats, string biography)
        {
            this.hero = new Hero();

            this.hero.Name = name;
            this.hero.Biography = biography;

            using (Dota2Entities ctx = new Dota2Entities())
            {
                try
                { 
                    ctx.Hero.Add(this.hero);

                    ctx.SaveChanges();
                }
                catch(Exception e)
                {
                    //TODO Adicionar ao log
                    throw e.Message;
                }


            return this.hero;
        }
        
    }
        public Hero createHero(string heroName, string biography)
        {
            this.hero = new Hero();

            this.hero.Name = heroName;
            this.hero.Biography = biography;

            using (Dota2Entities ctx = new Dota2Entities())
            {
                try
                {
                    ctx.Hero.Add(this.hero);

                    ctx.SaveChanges();
                    Console.WriteLine("*************************** " + heroName + " Created(Hero)" + "***************************");
                }
                catch (Exception e)
                {
                    //TODO Adicionar ao log
                    throw e;
                }
            }

            return this.hero;
        }
예제 #4
0
        public Hero getHeroByName(string heroName)
        {
            Hero hero = new Hero();
            using (Dota2Entities ctx = new Dota2Entities())
            {
                hero = ctx.Hero.Where(h => h.Name == heroName).FirstOrDefault();
            }

            return hero;
        }
        public HeroCreator(string name, List<string> primaryStats, string biography)
        {
            this.hero = new Hero();
            this.attributesCreator = new AttributesCreator()

            this.hero.Name = name;
            


            
        }
        public HeroCreator(string name, List<string> primaryStats, string biography)
        {
            this.hero = new Hero();
            

            this.hero.Name = name;
            this.hero.Biography = biography;
            this.hero.Skill =

            this.attributesCreator = new AttributesCreator(1, primaryStats);

            
        }
		public HeroDataConverter()
		{
			heroesNames = new List<string>();
			heroesUrl = new List<string>();
            heroPortraits = new List<string>();
			skillImages = new List<string>();
			skillNames = new List<string>();
			skillDescriptions = new List<string>();
			skillRemainingValuesDescriptions = new List<string>();
			primaryStatsImages = new List<string>();
			primaryStatsValues = new Dictionary<string, string>();
			manaCostDictionary = new List<KeyValuePair<string, string>>();
			coolDownList = new List<KeyValuePair<string, string>>();
			abilityCastType = new List<KeyValuePair<string, string>>();
			skillTargetAffectedType = new List<KeyValuePair<string, string>>();
			skillDamageType = new List<KeyValuePair<string, string>>();
			skillRemainingValues = new Dictionary<Skill, Dictionary<string, string>>();
			heroCreator = new HeroCreator();
			skillCreator = new SkillCreator();
			agilityPackHelper = new AgilityPackHelper();

			heroesNames = GetHeroesName();

            for (int i = 0; i < heroesNames.Count; i++)
            {
                if (!isInsert)
                    currentHero = heroCreator.getHeroByName(heroesNames[i]);
                else
                    heroCreator.createHero(heroesNames[i], biography);



                getDataFromHtml(heroesNames[i]);
                //TODO When add more than one image, fix this 
                createHeroPortrait(heroPortraits[0]);

                //createSkillEffectName(heroesNames[i]);

                //createSkill();
                //createPrimaryAttributes();
            }
		}
        public HeroCreator()
        {
            hero = new Hero();

            
        }