public static IReadOnlyList <HeroRoleModel> GetRoles(this HeroSchemaModel hero) { if (hero == null) { return(new List <HeroRoleModel>().AsReadOnly()); } if (String.IsNullOrEmpty(hero.Role) || String.IsNullOrEmpty(hero.RoleLevels)) { return(new List <HeroRoleModel>()); } string[] rolesSplit = hero.Role.Split(','); string[] roleLevelsSplit = hero.RoleLevels.Split(','); List <HeroRoleModel> roleViewModels = new List <HeroRoleModel>(); for (int i = 0; i < rolesSplit.Length; i++) { roleViewModels.Add(new HeroRoleModel() { Name = rolesSplit[i], Level = roleLevelsSplit[i] }); } return(roleViewModels.AsReadOnly()); }
public static string GetAvatarImageFilePath(this HeroSchemaModel hero) { if (hero == null) { return(String.Empty); } string fileName = GetHeroAvatarFileName(hero.Name); if (String.IsNullOrEmpty(fileName)) { return(String.Empty); } return(String.Format("{0}{1}_full.png", heroAvatarsBaseUrl, fileName)); }
public static string GetMinimapIconFilePath(this HeroSchemaModel hero) { if (hero == null) { return(String.Empty); } string fileName = !String.IsNullOrEmpty(hero.Url) ? String.Format("{0}_icon.png", hero.Url) : String.Empty; if (String.IsNullOrEmpty(fileName)) { return(String.Empty); } return(String.Format("{0}{1}", minimapIconsBaseUrl, fileName)); }