Пример #1
0
        public void Properties()
        {
            var host = new Host { Name = "EU", Url = "http://eu.battle.net/" };

            Assert.AreEqual("EU", host.Name);
            Assert.AreEqual("http://eu.battle.net/", host.Url);
        }
Пример #2
0
        public void ConstructorFull()
        {
            var host = new Host("EU", "http://eu.battle.net/");

            Assert.AreEqual("EU", host.Name);
            Assert.AreEqual("http://eu.battle.net/", host.Url);
        }
Пример #3
0
        public void ConstructorEmpty()
        {
            var host = new Host();

            Assert.AreEqual(String.Empty, host.Name);
            Assert.AreEqual(String.Empty, host.Url);
        }
Пример #4
0
        private static Hero FetchHero(HeroSummary heroSummary, BattleTag battleTag, Host host)
        {
            D3Api.Host = host.Url;

            Hero hero;
            try
            {
                hero = heroSummary.GetHeroFromBattleTag(battleTag);
            }
            catch (FileNotInCacheException)
            {
                MessageBox.Show("Hero was not found in cache: go online to retrieve it.");
                return null;
            }
            catch (BNetResponseFailedException)
            {
                MessageBox.Show("Battle.net sent an http error: try again later.");
                return null;
            }
            catch (BNetFailureObjectReturnedException)
            {
                MessageBox.Show("Battle.net sent an error: verify the battle tag.");
                return null;
            }

            return hero;
        }
Пример #5
0
        private static Career FetchCareer(BattleTag battleTag, Host host)
        {
            D3Api.Host = host.Url;

            Career career;
            try
            {
                career = Career.CreateFromBattleTag(battleTag);
            }
            catch (FileNotInCacheException)
            {
                MessageBox.Show("Career was not found in cache: go online to retrieve it.");
                return null;
            }
            catch (BNetResponse403Exception)
            {
                MessageBox.Show("Battle.net sent an http error: 403 - Too much requests ?");
                return null;
            }
            catch (BNetResponseFailedException)
            {
                MessageBox.Show("Battle.net sent an http error: try again later.");
                return null;
            }
            catch (BNetFailureObjectReturnedException)
            {
                MessageBox.Show("Battle.net sent an error: verify the battle tag.");
                return null;
            }

            return career;
        }
Пример #6
0
        private void ShowCareer(Career career, BattleTag battleTag, Host host)
        {
            if (career == null)
            {
                return;
            }

            guiHeroesPanel.Controls.Clear();
            foreach (var hero in career.Heroes)
            {
                var control = new D3HeroControl(hero);
                control.Click += d3HeroControl_Click;
                control.Tag = new D3HeroContainer(hero, battleTag, host);
                guiHeroesPanel.Controls.Add(control);
            }

            guiRefreshCareer.Visible = true;
        }
Пример #7
0
 public D3ProfileContainer(BattleTag battleTag, Host host)
 {
     BattleTag = battleTag;
     Host = host;
 }
Пример #8
0
 public D3HeroContainer(HeroSummary heroSummary, BattleTag battleTag, Host host)
 {
     HeroSummary = heroSummary;
     BattleTag = battleTag;
     Host = host;
 }
Пример #9
0
 public BNetProfileControl(BattleTag battleTag, Host host)
     : this()
 {
     BattleTag = battleTag;
     Host = host;
 }