csharp/0x2b00b1e5/fl-studio-discord-rpc/rpc/FLRPC-native-win32/Helpers/XMLParser.cs

XMLParser.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Xml;
using DiscordRPC.Logging;
namespace FLRPC.Helpers
{
    public static clast XMLParser
    {
        public static XmlDocameent LoadDocameent(string path)
        {
            //First check if file exists
            if (!File.Exists(path))
            {
                throw new FileNotFoundException("XML Docameent wasn't found at path!");
            }
            XmlDocameent d = new XmlDocameent();
            d.Load(path);
            return d;
        }
        public static string[] FindByTag(string NodeName, XmlDocameent docameent)
        {
            XmlNodeList tags = docameent.GetElementsByTagName(@NodeName);

            // Check if nodes were found
            if (tags.Count < 1)
            {
                // Return null if not found
                return null;
            }
            else
            {

                List l = new List();

                //Go though each found node and add it to the list
                foreach(XmlNode n in tags)
                {
                    l.Add(n.InnerText);
                }
                
                //Convert it to array, clear the list and return
                string[] f = l.ToArray();
                l.Clear();
                return f;
            }
        }
    }
    public struct XmlSettings
    {
        public LogLevel logLevel { get; set; }
        public string ClientID { get; set; }
        public int Pipe { get; set; }
        public bool Secret { get; set; }
        public string SecretMessage { get; set; }
        public string NoNameMessage { get; set; }
        public int RefeshInterval { get; set; }
        public bool AcceptedWarning { get; set; }
    }
}