public ModernMCP(string mc_version, string series, string tsrg_file, string[] csv_zips)
    {
        ClientVersion = mc_version;
        Series        = series;

        using (var reader = File.OpenText(tsrg_file))
            MappingsIO.ParseTsrg(LocalMappings.Client, reader);
        using (var reader = File.OpenText(tsrg_file))
            MappingsIO.ParseTsrg(LocalMappings.Server, reader);
        foreach (var csv in csv_zips)
        {
            using var zip = ZipFile.OpenRead(csv);
            StreamReader?read(string path)
            {
                var entry = zip.GetEntry(path);

                if (entry == null)
                {
                    return(null);
                }
                return(new(entry.Open()));
            }

            ParseCSVs(
                classes: read("classes.csv"),
                methods: read("methods.csv"),
                fields: read("fields.csv")
                );
        }
    }
示例#2
0
    private Sided <Mappings> ParseTsrgs(string version)
    {
        var sided = new Sided <Mappings>();

        using var client_file = File.OpenText(Path.Combine(Folder, version, "client.tsrg"));
        using var server_file = File.OpenText(Path.Combine(Folder, version, "server.tsrg"));
        MappingsIO.ParseTsrg(sided.Client, client_file);
        MappingsIO.ParseTsrg(sided.Server, server_file);
        return(sided);
    }