Exemplo n.º 1
0
 private void btnDel_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtA2C.Text))
     {
         MessageBox.Show("请选择要删除的项");
         return;
     }
     iNIFile.DeleteSection(ModelIniPath, txtA2C.Text);
     A2Cs = ShowModelInfo(ModelIniPath, "");
 }
Exemplo n.º 2
0
        public virtual void SaveSection(string sectionNamePrefix, INIFile file)
        {
            if (string.IsNullOrWhiteSpace(sectionNamePrefix))
            {
                return;
            }

            foreach (var sectionName in file.ReadSections())
            {
                if (sectionName.IndexOf(sectionNamePrefix) == 0)
                {
                    file.DeleteSection(sectionName);
                }
            }

            int startCount = 1;

            foreach (var fileWriteSection in this)
            {
                var sectionName = string.Format("{0}{1}", sectionNamePrefix, startCount);
                startCount++;
                fileWriteSection.SaveSection(sectionName, file);
            }
        }