public async Task <IActionResult> GetInstaller(SupportedOs type, bool localFile)
        {
            // local file is used so we can distribute beta launchers on the test site
            if (localFile)
            {
                switch (type)
                {
                case SupportedOs.mac: return(DownloadLauncherFor("dmg"));

                case SupportedOs.win: return(DownloadLauncherFor("exe"));

                default: return(BadRequest("Unsupported OS Version"));
                }
            }

            var latestRelease = await LauncherReleaseResponse.GetCachedData();

            if (latestRelease == null)
            {
                return(BadRequest("There was a problem getting data from github"));
            }

            string fileExtension;

            switch (type)
            {
            case SupportedOs.mac: {
                fileExtension = "dmg";
                break;
            }

            case SupportedOs.win:
            {
                fileExtension = "exe";
                break;
            }

            default:
                return(BadRequest("Unsupported OS Version"));
            }

            var url = GetLinkToReleaseAssetByFileExtension(latestRelease, fileExtension);

            return(Redirect(url));
        }
        public Player GetPlayerAkaData(string battleTag) // string should be received all lower-case.
        {
            var akas = PlayersAkaCache.GetCachedData();
            var aka  = akas.Find(x => x.aka == battleTag);

            if (aka != null)
            {
                return(aka.player);
            }
            return(new Player()); // returns an default values if they are not in the database
        }
Exemplo n.º 3
0
 public List <PersonalSettings.PersonalSetting> getPersonalSettings()
 {
     try
     {
         return(personalSettingsCache.GetCachedData());
     }
     catch
     {
         return(new List <PersonalSettings.PersonalSetting>());
     }
 }