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); }
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> 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; }
public static async void Initialize() { Log("Initialize"); if (!Directory.Exists(DataPath)) { Directory.CreateDirectory(DataPath); } DataDragon.Locale = Locale; if (!DataDragon.IsCurrent) { DataDragon.Update(); } RiotAPI.UrlFormat = "https://na.api.pvp.net{0}&api_key=25434b55-24de-40eb-8632-f88cc02fea25"; Installed = await RiotVersion.GetInstalledVersion(Region, RiotGamesDir); Latest = await RiotVersion.GetLatestVersion(Region); var theme = Latest.GetFiles("/files/theme.properties").Single(); var content = await WebClient.DownloadStringTaskAsync(theme.Url); LoginTheme = content.Substring("themeConfig=", ","); if (!File.Exists(FFMpegPath)) { using (var ffmpeg = new FileStream(FFMpegPath, FileMode.Create)) ffmpeg.Write(Properties.Resources.ffmpeg, 0, Properties.Resources.ffmpeg.Length); } Log(DataDragon.CurrentVersion); Log($"Air: {Installed.AirVersion} / {Latest.AirVersion}"); Log($"Game: {Installed.GameVersion} / {Latest.GameVersion}"); Log($"Solution: {Installed.SolutionVersion} / {Latest.SolutionVersion}"); new Thread(CreateLoginTheme).Start(); }