public Task <MinecraftVersion> GetLatestVersionForPlatformAsync(MinecraftPlatform minecraftPlatform) { switch (minecraftPlatform) { case MinecraftPlatform.Pc: return(Task.FromResult(new MinecraftVersion("1.11.2"))); case MinecraftPlatform.PocketEdition: return(Task.FromResult(new MinecraftVersion("1.0"))); default: throw new ArgumentOutOfRangeException(nameof(minecraftPlatform), minecraftPlatform, null); } }
/// <inheritdoc /> public async Task <VersionDefinition> GetDefinitionForVersionAsnyc(MinecraftPlatform minecraftPlatform, MinecraftVersion version) { // Read in information from the paths file. // Load version definition var dataPaths = await ReadDataPaths(); var versions = dataPaths.GetVersionsForPlatform(minecraftPlatform); VersionFiles files; if (!versions.TryGetValue(version, out files)) { // TODO: What should we do here? throw new ArgumentException("Given version does not exist"); } var versionDefinition = VersionDefinitionBuilder.Build(_dataPath, files); return(versionDefinition); }
public static IDictionary <MinecraftVersion, VersionFiles> GetVersionsForPlatform(this DataPaths dataPaths, MinecraftPlatform platform) { if (dataPaths == null) { throw new ArgumentNullException(nameof(dataPaths)); } switch (platform) { case MinecraftPlatform.Pc: return(dataPaths.PcVersions); case MinecraftPlatform.PocketEdition: return(dataPaths.PocketVersions); default: throw new ArgumentOutOfRangeException(nameof(platform), platform, null); } }
public async Task <IEnumerable <MinecraftVersion> > GetVersionsForPlatformAsync(MinecraftPlatform minecraftPlatform) { var dataPaths = await ReadDataPaths(); var versions = dataPaths.GetVersionsForPlatform(minecraftPlatform); return(versions.Keys.ToList()); }