<commit_before>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Xml;

namespace DMPDistributedDBBackend
{
    public class BackendSettings
    {
        public string dbHost = "localhost";
        public int dbPort = 3306;
        public string dbUsername = "USERNAME";
        public string dbPassword = "PASSWORD";
        public string dbDatabase = "DATABASE";
        public List<string> reporters = new List<string>();

        public void LoadFromFile(string fileName)
        {
            if (!File.Exists(fileName))
            {
                reporters.Add("server.game.api.d-mp.org:9003");
                reporters.Add("godarklight.info.tm:9003");
                SaveToFile(fileName);
            }
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(fileName);
            dbHost = xmlDoc.DocumentElement.GetElementsByTagName("dbHost")[0].InnerText;
            dbPort = Int32.Parse(xmlDoc.DocumentElement.GetElementsByTagName("dbPort")[0].InnerText);
            dbUsername = xmlDoc.DocumentElement.GetElementsByTagName("dbUsername")[0].InnerText;
            dbPassword = xmlDoc.DocumentElement.GetElementsByTagName("dbPassword")[0].InnerText;
            dbDatabase = xmlDoc.DocumentElement.GetElementsByTagName("dbDatabase")[0].InnerText;
            reporters.Clear();
            foreach (XmlNode endpointNode in xmlDoc.DocumentElement.GetElementsByTagName("reporter"))
            {
                reporters.Add(endpointNode.InnerText);
            }
        }

        public void SaveToFile(string fileName)
        {
            string newFile = fileName + ".new";
            if (File.Exists(newFile))
            {
                File.Delete(newFile);
            }
            XmlDocument xmlDoc = new XmlDocument();
            XmlElement settingsElement = xmlDoc.CreateElement("settings");
            xmlDoc.AppendChild(settingsElement);
            //Settings<commit_msg>Update DNS<commit_after>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Xml;

namespace DMPDistributedDBBackend
{
    public class BackendSettings
    {
        public string dbHost = "localhost";
        public int dbPort = 3306;
        public string dbUsername = "USERNAME";
        public string dbPassword = "PASSWORD";
        public string dbDatabase = "DATABASE";
        public List<string> reporters = new List<string>();

        public void LoadFromFile(string fileName)
        {
            if (!File.Exists(fileName))
            {
                reporters.Add("server.game.api.d-mp.org:9003");
                reporters.Add("godarklight.privatedns.org:9003");
                SaveToFile(fileName);
            }
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(fileName);
            dbHost = xmlDoc.DocumentElement.GetElementsByTagName("dbHost")[0].InnerText;
            dbPort = Int32.Parse(xmlDoc.DocumentElement.GetElementsByTagName("dbPort")[0].InnerText);
            dbUsername = xmlDoc.DocumentElement.GetElementsByTagName("dbUsername")[0].InnerText;
            dbPassword = xmlDoc.DocumentElement.GetElementsByTagName("dbPassword")[0].InnerText;
            dbDatabase = xmlDoc.DocumentElement.GetElementsByTagName("dbDatabase")[0].InnerText;
            reporters.Clear();
            foreach (XmlNode endpointNode in xmlDoc.DocumentElement.GetElementsByTagName("reporter"))
            {
                reporters.Add(endpointNode.InnerText);
            }
        }

        public void SaveToFile(string fileName)
        {
            string newFile = fileName + ".new";
            if (File.Exists(newFile))
            {
                File.Delete(newFile);
            }
            XmlDocument xmlDoc = new XmlDocument();
            XmlElement settingsElement = xmlDoc.CreateElement("settings");
            xmlDoc.AppendChild(settingsElement);
            //Settings
{'fraction_non_alphanumeric': 0.10101010101010101, 'fraction_numerical': 0.009595959595959595, 'mean_word_length': 2.2735537190082646, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 22}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3388394', 'n_tokens_mistral': 1047, 'n_tokens_neox': 1027, 'n_words': 182}