示例#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);
        }
        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;
        }
        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;
        }
        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;
 }