SafeNet/.svn/pristine/6b/6b0ded219582fe6f6e484a5aa1967d21ea75d2da.svn-base

69 lines
2.2 KiB
Plaintext
Raw Normal View History

2021-02-24 11:50:23 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Nini.Config;
using System.Collections;
using SafeNetLib;
namespace Landmarks_Import
{
public class Config
{
private IConfigSource source = null;
private string CFG_FILE = "config.ini";
public string iconName;
public int userID;
public int radius;
public int timeRequest;
public string fileName;
public string errorFileName;
public string duplicatesFileName;
public string SERVER;
public string DATABASE;
public string UID;
public string PASSWORD;
public bool db_active;
public int debug_port;
public ArrayList ar_radioIPs = new ArrayList();
public Config(string CFG_FILE = "config.ini")
{
LoadConfig();
}
private void LoadConfig()
{
try
{
source = new IniConfigSource(CFG_FILE);
iconName = source.Configs["SETTINGS"].Get("icon_name");
userID = Convert.ToInt32(source.Configs["SETTINGS"].Get("user_id"));
radius = Convert.ToInt32(source.Configs["SETTINGS"].Get("radius"));
timeRequest = Convert.ToInt32(source.Configs["SETTINGS"].Get("time_request"));
fileName = source.Configs["SETTINGS"].Get("file_name");
errorFileName = source.Configs["SETTINGS"].Get("error_file_name");
duplicatesFileName = source.Configs["SETTINGS"].Get("duplicates_file_name");
//MySQL connection info
SERVER = source.Configs["MySQL"].Get("SERVER");
DATABASE = source.Configs["MySQL"].Get("DATABASE");
UID = source.Configs["MySQL"].Get("UID");
PASSWORD = source.Configs["MySQL"].Get("PASSWORD");
db_active = Convert.ToBoolean(source.Configs["MySQL"].Get("active"));
}
catch (Exception ex)
{
Utils.ConsWrite(DebugMSG_Type.always, "LoadSetup() Exception: " + ex.ToString());
}
Utils.ConsWrite(DebugMSG_Type.CTRL, "LoadSetup file OK !");
}
}
}