Esempio n. 1
0
 /// <summary>
 ///     Get all loaded mod's metadata
 /// </summary>
 /// <returns>An <see cref="IEnumerable{T}"/> of <see cref="ModInfo"/> for all loaded mods</returns>
 public static IEnumerable <ModInfo> GetMods(bool includingJotunn = false) =>
 BepInExUtils.GetDependentPlugins(includingJotunn)
 .Values
 .Select(mod => new ModInfo
 {
     GUID    = mod.Info.Metadata.GUID,
     Name    = mod.Info.Metadata.Name,
     Version = mod.Info.Metadata.Version
 });
Esempio n. 2
0
 /// <summary>
 ///     Get module.
 /// </summary>
 /// <returns></returns>
 internal static IEnumerable <Tuple <string, System.Version, CompatibilityLevel, VersionStrictness> > GetEnforcableMods()
 {
     foreach (var plugin in BepInExUtils.GetDependentPlugins(true).OrderBy(x => x.Key))
     {
         var networkCompatibilityAttribute = plugin.Value.GetType().GetCustomAttributes(typeof(NetworkCompatibilityAttribute), true).Cast <NetworkCompatibilityAttribute>()
                                             .FirstOrDefault();
         if (networkCompatibilityAttribute != null)
         {
             yield return(new Tuple <string, System.Version, CompatibilityLevel, VersionStrictness>(plugin.Value.Info.Metadata.Name,
                                                                                                    plugin.Value.Info.Metadata.Version, networkCompatibilityAttribute.EnforceModOnClients, networkCompatibilityAttribute.EnforceSameVersion));
         }
     }
 }