/*********
        ** Private methods
        *********/
        /// <summary>Register a token.</summary>
        /// <param name="mod">The manifest of the mod defining the token.</param>
        /// <param name="valueProvider">The token value provider.</param>
        private void RegisterValueProvider(IManifest mod, IValueProvider valueProvider)
        {
            // validate token + mod
            if (valueProvider == null)
            {
                this.Monitor.Log($"Rejected token added by {mod.Name} because the token is null.", LogLevel.Error);
                return;
            }
            if (!mod.HasDependency(this.ContentPatcherID))
            {
                this.Monitor.Log($"Rejected token added by {mod.Name} because that mod doesn't list Content Patcher as a dependency.", LogLevel.Error);
                return;
            }

            // validate name format
            string name = valueProvider.Name?.Trim();

            if (string.IsNullOrWhiteSpace(name))
            {
                this.Monitor.Log($"Rejected token added by {mod.Name} because the token has no name.", LogLevel.Error);
                return;
            }
            if (!this.ValidNameFormat.IsMatch(name))
            {
                this.Monitor.Log($"Rejected token added by {mod.Name} because the token name is invalid (it can only contain alphabetical characters).", LogLevel.Error);
                return;
            }

            // format name
            ModProvidedToken token = new ModProvidedToken(name, mod, valueProvider, this.Monitor);

            // add token
            this.AddModToken(token);
        }
 /// <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)
 {
     return(manifest.HasDependency(modID, out _, canBeOptional));
 }