Skip to content

Instantly share code, notes, and snippets.

@Aetopia
Last active April 28, 2025 21:07
Show Gist options
  • Save Aetopia/69df891d2da4151c46df06b06f288755 to your computer and use it in GitHub Desktop.
Save Aetopia/69df891d2da4151c46df06b06f288755 to your computer and use it in GitHub Desktop.
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Net.Http;
using System.Runtime.Serialization.Json;
using System.Xml;
using System;
using System.Xml.Linq;
using Windows.Data.Json;
using System.Web.Script.Serialization;
using System.IO;
static class Program
{
static readonly HttpClient Client = new();
const string Packages = "https://raw.githubusercontent.com/ddf8196/mc-w10-versiondb-auto-update/master/versions.json.min";
const string Supported = "https://raw.githubusercontent.com/flarialmc/newcdn/main/launcher/NewSupported.txt";
static async Task<HashSet<string>> SupportedAsync()
{
HashSet<string> collection = [];
using StreamReader reader = new(await Client.GetStreamAsync(Supported));
string value; while ((value = await reader.ReadLineAsync()) != default) collection.Add(value);
return collection;
}
static async Task<Dictionary<string, string>> PackagesAsync() => await Task.Run(async () =>
{
var @this = await SupportedAsync();
Dictionary<string, string> @params = [];
foreach (var item in JsonArray.Parse(await Client.GetStringAsync(Packages)))
{
var value = item.GetArray(); if (value.GetNumberAt(2) != default) continue;
var key = value.GetStringAt(default);
if ([email protected](key = key.Substring(default, key.LastIndexOf('.')))) continue;
@params.Add(key, value.GetStringAt(1));
}
return @params;
});
static async Task Main() => Console.WriteLine(new JavaScriptSerializer
{
MaxJsonLength = int.MaxValue,
RecursionLimit = int.MaxValue
}.Serialize(await PackagesAsync()));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment