public void OnDeserialized(StreamingContext context) { if (Dependencies == null) { Dependencies = new IManifestDependency[0]; } if (UpdateKeys == null) { UpdateKeys = new string[0]; } }
/// <summary>Get whether the manifest lists a given mod ID as a dependency.</summary> /// <param name="manifest">The manifest.</param> /// <param name="modID">The mod ID.</param> /// <param name="canBeOptional">Whether the dependency can be optional.</param> public static bool HasDependency(this IManifest manifest, string modID, bool canBeOptional = true) { if (manifest == null) { return(false); } // check content pack for if (manifest.ContentPackFor?.UniqueID?.EqualsIgnoreCase(modID) == true) { return(true); } // check dependencies IManifestDependency dependency = manifest.Dependencies?.FirstOrDefault(p => p.UniqueID.EqualsIgnoreCase(modID)); return (dependency != null && (canBeOptional || dependency.IsRequired)); }