-
Notifications
You must be signed in to change notification settings - Fork 41
VersionLoader
Get version metadata list.
All VersionLoader should inherit IVersionLoader
.
There are 3 version loaders, and you can make your own version loader.
VersionLoader return version metadata list as MVersionCollection
type.
LocalVersionLoader
: Get version metadata list from MinecraftPath.Versions
directory.
MojangVersionLoader
: Get version metadata list from mojang metadata server.
DefaultVersionLoader
: Get version metadatas using LocalVersionLoader
and MojangVersionLoader
, and merge two lists.
var launcher = new CMLauncher(new MinecraftPath());
// CMLauncher class create DefaultVersionLoader instance automatically
// MVersionCollection versions = launcher.VersionLoader.GetVersionMetadatasAsync();
MVersionCollection versions = await launcher.GetAllVersionsAsync(); // shortcut
// show all versions
foreach (MVersionMetadata ver in versions)
{
Console.WriteLine(ver.Type + " : " ver.Name);
}
// Get latest release version name:
Console.WriteLine(versions.LatestReleaseVersion.Name);
// Get latest snapshot version name:
Console.WriteLine(versions.LatestSnapshotVersion.Name);
// Get MVersion
MVersion realVersion = versions.GetVersion("1.15.2");
Get version metadata list.
Get version metadata list.
Get version metadata list from MinecraftPath.Versions
directory.
Inherit IVersionLoader
.
Set path to load versions.
Get version metadata list from mojang version metadata server.
Inherit IVersionLoader
.
Get version metadata list using LocalVersionLoader
and MojangVersionLoader
, and merge two lists.
Set path to load local versions.
Manage MVersionMetadata lists.
Type: MVersionMetadata
Type: MVersionMetadata
Find MVersionMetadata named name
, parse that version metadata to MVersion
, and return it.
Find versionMetadata
, parse that version metadata to MVersion
, and return it.
Merge two version collections.
Remove duplications, change LatestReleaseVersion
, LatestSnapshotVersion
properties.