public void loadIni(string fileName) { // Get SQL Server connection info from INI file (or use defaults) inifile ini = new inifile(System.AppDomain.CurrentDomain.BaseDirectory + fileName); this.user = ini.getValue("database", "user", "sa"); this.password = ini.getValue("database", "password", "123456"); this.server_url = ini.getValue("database", "server_url", "192.168.1.3\\SQLEXPRESS"); this.trusted_connection = ini.getValue("database", "trusted_connection", true); this.database = ini.getValue("database", "database", "SCA5t"); this.timeout = ini.getValue("database", "timeout", 30); connectionString = "Data Source=" + server_url + ";Initial Catalog=" + database + ";User Id=" + user + ";Password=" + password; }
public void createDefaultIni(string fileName) { inifile ini = new inifile(); ini.setValue("database", "user", "sa"); ini.setValue("database", "password", "123456"); ini.setValue("database", "server_url", "192.168.1.3\\SQLEXPRESS"); ini.setValue("database", "trusted_connection", true); ini.setValue("database", "database", "SCA5t"); ini.setValue("database", "timeout", 30); ini.setValue("database", "table", "SCAPersona"); ini.setValue("service", "folder", "/tmp/hl7"); ini.setValue("service", "port", 8901); ini.setValue("service", "csv", ","); ini.Save(fileName); }
public void loadSetup() { string fileName = System.AppDomain.CurrentDomain.BaseDirectory + "hl7service.ini"; if (File.Exists(fileName) == false) { createDefaultIni(fileName); } inifile ini = new inifile(fileName); folder = ini.getValue("service", "folder", "/tmp/hl7"); port = ini.getValue("service", "port", 8901); csv_field_delimiter = ini.getValue("service", "csv", ",")[0]; // Check that receiving folder exists, if not we create it if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } }