LavaGang / MelonLoader

The World's First Universal Mod Loader for Unity Games compatible with both Il2Cpp and Mono
https://discord.gg/2Wn3N2P
Apache License 2.0
2.25k stars 461 forks source link

[RFC] MelonInfo constructor with `(int, int, int)` versioning #150

Open xKiraiChan opened 2 years ago

xKiraiChan commented 2 years ago

MelonLoader's preferred versioning system is SemVer, which commonly uses 3 integers delimited by periods. Some creators have accidentally put a v into their version number not expecting ML to add one. Using an integer tuple would prevent this.

Since this would be an override, it shouldn't break old mods using the old constructor.

Additionally, this would allow in the future for MelonLoader to check if a dependency's version meets the minimum that a mod requires.

Example:

[assembly: MelonInfo(typeof(...), "Name", "1.2.3", "Author", "Link")] could be converted to [assembly: MelonInfo(typeof(...), "Name", (1, 2, 3), "Author", "Link")]

slxdy commented 2 years ago

version.Replace("v", string.Empty) problem solved

xKiraiChan commented 2 years ago

and then you have to deal with V, version, Version, ...

Why suggest a bandage fix over a better design?

xKiraiChan commented 2 years ago

Additionally, MelonLoader does not support a null version (but used to), but strings are able to be empty or \x1b[1D If versioning is going to be enforced it would be easier using integral types

Slaynash commented 2 years ago

This could be a thing. Maybe not implemented this way and not replacing the string function (since we can have semvers like 1.2.3-testing2), but I like the idea

loukylor commented 2 years ago

Why not (int, int, int) or (int, int, int, string), then the string just gets appended to the end when it is written to console or printed?

Ex:[assembly: MelonInfo(typeof(...), "Name", (1, 2, 3, "-beta"), "Author", "Link")] which would print version as 1.2.3-beta. The string parameter could be called comment, branch, or something along those lines.

Edit: It may also be helpful to add a method into MelonUtils that converts SemVer strings into the int/string representation of it.

HerpDerpinstine commented 1 year ago

This is now added in the latest alpha-development nightly build.

HerpDerpinstine commented 1 year ago

Moving this back to v0.6.0 as the recent attempt for v0.5.7 caused Melon compilation issues.