using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace lib
{
    public class DbConfig
    {
        public string servername { get; set; }
        public string username { get; set; }
        public string password { get; set; }
        public string database { get; set; }
        public string charset { get; set; }

        static DbConfig dbConfig = null;
        
        public static DbConfig getInstance()
        {
            if (dbConfig == null)
            {
                IniFile ini = new lib.IniFile("Linkage_data.ini");
                dbConfig = new DbConfig()
                {
                    servername = ini.Read("ServerName", "DataBase"),
                    username = ini.Read("UserID", "DataBase"),
                    password = ini.Read("Password", "DataBase"),
                    database = ini.Read("DatabaseName", "DataBase"),
                    charset = "UTF8",//ini.Read("charset", "db")
                };
            }

            return dbConfig;
        }
    }
}
