コード例 #1
0
ファイル: frmAlgSettings.cs プロジェクト: artifact113/matsps
        private void SaveGAParametersToIni(string _pathToIni)
        {
            matsps.Parameters.Ini.IniFile ini = new matsps.Parameters.Ini.IniFile(_pathToIni);
            // ini.IniWriteValue("files", "openPath", _openPath);
            // ini.IniWriteValue("files", "saveToExcelPath", _saveToExcelPath);

            ini.IniWriteValue("count", "generations", this.txbGenCout.Text);
            ini.IniWriteValue("count", "agents", this.txbAgentsCount.Text);
            ini.IniWriteValue("count", "survivers", this.txbSurviversCount.Text);

            ini.IniWriteValue("percent", "mutations", this.txbMutationsPecent.Text);

            ini.IniWriteValue("probability", "cityswitch", this.txbCitySwitchMutation.Text);
            ini.IniWriteValue("probability", "isolatedchain", this.txbIsolatedChainMutation.Text);
            ini.IniWriteValue("probability", "newagent", this.txbNewAgentMutation.Text);


            // ini.IniWriteValue("form", "height", this.Height.ToString());
            // ini.IniWriteValue("form", "dgvFileHeight", splitContainer1.Panel1.Height.ToString());
        }
コード例 #2
0
ファイル: frmAlgSettings.cs プロジェクト: artifact113/matsps
        private void LoadGAParametersFromIni(string _pathToIni)
        {
            // Настройки
            matsps.Parameters.Ini.IniFile ini = new matsps.Parameters.Ini.IniFile(_pathToIni);

            string sGenCount, sAgentsCount, sSurviversCount;

            sGenCount       = ini.IniReadValue("count", "generations");
            sAgentsCount    = ini.IniReadValue("count", "agents");
            sSurviversCount = ini.IniReadValue("count", "survivers");

            if (sGenCount != "")
            {
                try
                {
                    this.txbGenCout.Text = (sGenCount);
                }
                catch { }
            }
            if (sAgentsCount != "")
            {
                try
                {
                    this.txbAgentsCount.Text = (sAgentsCount);
                }
                catch { }
            }
            if (sSurviversCount != "")
            {
                try
                {
                    this.txbSurviversCount.Text = (sSurviversCount);
                }
                catch { }
            }

            string sMutationsPecent;

            sMutationsPecent = ini.IniReadValue("percent", "mutations");

            if (sMutationsPecent != "")
            {
                try
                {
                    this.txbMutationsPecent.Text = (sMutationsPecent);
                }
                catch { }
            }

            string sCitySwitch, sIsolatedChain, sNewAgent;

            sCitySwitch    = ini.IniReadValue("probability", "cityswitch");
            sIsolatedChain = ini.IniReadValue("probability", "isolatedchain");
            sNewAgent      = ini.IniReadValue("probability", "newagent");
            if (sCitySwitch != "")
            {
                try
                {
                    int iCitySwitch;
                    Int32.TryParse(sCitySwitch, out iCitySwitch);

                    this.txbCitySwitchMutation.Text = (sCitySwitch);
                    this.tbCitySwitchMutation.Value = iCitySwitch * 10;
                }
                catch { }
            }
            if (sIsolatedChain != "")
            {
                try
                {
                    int iIsolatedChain;
                    Int32.TryParse(sIsolatedChain, out iIsolatedChain);

                    this.txbIsolatedChainMutation.Text = (sIsolatedChain);
                    this.tbIsolatedChainMutation.Value = iIsolatedChain * 10;
                }
                catch { }
            }
            if (sNewAgent != "")
            {
                try
                {
                    int iNewAgent;
                    Int32.TryParse(sNewAgent, out iNewAgent);

                    this.txbNewAgentMutation.Text = (sNewAgent);
                    this.tbNewAgentMutation.Value = iNewAgent * 10;
                }
                catch { }
            }
            //if (strHeight != "")
            //    try
            //    {
            //        this.Height = Convert.ToInt32(strHeight);
            //    }
            //    catch { }
            //if (strDgvFileHeight != "")
            //    try
            //    {
            //        splitContainer1.Panel1.Height = Convert.ToInt32(strDgvFileHeight);
            //    }
            //    catch { }
        }