private void saveIni(string sFilename) { IniFileParsing ifParsing = new IniFileParsing(sFilename, false); //creates ini if doesn't exist try { CsIniSaveHelper saver = new CsIniSaveHelper(ifParsing, "main"); //one section called "main" double nX0, nX1, nY0, nY1; plotCntrl.getBounds(out nX0, out nX1, out nY0, out nY1); saver.saveDouble("X0", nX0); saver.saveDouble("X1", nX1); saver.saveDouble("Y0", nY0); saver.saveDouble("Y1", nY1); saver.saveDouble("param1", plotCntrl.param1); saver.saveDouble("param2", plotCntrl.param2); saver.saveDouble("param3", plotCntrl.param3); saver.saveDouble("param4", plotCntrl.param4); saver.saveInt("paramSettle", plotCntrl.paramSettle); saver.saveDouble("paramShading", plotCntrl.paramShading); saver.saveString("paramExpression", txtExpression.Text); saver.saveString("paramInit", txtInit.Text); saver.saveString("paramP0", txtP0.Text); saver.saveInt("bShading", mnuAdvShades.Checked?1:0); saver.saveString("programVersion", Version); } catch (IniFileParsingException err) { MessageBox.Show("Prefs Error:" + err.ToString()); return; } }
public CsIniLoadHelper(IniFileParsing csIniFile, string sSectionName) { this.csIniFile = csIniFile; this.sSectionName = sSectionName; dict = new Dictionary<string, string>(); List<KeyValuePair<string, string>> list = csIniFile.GetKeysAndValues(sSectionName); foreach (KeyValuePair<string, string> kvp in list) dict[kvp.Key] = kvp.Value; }
private void loadIni(string sFilename) { //note: requires absolute path to file. if (!File.Exists(sFilename)) { return; } IniFileParsing ifParsing = new IniFileParsing(sFilename, true); try { CsIniLoadHelper loader = new CsIniLoadHelper(ifParsing, "main"); double nX0 = loader.getDouble("X0"); double nX1 = loader.getDouble("X1"); double nY0 = loader.getDouble("Y0"); double nY1 = loader.getDouble("Y1"); plotCntrl.setBounds(nX0, nX1, nY0, nY1); plotCntrl.param1 = loader.getDouble("param1"); plotCntrl.param2 = loader.getDouble("param2"); plotCntrl.param3 = loader.getDouble("param3", true); plotCntrl.param4 = loader.getDouble("param4", true); plotCntrl.paramSettle = loader.getInt("paramSettle"); plotCntrl.paramShading = loader.getDouble("paramShading"); //these are transformed, so set the ui instead of the prop. Call to Redraw will retrieve this. mnuAdvShades.Checked = loader.getInt("bShading") != 0; mnuAdvPoints.Checked = loader.getInt("bShading") == 0; txtExpression.Text = loader.getString("paramExpression"); txtP0.Text = loader.getString("paramP0"); txtInit.Text = loader.getString("paramInit"); } catch (IniFileParsingException err) { MessageBox.Show("Prefs Error:" + err.ToString()); return; } //set ui double p1 = plotCntrl.param1; double p2 = plotCntrl.param2; double p3 = plotCntrl.param3; double p4 = plotCntrl.param4; double ps = plotCntrl.paramShading; double pst = plotCntrl.paramSettle; lblParam1.Text = p1.ToString(); lblParam2.Text = p2.ToString(); lblSettling.Text = pst.ToString(); lblShading.Text = ps.ToString(); setSliderToValue(ps, tbShading); setSliderToValue(p1, tbParam1); setSliderToValue(p2, tbParam2); setSliderToValue(p3, tbParam3); setSliderToValue(p4, tbParam4); Redraw(); }
public CsIniLoadHelper(IniFileParsing csIniFile, string sSectionName) { this.csIniFile = csIniFile; this.sSectionName = sSectionName; dict = new Dictionary <string, string>(); List <KeyValuePair <string, string> > list = csIniFile.GetKeysAndValues(sSectionName); foreach (KeyValuePair <string, string> kvp in list) { dict[kvp.Key] = kvp.Value; } }
private void saveIni(string sFilename) { IniFileParsing ifParsing = new IniFileParsing(sFilename, false); //creates ini if doesn't exist try { CsIniSaveHelper saver = new CsIniSaveHelper(ifParsing, "main"); //one section called "main" double nX0, nX1, nY0, nY1; plotCntrl.getBounds(out nX0, out nX1, out nY0, out nY1); saver.saveDouble("X0", nX0); saver.saveDouble("X1", nX1); saver.saveDouble("Y0", nY0); saver.saveDouble("Y1", nY1); saver.saveDouble("param1", plotCntrl.param1); saver.saveDouble("param2", plotCntrl.param2); saver.saveDouble("param3", plotCntrl.param3); saver.saveDouble("param4", plotCntrl.param4); saver.saveInt("paramSettle", plotCntrl.paramSettle); saver.saveDouble("paramShading", plotCntrl.paramShading); saver.saveString("paramExpression", txtExpression.Text); saver.saveString("paramInit", txtInit.Text); saver.saveString("paramP0", txtP0.Text); saver.saveInt("bShading", mnuAdvShades.Checked?1:0); saver.saveString("programVersion", Version); } catch (IniFileParsingException err) { MessageBox.Show("Prefs Error:"+err.ToString()); return; } }
private void loadIni(string sFilename) { //note: requires absolute path to file. if (!File.Exists(sFilename)) return; IniFileParsing ifParsing = new IniFileParsing(sFilename, true); try { CsIniLoadHelper loader = new CsIniLoadHelper(ifParsing, "main"); double nX0 = loader.getDouble("X0"); double nX1 = loader.getDouble("X1"); double nY0 = loader.getDouble("Y0"); double nY1 = loader.getDouble("Y1"); plotCntrl.setBounds(nX0, nX1, nY0, nY1); plotCntrl.param1 = loader.getDouble("param1"); plotCntrl.param2 = loader.getDouble("param2"); plotCntrl.param3 = loader.getDouble("param3", true); plotCntrl.param4 = loader.getDouble("param4", true); plotCntrl.paramSettle = loader.getInt("paramSettle"); plotCntrl.paramShading = loader.getDouble("paramShading"); //these are transformed, so set the ui instead of the prop. Call to Redraw will retrieve this. mnuAdvShades.Checked = loader.getInt("bShading")!=0; mnuAdvPoints.Checked = loader.getInt("bShading")==0; txtExpression.Text = loader.getString("paramExpression"); txtP0.Text = loader.getString("paramP0"); txtInit.Text = loader.getString("paramInit"); } catch (IniFileParsingException err) { MessageBox.Show("Prefs Error:"+err.ToString()); return; } //set ui double p1 = plotCntrl.param1; double p2 = plotCntrl.param2; double p3 = plotCntrl.param3; double p4 = plotCntrl.param4; double ps = plotCntrl.paramShading; double pst = plotCntrl.paramSettle; lblParam1.Text = p1.ToString(); lblParam2.Text = p2.ToString(); lblSettling.Text = pst.ToString(); lblShading.Text = ps.ToString(); setSliderToValue(ps, tbShading); setSliderToValue(p1, tbParam1); setSliderToValue(p2, tbParam2); setSliderToValue(p3, tbParam3); setSliderToValue(p4, tbParam4); Redraw(); }
public CsIniSaveHelper(IniFileParsing csIniFile, string sSectionName) { this.csIniFile = csIniFile; this.sSectionName = sSectionName; }
private void loadIni(string sFilename) { //note: requires absolute path to file. if (!File.Exists(sFilename)) return; IniFileParsing ifParsing = new IniFileParsing(sFilename, true); try { CsIniLoadHelper loader = new CsIniLoadHelper(ifParsing, "main_portrait"); double nX0 = loader.getDouble("X0"); double nX1 = loader.getDouble("X1"); double nY0 = loader.getDouble("Y0"); double nY1 = loader.getDouble("Y1"); plotCntrl.setBounds(nX0, nX1, nY0, nY1); plotCntrl.param1 = loader.getDouble("param1"); plotCntrl.param2 = loader.getDouble("param2"); plotCntrl.param3 = loader.getDouble("param3", true); plotCntrl.param4 = loader.getDouble("param4", true); plotCntrl.paramSettle = loader.getInt("paramSettle"); plotCntrl.paramTotalIters = loader.getInt("paramTotalIters"); //these are transformed, so set the ui instead of the prop. Call to Redraw will retrieve this. txtExpression.Text = loader.getString("paramExpression"); txtInit.Text = loader.getString("paramInit"); } catch (IniFileParsingException err) { MessageBox.Show("Prefs Error:"+err.ToString()); return; } //set ui double p1 = plotCntrl.param1; double p2 = plotCntrl.param2; double p3 = plotCntrl.param3; double p4 = plotCntrl.param4; int npoints = plotCntrl.paramTotalIters; int nsettle = plotCntrl.paramSettle; setSliderToValue(npoints, tbTotalPoints, lblTotalPoints); setSliderToValue(nsettle, tbSettling, lblSettling); setSliderToValue(p1, tbParam1, lblParam1); setSliderToValue(p2, tbParam2, lblParam2); setSliderToValue(p3, tbParam3, lblParam3); setSliderToValue(p4, tbParam4, lblParam4); Redraw(); }