internal static void SetAuthor(this ModdingAPI.ModInformation info, string author) { if (MelonUtils.IsGameIl2Cpp()) { if (author_method == null) { author_method = AccessTools.Property(typeof(ModdingAPI.ModInformation), "author").GetSetMethod(); } if (author_method != null) { author_method.Invoke(info, new object[] { author }); } } else { if (author_field == null) { author_field = AccessTools.Field(typeof(ModdingAPI.ModInformation), "author"); } if (author_field != null) { author_field.SetValue(info, author); } } }
internal static void SetVersion(this ModdingAPI.ModInformation info, string version) { if (MelonUtils.IsGameIl2Cpp()) { if (version_method == null) { version_method = AccessTools.Property(typeof(ModdingAPI.ModInformation), "version").GetSetMethod(); } if (version_method != null) { version_method.Invoke(info, new object[] { version }); } } else { if (version_field == null) { version_field = AccessTools.Field(typeof(ModdingAPI.ModInformation), "version"); } if (version_field != null) { version_field.SetValue(info, version); } } }
internal static string GetName(this ModdingAPI.ModInformation info) { if (MelonUtils.IsGameIl2Cpp()) { if (name_get_method == null) { name_get_method = AccessTools.Property(typeof(ModdingAPI.ModInformation), "name").GetGetMethod(); } if (name_get_method != null) { return((string)name_get_method.Invoke(info, new object[0])); } } else { if (name_field == null) { name_field = AccessTools.Field(typeof(ModdingAPI.ModInformation), "name"); } if (name_field != null) { return((string)name_field.GetValue(info)); } } return(null); }
internal static void SetName(this ModdingAPI.ModInformation info, string name) { if (MelonUtils.IsGameIl2Cpp()) { if (name_set_method == null) { name_set_method = AccessTools.Property(typeof(ModdingAPI.ModInformation), "name").GetSetMethod(); } if (name_set_method != null) { name_set_method.Invoke(info, new object[] { name }); } } else { if (name_field == null) { name_field = AccessTools.Field(typeof(ModdingAPI.ModInformation), "name"); } if (name_field != null) { name_field.SetValue(info, name); } } }
private static void ParseMelons <T>(List <T> melons) where T : MelonBase { if (melons.Count <= 0) { return; } for (int i = 0; i < melons.Count; i++) { T melon = melons[i]; if (melon == null) { continue; } ModdingAPI.ModInformation info = new ModdingAPI.ModInformation(); info.SetName(melon.Info.Name); info.SetVersion(melon.Info.Version); info.SetAuthor(melon.Info.Author); info.SetDescription(melon.Info.DownloadLink); ModInformation.Add(info); if (MelonUtils.PullAttributeFromAssembly <Demeo_LobbyRequirement>(melon.Assembly) != null) { ConnectionString += $", {melon.Info.Name} v{melon.Info.Version}"; } } ModInformation.Sort((ModdingAPI.ModInformation left, ModdingAPI.ModInformation right) => string.Compare(left.GetName(), right.GetName())); }