Exemplo n.º 1
0
        /// <summary>
        /// Updates the server version in the xml file
        /// </summary>
        /// <param name="type">The type of server (VV, SV)</param>
        /// <param name="version">The new server version</param>
        public static void UpdateVersion(ServerVersionTypes type, string version)
        {
            XmlNode node = GetVersionNode(type);

            node.InnerText = version;
            versions.Save(versionsPath);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the version xml node for the server type
        /// </summary>
        /// <param name="type">The type of server (VV, SV)</param>
        /// <returns>A version xml node for the server type</returns>
        private static XmlNode GetVersionNode(ServerVersionTypes type)
        {
            XmlNode ver = versions.SelectSingleNode($"versions/version[@name='{type}']");

            if (ver == null)
            {
                ver = versions.CreateNode(XmlNodeType.Element, "version", "");
                XmlAttribute attribute = versions.CreateAttribute("name");
                attribute.Value = type.ToString();
                ver.Attributes.Append(attribute);
                versions.SelectSingleNode("/versions").AppendChild(ver);
            }
            return(ver);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Gets the version of the server type
 /// </summary>
 /// <param name="type">The type of server (VV, SV)</param>
 /// <returns>A string representing the version</returns>
 public static string GetVersionNodeValue(ServerVersionTypes type) => GetVersionNode(type).InnerText;