// Method // public static bool Init() { string applicationFolder = Path.GetDirectoryName(Application.ExecutablePath); _Data = new IniFile(string.Format("{0}\\{1}", applicationFolder, Filename)); Log.Module = Module; if (_Data.Exists()) { Log.WriteLineSucces(string.Format("Opening: {0}", Filename)); if (_Data.Load()) { _connected = true; Log.WriteLineSucces(string.Format("Loading: {0}", Filename)); return true; } Log.WriteLineFail(string.Format("Loading: {0}", Filename)); _connected = CreateTrim(); return _connected; } else { Log.WriteLineFail(string.Format("Opening: {0}", Filename)); _connected = CreateTrim(); return _connected; } }
public IniFile ReadIni() { IniFile ini = new Ini.IniFile("sys.ini"); if (ini.Exists()) { ini.Load(); } else { IniSection section = new IniSection(); section.Add("startdate", "1-05-2011"); section.Add("enddate", "15-05-2011"); ini.Add("DATES", section); section = new IniSection(); section.Add("email_user", "*****@*****.**"); section.Add("email_password", "Paz.planner01"); section.Add("email_from", "*****@*****.**"); section.Add("email_host", "smtp.gmail.com"); section.Add("email_port", "587"); section.Add("email_onderwerp", "Afstudeerzitting(en)"); ini.Add("EMAILSETTINGS", section); section = new IniSection(); section.Add("this.DB_host", "student.aii.avans.nl"); section.Add("this.DB_username", "MI4Ie"); section.Add("this.DB_password", "4DRcUrzV"); section.Add("this.DB_database", "MI4Ie_this.DB"); ini.Add("DATABASESETTINGS", section); ini.Save(); } return(ini); }
public static bool Init() { string applicationFolder = Path.GetDirectoryName(Application.ExecutablePath); Filename = "KHR-1HV.ini"; main_ini = new IniFile(string.Format("{0}\\{1}", applicationFolder, Filename)); Log.Module = Module; if (main_ini.Exists()) { Log.WriteLineSucces(string.Format("Opening: {0}", Filename)); if (main_ini.Load()) { Log.WriteLineSucces(string.Format("Loading: {0}", Filename)); Read(); return true; } Log.WriteLineFail(string.Format("Loading: {0}", Filename)); return false; } else { Log.WriteLineFail(string.Format("Opening: {0}", Filename)); IniSection section = new IniSection(); section.Add("Roboard", "RB100"); section.Add("MotionReplay", "false"); section.Add("EnableRemoteControl", "false"); section.Add("PowerUpMotion", "-1"); section.Add("LowPowerMotion", "-1"); section.Add("LowPowerVoltage", "120"); section.Add("Timebase", "100"); section.Add("FPS", "1"); section.Add("PA1REF", "0"); section.Add("PA2REF", "0"); section.Add("PA3REF", "0"); section.Add("PA4REF", "0"); section.Add("PA5REF", "0"); section.Add("PA6REF", "0"); for (int i = 0; i < StaticUtilities.numberOfServos; i++) { string tmp = string.Format("CH{0}", (i + 1)); section.Add(tmp, "1"); } main_ini.Add("Main", section); Log.WriteLineSucces(string.Format("Creating: {0}", Filename)); if (Save()) { Read(); return true; } return false; } }
public IniFile ReadIni() { IniFile ini = new Ini.IniFile("sys.ini"); if (ini.Exists()) { ini.Load(); } else { IniSection section = new IniSection(); section.Add("startdate", "1-05-2011"); section.Add("enddate", "15-05-2011"); ini.Add("DATES", section); section = new IniSection(); section.Add("email_user", "*****@*****.**"); section.Add("email_password", "Paz.planner01"); section.Add("email_from", "*****@*****.**"); section.Add("email_host", "smtp.gmail.com"); section.Add("email_port", "587"); section.Add("email_onderwerp", "Afstudeerzitting(en)"); ini.Add("EMAILSETTINGS", section); section = new IniSection(); section.Add("this.DB_host", "student.aii.avans.nl"); section.Add("this.DB_username", "MI4Ie"); section.Add("this.DB_password", "4DRcUrzV"); section.Add("this.DB_database", "MI4Ie_this.DB"); ini.Add("DATABASESETTINGS", section); ini.Save(); } return ini; }