/// <summary>
            ///     Loads the plugins settings from the specified XML element.
            /// </summary>
            /// <param name="element">The XML element to load from.</param>
            /// <param name="helper">The XML configuration helper being used.</param>
            internal void LoadFromXmlElement(XElement element, ConfigurationFileHelper helper)
            {
                if (element == null)
                {
                    return;
                }

                //LoadByDefault attribute.
                LoadByDefault = helper.ReadBooleanAttribute(
                    element,
                    "loadByDefault",
                    false
                    );

                //Load plugins
                helper.ReadElementCollectionTo(
                    element,
                    "plugin",
                    e =>
                {
                    PluginSettings pluginSettings = new PluginSettings();
                    pluginSettings.LoadFromXmlElement(e, helper);
                    return(pluginSettings);
                },
                    Plugins
                    );
            }
            /// <summary>
            ///     Loads the database settings from the specified XML element.
            /// </summary>
            /// <param name="element">The XML element to load from.</param>
            /// <param name="helper">The XML configuration helper being used.</param>
            internal void LoadFromXmlElement(XElement element, ConfigurationFileHelper helper)
            {
                if (element == null)
                {
                    return;
                }

                //Load databases
                helper.ReadElementCollectionTo(
                    element,
                    "database",
                    e =>
                {
                    string name = helper.ReadStringAttribute(
                        e,
                        "name"
                        );

                    string connectionString = helper.ReadStringAttribute(
                        e,
                        "connectionString"
                        );

                    return(new DatabaseConnectionData(
                               name,
                               connectionString
                               ));
                },
                    Databases
                    );
            }
            /// <summary>
            ///     Loads the logging settings from the specified XML element.
            /// </summary>
            /// <param name="element">The XML element to load from.</param>
            /// <param name="helper">The XML configuration helper being used.</param>
            internal void LoadFromXmlElement(XElement element, ConfigurationFileHelper helper)
            {
                if (element == null)
                {
                    return;
                }

                StartupLogLevels = helper.ReadLogLevelsAttributeOrDefault(
                    element,
                    "startupLevels",
                    new LogType[] { LogType.Info, LogType.Warning, LogType.Error, LogType.Fatal }
                    );

                //Load writers
                var logWritersElement = helper.GetRequiredElement(element, "logWriters");

                helper.ReadElementCollectionTo(
                    logWritersElement,
                    "logWriter",
                    e => {
                    LogWriterSettings s = new LogWriterSettings();
                    s.LoadFromXmlElement(e, helper);
                    return(s);
                },
                    LogWriters
                    );
            }
                /// <summary>
                ///     Loads the plugin settings from the specified XML element.
                /// </summary>
                /// <param name="element">The XML element to load from.</param>
                /// <param name="helper">The XML configuration helper being used.</param>
                internal void LoadFromXmlElement(XElement element, ConfigurationFileHelper helper)
                {
                    if (element == null)
                    {
                        return;
                    }

                    //Type attribute.
                    Type = helper.ReadStringAttribute(
                        element,
                        "type"
                        );

                    //Load attribute.
                    Load = helper.ReadBooleanAttribute(
                        element,
                        "load",
                        true
                        );

                    helper.ReadAttributeCollectionTo(
                        element.Element("settings"),
                        Settings
                        );
                }
                /// <summary>
                ///     Loads the path from the specified XML element.
                /// </summary>
                /// <param name="element">The XML element to load from.</param>
                /// <param name="helper">The XML configuration helper being used.</param>
                internal void LoadFromXmlElement(XElement element, ConfigurationFileHelper helper)
                {
                    if (element == null)
                    {
                        return;
                    }

                    //Read source
                    Source = helper.ReadStringAttribute(
                        element,
                        "src"
                        );

                    //Read port
                    CreateDirectory = helper.ReadBooleanAttribute(
                        element,
                        "createDir",
                        false
                        );

                    // Read dependency resolution strategy
                    DependencyResolutionStrategy = helper.ReadDependencyResolutionStrategy(
                        element,
                        "dependencyResolutionStrategy",
                        DependencyResolutionStrategy.RecursiveFromFile
                        );
                }
                /// <summary>
                ///     Loads the log writer settings from the specified XML element.
                /// </summary>
                /// <param name="element">The XML element to load from.</param>
                /// <param name="helper">The XML configuration helper being used.</param>
                internal void LoadFromXmlElement(XElement element, ConfigurationFileHelper helper)
                {
                    if (element == null)
                    {
                        return;
                    }

                    Type = helper.ReadStringAttribute(
                        element,
                        "type"
                        );

                    Name = helper.ReadStringAttribute(
                        element,
                        "name"
                        );

                    LogLevels = helper.ReadLogLevelsAttribute(
                        element,
                        "levels"
                        );

                    helper.ReadAttributeCollectionTo(
                        element.Element("settings"),
                        Settings
                        );
                }
 /// <summary>
 ///     Loads the groups settings from the specified XML element.
 /// </summary>
 /// <param name="element">The XML element to load from.</param>
 /// <param name="helper">The XML configuration helper being used.</param>
 internal void LoadFromXmlElement(XElement element, ConfigurationFileHelper helper)
 {
     Name = helper.ReadStringAttribute(
         element,
         "name"
         );
 }
            /// <summary>
            ///     Loads the server settings from the specified XML element.
            /// </summary>
            /// <param name="element">The XML element to load from.</param>
            /// <param name="helper">The XML configuration helper being used.</param>
            internal void LoadFromXmlElement(XElement element, ConfigurationFileHelper helper)
            {
                if (element == null)
                {
                    return;
                }

                //Read data directory
                Directory = helper.ReadStringAttribute(
                    element,
                    "directory"
                    );
            }
 /// <summary>
 ///     Loads the groups settings from the specified XML element.
 /// </summary>
 /// <param name="element">The XML element to load from.</param>
 /// <param name="helper">The XML configuration helper being used.</param>
 internal void LoadFromXmlElement(XElement element, ConfigurationFileHelper helper)
 {
     helper.ReadElementCollectionTo(
         element,
         "group",
         e => {
         GroupSettings s = new GroupSettings();
         s.LoadFromXmlElement(e, helper);
         return(s);
     },
         Groups
         );
 }
        /// <summary>
        ///     Creates a cluster spawn data from specified XML configuration file.
        /// </summary>
        /// <param name="document">The XML file.</param>
        /// <param name="variables">The variables to inject into the configuration.</param>
        /// <returns>The ClusterSpawnData created.</returns>
        public static ClusterSpawnData CreateFromXml(XDocument document, NameValueCollection variables)
        {
            //Create a new cluster spawn data.
            ClusterSpawnData spawnData = new ClusterSpawnData();

            ConfigurationFileHelper helper = new ConfigurationFileHelper(variables, $"{new DarkRiftInfo(DateTime.Now).DocumentationRoot}configuration/cluster/", $"{new DarkRiftInfo(DateTime.Now).DocumentationRoot}advanced/configuration_variables.html");

            XElement root = document.Root;

            spawnData.Groups.LoadFromXmlElement(root.Element("groups"), helper);

            //Return the new spawn data!
            return(spawnData);
        }
            /// <summary>
            ///     Loads the server settings from the specified XML element.
            /// </summary>
            /// <param name="element">The XML element to load from.</param>
            /// <param name="helper">The XML configuration helper being used.</param>
            internal void LoadFromXmlElement(XElement element, ConfigurationFileHelper helper)
            {
                if (element == null)
                {
                    return;
                }

                //Read search paths
                helper.ReadElementCollectionTo(
                    element,
                    "pluginSearchPath",
                    e =>
                {
                    PluginSearchPath psp = new PluginSearchPath();
                    psp.LoadFromXmlElement(e, helper);
                    return(psp);
                },
                    PluginSearchPaths
                    );
            }
                /// <summary>
                ///     Loads the groups settings from the specified XML element.
                /// </summary>
                /// <param name="element">The XML element to load from.</param>
                /// <param name="helper">The XML configuration helper being used.</param>
                internal void LoadFromXmlElement(XElement element, ConfigurationFileHelper helper)
                {
                    Name = helper.ReadStringAttribute(
                        element,
                        "name"
                        );

                    Visibility = helper.ReadServerVisibilityAttribute(
                        element,
                        "visibility"
                        );

                    helper.ReadElementCollectionTo(
                        element,
                        "connectsTo",
                        e => {
                        ConnectsToSettings s = new ConnectsToSettings();
                        s.LoadFromXmlElement(e, helper);
                        return(s);
                    },
                        ConnectsTo
                        );
                }
            /// <summary>
            ///     Loads the server settings from the specified XML element.
            /// </summary>
            /// <param name="element">The XML element to load from.</param>
            /// <param name="helper">The XML configuration helper being used.</param>
            internal void LoadFromXmlElement(XElement element, ConfigurationFileHelper helper)
            {
                if (element == null)
                {
                    return;
                }

                // Warnings disabled as we're implementing obsolete functionality
#pragma warning disable
                //Read address
                Address = helper.ReadIPAttributeOrDefault(
                    element,
                    "address",
                    IPAddress.Any
                    );

                //Read port
                Port = helper.ReadUInt16AttributeOrDefault(
                    element,
                    "port",
                    4296
                    );

                //Read the ip type
                IPVersion = helper.ReadIPVersionAttributeOrDefault(
                    element,
                    "ipVersion",
                    IPVersion.IPv4
                    );

                //Read no delay
                NoDelay = helper.ReadBooleanAttribute(
                    element,
                    "noDelay",
                    false
                    );

                //Read use fallback networking
                UseFallbackNetworking = helper.ReadBooleanAttribute(
                    element,
                    "useFallback",
                    false
                    );
#pragma warning restore

                //Read max strikes
                MaxStrikes = helper.ReadByteAttribute(
                    element,
                    "maxStrikes"
                    );

#if PRO
                //Read server group
                ServerGroup = helper.ReadStringAttributeOrDefault(
                    element,
                    "serverGroup",
                    null
                    );
#endif

                //Read reconnect attempts
                ReconnectAttempts = helper.ReadUInt16AttributeOrDefault(
                    element,
                    "reconnectAttempts",
                    5
                    );
            }