public static async Task<RiotVersion> GetLatestVersion(Region region) { var airList = await Session.WebClient.DownloadStringTaskAsync(region.AirListing); var gameList = await Session.WebClient.DownloadStringTaskAsync(region.GameListing); var solutionList = await Session.WebClient.DownloadStringTaskAsync(region.SolutionListing); Version airVersion, gameVersion, solutionVersion; Version.TryParse(airList.Split('\n').FirstOrDefault(), out airVersion); Version.TryParse(gameList.Split('\n').FirstOrDefault(), out gameVersion); Version.TryParse(solutionList.Split('\n').FirstOrDefault(), out solutionVersion); var v = new RiotVersion(airVersion, gameVersion, solutionVersion, region); await v.GetManifest(); return v; }
public static async Task<RiotVersion> GetInstalledVersion(Region region, string LeagueDir) { var airInstalled = Directory.EnumerateDirectories(Path.Combine(LeagueDir, AirPath)); var airVersions = from dir in airInstalled select Version.Parse(Path.GetFileName(dir)) into v orderby v descending select v; var gameInstalled = Directory.EnumerateDirectories(Path.Combine(LeagueDir, GamePath)); var gameVersions = from dir in gameInstalled select Version.Parse(Path.GetFileName(dir)) into v orderby v descending select v; var slnInstalled = Directory.EnumerateDirectories(Path.Combine(LeagueDir, SolutionPath)); var slnVersions = from dir in slnInstalled select Version.Parse(Path.GetFileName(dir)) into v orderby v descending select v; var ver = new RiotVersion(airVersions.FirstOrDefault(), gameVersions.FirstOrDefault(), slnVersions.FirstOrDefault(), region); await ver.GetManifest(); return ver; }
private RiotVersion(Version air, Version game, Version solution, Region region) { AirVersion = air; GameVersion = game; SolutionVersion = solution; Region = region; }