public void RemoveByIndexRemovesSectionAtSpecifiedIndex() { var ini = new IniFile(); ini.Add(new Section("Foo")); ini.Add(new Section("Bar")); ini.Remove(1); Assert.IsFalse(ini.Contains("Bar")); }
public void create(String file) { this.file = file; if (file != null) { configFile = new IniFile(file); configFile.Add("Name", "projectname"); configFile.Add("Icon", localPathChar + "\\icon.bmp"); configFile.Add("Files", ""); } }
public void RemoveBySectionRemovesSpecifiedSection() { var ini = new IniFile(); var section = new Section("Foo"); ini.Add(section); ini.Add(new Section("Bar")); ini.Remove(section); Assert.IsFalse(ini.Contains("Foo")); }
public void AddThrowsIfSectionIsAlreadyPresent() { var ini = new IniFile(); var section = new Section("Foo"); ini.Add(section); Assert.Throws <ArgumentException>(() => { ini.Add(section); }); }
public static void Load() { if (File.Exists(Directory.GetCurrentDirectory() + "\\" + Setting_File_Name)) { settings.Load(Directory.GetCurrentDirectory() + "\\" + Setting_File_Name); } if (settings.TryGetSection("General", out IniSection generalSection) == false) { generalSection = settings.Add("General"); } if (generalSection.TryGetValue("Path", out IniValue path) == false) { generalSection.Add("Path", "Voices\\"); } if (generalSection.TryGetValue("ClientID", out IniValue clientID) == false) { generalSection.Add("ClientID", "NaN"); } if (generalSection.TryGetValue("ClientSecret", out IniValue clientSecret) == false) { generalSection.Add("ClientSecret", "NaN"); } if (generalSection.TryGetValue("IsEncrypted", out IniValue isEncrypted) == false) { generalSection.Add("IsEncrypted", false); } isInitialized = true; }
public void IniFileCanBeCreatedProgramatically() { var ini = new IniFile(); var section = new Section("Foo"); section.Add(new Property("Bar", "Baz")); section.Add(new Property("Toz", "Taz")); ini.Add(section); Assert.AreEqual("[Foo]\r\nBar=Baz\r\nToz=Taz\r\n\r\n", ini.ToString()); }
public void SectionByIndexIndexerReturnsSpecifiedSection() { var ini = new IniFile(); var section = new Section("Foo"); ini.Add(section); var result = ini[0]; Assert.AreEqual(section, result); }
public void Save_tests() { var ini = new IniFile(); var section = new IniFile.Section("Test") { { "Player1", "Jeevan" }, { "Player2", "Merina" } }; ini.Add(section); ini.Add(new IniFile.Section("Jeevan") { { "Powers", "Superspeed,Super strength" }, { "Costume", "Scarlet" } }); ini.Add(new IniFile.Section("Merina") { { "Powers", "Stretchability, Invisibility" }, { "Costume", "Blue" } }); }
private void saveHUDLocation(DirectX_HUDs hud) { if (hud != null) { IniFile file = new IniFile(MainWindow.settings_path); if (file.Exists()) { file.Load(); } IniSection section = new IniSection(); string str = hud.ContentHUDType.ToString() + " HUD"; if (file.HasSection(str)) { section = file[str]; file.Remove(str); } if (section.ContainsKey("X")) { section["X"] = base.Location.X.ToString(); } else { section.Add("X", base.Location.X.ToString()); } if (section.ContainsKey("Y")) { section["Y"] = base.Location.Y.ToString(); } else { section.Add("Y", base.Location.Y.ToString()); } file.Add(str, section); file.Save(); } }
public void SaveSettings() { IniFile file = new IniFile(MainWindow.settings_path); if (file.Exists()) { file.Load(); } else { if (!Directory.Exists(MainWindow.settings_folder)) { Directory.CreateDirectory(MainWindow.settings_folder); } File.Create(MainWindow.settings_path).Close(); } IniSection section = new IniSection(); if (file.HasSection("OptionsUpdates")) { file.Remove("OptionsUpdates"); } section.Add("chkAutoUpdate", this.chkAutoUpdate.Checked.ToString()); file.Add("OptionsUpdates", section); section = new IniSection(); if (file.HasSection("OptionsDrawing")) { file.Remove("OptionsDrawing"); } section.Add("chkTeamColors", this.checkBoxTeamColors.Checked.ToString()); section.Add("chkAutoHideHUDs", this.checkBoxHideHUDs.Checked.ToString()); section.Add("cbObserverPanelDrawDirection", this.cbObserverPanelDrawDirection.SelectedItem.ToString()); section.Add("chkCameraEnemies", this.chkCameraEnemies.Checked.ToString()); section.Add("chkCameraAllies", this.chkCameraAllies.Checked.ToString()); section.Add("chkCameraSelf", this.chkCameraSelf.Checked.ToString()); section.Add("chkSpectator", this.chkSpectator.Checked.ToString()); section.Add("chkUnitsEnemies", this.chkUnitsEnemies.Checked.ToString()); section.Add("chkUnitsAllies", this.chkUnitsAllies.Checked.ToString()); section.Add("chkUnitsSelf", this.chkUnitsSelf.Checked.ToString()); section.Add("chk0Radius", this.chk0Radius.Checked.ToString()); section.Add("chkUnitDestinationEnemies", this.chkUnitDestinationEnemies.Checked.ToString()); section.Add("chkUnitDestinationAllies", this.chkUnitDestinationAllies.Checked.ToString()); section.Add("chkUnitDestinationSelf", this.chkUnitDestinationSelf.Checked.ToString()); section.Add("chkUnitEnemiesScreen", this.chkUnitEnemiesScreen.Checked.ToString()); section.Add("chkUnitDestinationEnemiesScreen", this.chkUnitDestinationEnemiesScreen.Checked.ToString()); file.Add("OptionsDrawing", section); section = new IniSection(); if (file.HasSection("OptionsHotkeys")) { file.Remove("OptionsHotkeys"); } section.Add("cbRepositionHotkey", this.cbRepositionHotkey.Text); section.Add("cbNextPanelHotkey", this.cbNextPanelHotkey.Text); section.Add("cbPreviousPanelHotkey", this.cbPreviousPanelHotkey.Text); file.Add("OptionsHotkeys", section); section = new IniSection(); string str3 = "OptionsTimers"; if (file.HasSection(str3)) { file.Remove(str3); } section.Add("udGUI", this.udGUI.Value.ToString()); section.Add("udDrawing", this.udDrawing.Value.ToString()); section.Add("udData", this.udData.Value.ToString()); file.Add(str3, section); file.Save(); }
private void saveConfigFile() { string currentPath = Directory.GetCurrentDirectory(); IniFile ini = new IniFile(currentPath + "\\config.ini"); foreach (ListViewItem lsti in HostListView.Items) { IniSection section = new IniSection(); section.Add("HostName", lsti.SubItems[0].Text); section.Add("Port", lsti.SubItems[1].Text); section.Add("Community", lsti.SubItems[2].Text); section.Add("Version", lsti.SubItems[3].Text); section.Add("User", lsti.SubItems[4].Text); section.Add("Password", lsti.SubItems[5].Text); ini.Add(lsti.SubItems[0].Text, section); } ini.Save(); }
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 static void mainServer_messageHandler(object sender, NewMessageEventsArgs e) { networkBusy = true; Log.WriteLineMessage(e.NewMessage); string sendMsg = string.Empty; string[] message; string[] Msg; message = e.NewMessage.Split(','); // first index contains the command // Make a command parser. // switch(message[0]) { // // Main Menu case "Information": sendMsg = string.Empty; sendMsg = string.Format("{0},{1},{2},{3},{4},{5}", RCServo.CPU(), RCServo.Version(), Convert.ToString(RCServo.Connected), Convert.ToString(I2C.Connected), Convert.ToString(AD7918.Connected), Convert.ToString(SPI.Connected)); break; case "Options": switch (message[1]) { case "Read": string tmp = string.Empty; sendMsg = Server.MainIni.MotionReplay.ToString() + "," + Server.MainIni.EnableRemoteControl.ToString() + "," + Server.MainIni.PowerUpMotion + "," + Server.MainIni.LowPowerMotion + "," + Server.MainIni.LowPowerVoltage.ToString() + "," + Server.MainIni.TimeBase.ToString(); for (int i = 0; i < StaticUtilities.numberOfServos; i++) { tmp += string.Format(",{0}", Server.MainIni.ChannelFunction[i]); } sendMsg = sendMsg + tmp; break; case "Write": Server.MainIni.MotionReplay = Convert.ToBoolean(message[2]); Server.MainIni.EnableRemoteControl = Convert.ToBoolean(message[3]); Server.MainIni.PowerUpMotion = Convert.ToInt32(message[4]); Server.MainIni.LowPowerMotion = Convert.ToInt32(message[5]); Server.MainIni.LowPowerVoltage = Convert.ToInt32(message[6]); Server.MainIni.TimeBase = Convert.ToInt32(message[7]); int[] temp = new int[StaticUtilities.numberOfServos]; for (int i = 0; i < StaticUtilities.numberOfServos; i++) { temp[i] = Convert.ToInt32(message[8 + i]); } Server.MainIni.ChannelFunction = temp; Server.MainIni.Save(); Server.RCServo.Close(); Server.RCServo.Init(); if (MainIni.EnableRemoteControl) if (!Server.XBox360.Open) Server.XBox360.Init(); sendMsg = "Ok"; break; default: break; } break; case "ReadMotionFile": switch(message[1]) { case "Open": // Get the selected motion index and check // in the motiontable if the motion exists // return true if the file exist. selectedMotionIndex = Convert.ToInt32(message[2]) + 1; string file = Server.Table.MotionTable["Motion" + selectedMotionIndex.ToString()]["Filename"]; if (file != string.Empty) { khr_1hv_motion = new IniFile(file); khr_1hv_motion.Load(); sendMsg = "Ok"; } else { sendMsg = "No motion to read"; } break; case "GraphicalEdit": Msg = new string[8]; Msg[0] = khr_1hv_motion["GraphicalEdit"]["Type"]; Msg[1] = khr_1hv_motion["GraphicalEdit"]["Width"]; Msg[2] = khr_1hv_motion["GraphicalEdit"]["Height"]; Msg[3] = khr_1hv_motion["GraphicalEdit"]["Items"]; Msg[4] = khr_1hv_motion["GraphicalEdit"]["Links"]; Msg[5] = khr_1hv_motion["GraphicalEdit"]["Start"]; Msg[6] = khr_1hv_motion["GraphicalEdit"]["Name"]; Msg[7] = khr_1hv_motion["GraphicalEdit"]["Ctrl"]; Items = 0; Links = 0; sendMsg = string.Join(",", Msg); break; case "Item": Msg = new string[8]; string strItems = string.Format("Item{0}", Items++); Msg[0] = khr_1hv_motion[strItems]["Name"]; Msg[1] = khr_1hv_motion[strItems]["Width"]; Msg[2] = khr_1hv_motion[strItems]["Height"]; Msg[3] = khr_1hv_motion[strItems]["Left"]; Msg[4] = khr_1hv_motion[strItems]["Top"]; Msg[5] = khr_1hv_motion[strItems]["Color"]; Msg[6] = khr_1hv_motion[strItems]["Type"]; Msg[7] = khr_1hv_motion[strItems]["Prm"]; sendMsg = string.Join(",", Msg); break; case "Link": Msg = new string[4]; string strLinks = string.Format("Link{0}", Links++); Msg[0] = khr_1hv_motion[strLinks]["Main"]; Msg[1] = khr_1hv_motion[strLinks]["Origin"]; Msg[2] = khr_1hv_motion[strLinks]["Final"]; Msg[3] = khr_1hv_motion[strLinks]["Point"]; sendMsg = string.Join(",", Msg); break; default: break; } break; case "WriteMotionFile": switch (message[1]) { case "Open": // create random filename. fileName = Path.ChangeExtension(Path.GetRandomFileName(), "RMF"); fileName = string.Format("{0}\\{1}", motionsFolder, fileName); // get the index for the datatable where the // motion is going to be writen. selectedMotionIndex = Convert.ToInt32(message[2]) + 1; khr_1hv_motion = new IniFile(fileName); sendMsg = "Ok"; break; case "GraphicalEdit": IniSection section1 = new IniSection(); section1.Add("Type", message[2]); section1.Add("Width", message[3]); section1.Add("Height", message[4]); section1.Add("Items", message[5]); section1.Add("Links", message[6]); section1.Add("Start", message[7]); section1.Add("Name", message[8]); section1.Add("Ctrl", message[9]); khr_1hv_motion.Add("GraphicalEdit", section1); Items = 0; Links = 0; sendMsg = "Ok"; break; case "Item": IniSection section2 = new IniSection(); section2.Add("Name", message[2]); section2.Add("Width", message[3]); section2.Add("Height", message[4]); section2.Add("Left", message[5]); section2.Add("Top", message[6]); section2.Add("Color", message[7]); section2.Add("Type", message[8]); string strChannel = string.Format("{0}", message[9]); for (int i = 10; i < message.Length; i++) { strChannel = string.Format("{0},{1}", strChannel, message[i]); } section2.Add("Prm", strChannel); string strItems = string.Format("Item{0}", Items++); khr_1hv_motion.Add(strItems, section2); sendMsg = "Ok"; break; case "Link": IniSection section3 = new IniSection(); section3.Add("Main", message[2]); section3.Add("Origin", message[3]); section3.Add("Final", message[4]); string strPoint = string.Format("{0}", message[5]); for (int i = 6; i < message.Length; i++) { strPoint = string.Format("{0},{1}", strPoint, message[i]); } section3.Add("Point", strPoint); string strLinks = string.Format("Link{0}", Links++); khr_1hv_motion.Add(strLinks, section3); sendMsg = "Ok"; break; case "Save": // get the filename of the motion to be deleted string file = Server.Table.MotionTable["Motion" + selectedMotionIndex.ToString()]["Filename"]; if (file != string.Empty) { if (File.Exists(file)) { File.Delete(file); Log.WriteLineSucces(string.Format("Deleting: {0}", Server.Table.MotionTable["Motion" + selectedMotionIndex.ToString()]["Name"])); } else { Log.WriteLineFail(string.Format("Deleting: {0}", Server.Table.MotionTable["Motion" + selectedMotionIndex.ToString()]["Name"])); } } Name = khr_1hv_motion["GraphicalEdit"]["Name"]; Ctrl = khr_1hv_motion["GraphicalEdit"]["Ctrl"]; if (!khr_1hv_motion.Save()) { Log.WriteLineError(string.Format("Saving: {0}", Name)); sendMsg = "NOk"; } else { Log.WriteLineSucces(string.Format("Saving: {0}", Name)); Server.Table.addNewMotion(selectedMotionIndex, fileName, Name, Ctrl); Server.Table.Save(); sendMsg = "Ok"; } break; } break; case "PlayMotionFile": int strMotion = (int.Parse(message[1])); Log.WriteLineMessage(string.Format("Playing motion: {0}, {1}", Table.MotionTable["Motion" + (strMotion + 1).ToString()]["Name"], Table.MotionTable["Motion" + (strMotion + 1).ToString()]["Control"])); Server.MotionInterpreter.Filename = Server.Table.MotionTable["Motion" + (strMotion + 1).ToString()]["Filename"]; Server.MotionInterpreter.Play(); //sendMsg = "Ok"; // No need for this. break; case "StopMotionFile": Server.MotionInterpreter.Stop(); break; case "PauseMotionFile": Server.MotionInterpreter.Pause(); break; case "DataTable": switch (message[1]) { case "Open": sendMsg = string.Format("Open,{0},{1}", StaticUtilities.numberOfMotions, StaticUtilities.numberOfDataTableItems); break; case "Get": string[] strTable = new string[StaticUtilities.numberOfDataTableItems]; string tmp = string.Format("{0}{1}", StaticUtilities.DataTableMotion, message[2]); strTable[0] = Server.Table.MotionTable[tmp][StaticUtilities.DataTableMotion]; strTable[1] = Server.Table.MotionTable[tmp][StaticUtilities.DataTableName]; strTable[2] = Server.Table.MotionTable[tmp][StaticUtilities.DataTableCount]; strTable[3] = Server.Table.MotionTable[tmp][StaticUtilities.DataTableDate]; strTable[4] = Server.Table.MotionTable[tmp][StaticUtilities.DataTableCtrl]; sendMsg = string.Format("Get,{0}", string.Join(",", strTable)); break; default: break; } break; case "DeleteMotionFile": int strMotion1 = int.Parse(message[1]) + 1; string file1 = Server.Table.MotionTable["Motion" + strMotion1.ToString()]["Filename"]; Server.Table.deleteMotion(strMotion1); Server.Table.Save(); if (file1 != string.Empty) { if (File.Exists(file1)) { File.Delete(file1); Log.WriteLineSucces(string.Format("Deleting: {0}", file1)); } else { Log.WriteLineFail(string.Format("Deleting: {0}", file1)); } } else { Log.WriteLineFail("Deleting: No such file"); } // send something back as conformation. sendMsg = "Ok"; break; case "Servos": switch (message[1]) { case "Set": int[] width = new int[StaticUtilities.numberOfServos]; Array.Copy(message, 2, strChannelData, 0, 24); for (int q = 0; q < StaticUtilities.numberOfServos; q++) { width[q] = Convert.ToInt32(strChannelData[q]); } Server.MotionInterpreter.Servos(width, 100); break; default: break; } break; case "Trim": switch (message[1]) { case "Get": sendMsg = Server.Trim.Data; // Set the servo's position to the trim values MotionInterpreter.Trim(); break; case "Set": Array.Copy(message, 2, strChannelData, 0, 24); Server.Trim.Data = string.Join(",", strChannelData); sendMsg = "Ok"; // misschien als check de trim.data weer terugsturen. MotionInterpreter.Trim(); break; case "Stop": Server.Trim.Save(); sendMsg = "Ok"; break; default: break; } break; case "Close": case "close": infinteLoop = false; sendMsg = "No Connection"; break; case "Open": sendMsg = "Connected"; break; case "XBox360Controller": switch (message[1]) { case "Open": if (Server.XBox360.Open) Server.XBox360.ControllerState(); sendMsg = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13}", Server.XBox360.Open, Server.XBox360.Buttons, Server.XBox360.ThumbsticksX1, Server.XBox360.ThumbsticksY1, Server.XBox360.ThumbsticksX2, Server.XBox360.ThumbsticksY2, Server.XBox360.TriggerLeft, Server.XBox360.TriggerRight, MainIni.PA1Reference, MainIni.PA2Reference, MainIni.PA3Reference, MainIni.PA4Reference, MainIni.PA5Reference, MainIni.PA6Reference); break; case "Read": Server.XBox360.ControllerState(); sendMsg = string.Format("{0},{1},{2},{3},{4},{5},{6},{7}", Server.XBox360.Open, Server.XBox360.Buttons, Server.XBox360.ThumbsticksX1, Server.XBox360.ThumbsticksY1, Server.XBox360.ThumbsticksX2, Server.XBox360.ThumbsticksY2, Server.XBox360.TriggerLeft, Server.XBox360.TriggerRight); break; case "Stop": MainIni.PA1Reference = Convert.ToInt32(message[2]); MainIni.PA2Reference = Convert.ToInt32(message[3]); MainIni.PA3Reference = Convert.ToInt32(message[4]); MainIni.PA4Reference = Convert.ToInt32(message[5]); MainIni.PA5Reference = Convert.ToInt32(message[6]); MainIni.PA6Reference = Convert.ToInt32(message[7]); MainIni.Save(); //sendMsg = "Ok"; break; default: break; } break; case "MagnetoData": short[] compass = Compass.CompassData(); sendMsg = "MagnetoData," + compass[0].ToString() + "," + compass[1].ToString() + "," + compass[2].ToString(); break; case "AcceleroData": short[] accelero = Accelero.AcceleroData(); sendMsg = "AcceleroData," + accelero[0].ToString() + "," + accelero[1].ToString() + "," + accelero[2].ToString(); break; case "GyroscopeData": short[] gyro = Gyro.GyroData(); sendMsg = "GyroscopeData," + gyro[0].ToString() + "," + gyro[1].ToString() + "," + gyro[2].ToString() + "," + gyro[3].ToString() + "," + gyro[4].ToString() + "," + gyro[5].ToString() + "," + gyro[6].ToString() + "," + gyro[7].ToString(); break; default: break; } if (sendMsg != string.Empty) Network.SendMessage(sendMsg); networkBusy = false; }
// Methods // public static bool Read() { // Read a motion from the server Roboard.NetworkClient.messageHandler += new NetworkClient.NewMessageEventHandler(WriteNetworkClient_messageHandler); string strCommand = string.Format("ReadMotionFile"); // 1 - send the selectedmotion index to the server // sendString = string.Format("{0},Open,{1}", strCommand, _selectedMotionIndex); if (!handleNetworkMessage(sendString)) return false; // 2 - if exists than create a new motionData. // tempMotionData = new IniFile(string.Empty); //======================================== // 3 - Read the GraphicalEdit part section //======================================== // send to the server sendString = string.Format("{0},{1}", strCommand, StaticUtilities.SectionGraphicalEdit); if (!handleNetworkMessage(sendString)) return false; IniSection graphicalEditSection = new IniSection(); for (int i = 0; i < StaticUtilities.GraphicalEdit.Length; i++) graphicalEditSection.Add(StaticUtilities.GraphicalEdit[i], strMessage[i]); tempMotionData.Add(StaticUtilities.SectionGraphicalEdit, graphicalEditSection); //=========================== // 4 - Read the items section //=========================== int Items = Convert.ToInt32(tempMotionData[StaticUtilities.SectionGraphicalEdit][StaticUtilities.GraphicalEditItems]); for (int i = 0; i < Items; i++) { // send to the server sendString = string.Format("{0},{1}", strCommand, StaticUtilities.SectionItem); if (!handleNetworkMessage(sendString)) return false; IniSection itemSection = new IniSection(); for (int j = 0; j < StaticUtilities.Item.Length - 1; j++) // minus one because Prm itemSection.Add(StaticUtilities.Item[j], strMessage[j]); string strChannel = string.Format("{0}", strMessage[StaticUtilities.Item.Length - 1]); for (int k = StaticUtilities.Item.Length; k < strMessage.Length; k++) strChannel = string.Format("{0},{1}", strChannel, strMessage[k]); itemSection.Add(StaticUtilities.ItemPrm, strChannel); tempMotionData.Add(string.Format("{0}{1}", StaticUtilities.SectionItem, i), itemSection); } //=========================== // 5 - Read the links section //=========================== int Links = Convert.ToInt32(tempMotionData[StaticUtilities.SectionGraphicalEdit][StaticUtilities.GraphicalEditLinks]); for (int i = 0; i < Links; i++) { // send to the server sendString = string.Format("{0},{1}", strCommand, StaticUtilities.SectionLink); if (!handleNetworkMessage(sendString)) return false; IniSection linkSection = new IniSection(); for (int j = 0; j < StaticUtilities.Link.Length - 1; j++) // minus one because Point linkSection.Add(StaticUtilities.Link[j], strMessage[j]); string strPoint = string.Format("{0}", strMessage[StaticUtilities.Link.Length - 1]); for (int k = StaticUtilities.Link.Length; k < strMessage.Length; k++) strPoint = string.Format("{0},{1}", strPoint, strMessage[k]); linkSection.Add(StaticUtilities.LinkPoint, strPoint); tempMotionData.Add(string.Format("{0}{1}", StaticUtilities.SectionLink, i), linkSection); } // 6 - close and other things to be done. motionData = tempMotionData; Close(); return true; }
private void saveSnmpConfigFile() { IniFile ini = new IniFile("SNMP Config.ini"); foreach (ListViewItem lsti in SnmpHostListView.Items) { IniSection section = new IniSection(); section.Add("HostName", lsti.SubItems[0].Text); section.Add("Port", lsti.SubItems[1].Text); section.Add("Community", lsti.SubItems[2].Text); section.Add("Version", lsti.SubItems[3].Text); section.Add("User", lsti.SubItems[4].Text); section.Add("Password", lsti.SubItems[5].Text); ini.Add(lsti.SubItems[0].Text, section); } ini.Save(); }
private void saveInfoMartConfigFile() { IniFile ini = new IniFile("InfoMart Config.ini"); if (InfoMartJobConfig != null) { IniSection section = new IniSection(); section.Add("HostName", InfoMartJobConfig.hostname); section.Add("Port", InfoMartJobConfig.port ); section.Add("Service", InfoMartJobConfig.service ); section.Add("Table", InfoMartJobConfig.table ); section.Add("Username", InfoMartJobConfig.username ); section.Add("Password", InfoMartJobConfig.password ); ini.Add("InfoMart DB", section); } ini.Save(); }