private void saveIni(string sFilename)
        {
            IniFileParsing ifParsing = new IniFileParsing(sFilename, false); //creates ini if doesn't exist

            try
            {
                CsIniSaveHelper saver = new CsIniSaveHelper(ifParsing, "main_portrait"); //one section called "main_portrait"

                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.saveInt("paramTotalIters", plotCntrl.paramTotalIters);
                saver.saveString("paramExpression", txtExpression.Text);
                saver.saveString("paramInit", txtInit.Text);
                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;
 }
Ejemplo n.º 3
0
    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_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();
        }
 public CsIniSaveHelper(IniFileParsing csIniFile, string sSectionName)
 {
     this.csIniFile = csIniFile;
     this.sSectionName = sSectionName;
 }
Ejemplo n.º 6
0
 public CsIniSaveHelper(IniFileParsing csIniFile, string sSectionName)
 {
     this.csIniFile    = csIniFile;
     this.sSectionName = sSectionName;
 }