Exemple #1
0
        public static void InitiateHeroesDB()
        {
            RestService rest   = RestService.Instance;
            List <Hero> heroes = rest.GetHeroes();
            string      dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "HeroesSQLite.db3");

            using (SQLiteConnection db = new SQLiteConnection(dbPath))
            {
                db.CreateTable <HeroesDB>();
                if (db.Table <HeroesDB>().Count() == 0)
                {
                    // only insert the data if it doesn't already exist
                    foreach (Hero hero in heroes)
                    {
                        var newHero = new HeroesDB
                        {
                            ID             = hero.id,
                            Name           = hero.name,
                            Localized_name = hero.localized_name,
                            Primary_attr   = hero.primary_attr,
                            Attack_type    = hero.attack_type,
                            Roles          = ""
                        };
                        foreach (string role in hero.roles)
                        {
                            newHero.Roles += role + " ";
                        }
                        newHero.Legs = hero.legs;
                        string[] splittedname = hero.name.Split(new String[] { "o_" }, StringSplitOptions.RemoveEmptyEntries);
                        newHero.Resource = "DM.Resources.Heroes.app_assets_heroes_" + splittedname[splittedname.Length - 1] + "_full.png";
                        db.Insert(newHero);
                    }
                }
            }
        }
 public MostPlayedHeroToDisplay(MostPlayedHero mpHero, HeroesDB hero)
 {
     this.mpHero = mpHero;
     this.hero   = hero;
 }
Exemple #3
0
 public RecentMatchToDisplay(MatchCropped match, HeroesDB hero)
 {
     this.match = match;
     this.hero  = hero;
 }