Пример #1
0
        //
        //**********************************************************************************************
        //
        private void ReadIniFile()
        {
            TIniFile MyIni = new TIniFile(System.Windows.Forms.Application.ExecutablePath.ToLower().Replace(".exe", ".ini"));
              try
              {
            InitialMoistureFile = MyIni.IniReadValue("Excel", "Moisture");
            InitialPrecFile = MyIni.IniReadValue("Excel", "Precipitation");
            InitialIrrigFile = MyIni.IniReadValue("Excel", "Irrigation");

            InitialOutputDir = MyIni.IniReadValue("Output", "Dir");
            InitialIrrigPresent = MyIni.IniReadValue("Switch", "Irrigation").Trim().Equals("1");

            InitialPPTRequired = MyIni.IniReadValue("PowerPoint", "Required").Trim().Equals("1");
            InitialPPTFile = MyIni.IniReadValue("PowerPoint", "File");
              }
              catch (Exception e)
              {
            MessageBox.Show("Error in ini-file: " + e.Message);
              }
        }
Пример #2
0
        //
        //**********************************************************************************************
        //
        public void SaveToIniFile(String aMoistureFile, String aPrecipitationFile, String aIrrigationFile, 
      String aOutputDir, Boolean aIrrigationSwitch, Boolean aPPTSwitch, String aPPTFile)
        {
            TIniFile MyIni = new TIniFile(System.Windows.Forms.Application.ExecutablePath.ToLower().Replace(".exe", ".ini"));
              try
              {
            MyIni.IniWriteValue("Excel", "Moisture", aMoistureFile);
            MyIni.IniWriteValue("Excel", "Precipitation", aPrecipitationFile);
            MyIni.IniWriteValue("Excel", "Irrigation", aIrrigationFile);

            MyIni.IniWriteValue("Output", "Dir", aOutputDir);
            String MySwitch = "0";
            if (aIrrigationSwitch)
            {
              MySwitch = "1";
            }
            MyIni.IniWriteValue("Switch", "Irrigation", MySwitch);

            MySwitch = "0";
            if (aPPTSwitch)
            {
              MySwitch = "1";
            }
            MyIni.IniWriteValue("PowerPoint", "Required", MySwitch);
            MyIni.IniWriteValue("PowerPoint", "File", aPPTFile);
              }
              catch (Exception e)
              {
            MessageBox.Show("Error in ini-file: " + e.Message);
              }
        }