Example #1
0
        /// <summary>Crates a IniFileSectionStart object from name of a section.</summary>
        /// <param name="sectionName">Name of a section</param>
        public static IniFileSectionStart FromName(string sectionName)
        {
            IniFileSectionStart ret = new IniFileSectionStart();

            ret.SectionName = sectionName;
            ret.FormatDefault();
            return(ret);
        }
Example #2
0
        /// <summary>Creates a new IniFileSectionStart object basing on a name of section and the formatting style of this section.</summary>
        /// <param name="sectName">Name of the new section</param>
        public IniFileSectionStart CreateNew(string sectName)
        {
            IniFileSectionStart ret = new IniFileSectionStart();

            ret.sectionName = sectName;
            if (IniFileSettings.PreserveFormatting)
            {
                ret.formatting = formatting;
                ret.Format();
            }
            else
            {
                ret.Format();
            }
            return(ret);
        }
 internal IniFileSection(IniFile _parent, IniFileSectionStart sect)
 {
     sectionStart = sect;
     parent = _parent;
 }
 /// <summary>Parses a single line.</summary>
 /// <param name="line">Text to parse.</param>
 public static IniFileElement ParseLine(string line)
 {
     if (line == null)
         return null;
     if (line.Contains("\n"))
         throw new ArgumentException("String passed to the ParseLine method cannot contain more than one line.");
     string trim = line.Trim();
     IniFileElement elem = null;
     if (IniFileBlankLine.IsLineValid(trim))
         elem = new IniFileBlankLine(1);
     else if (IniFileCommentary.IsLineValid(line))
         elem = new IniFileCommentary(line);
     else if (IniFileSectionStart.IsLineValid(trim))
         elem = new IniFileSectionStart(line);
     else if (IniFileValue.IsLineValid(trim))
         elem = new IniFileValue(line);
     return elem ?? new IniFileElement(line);
 }
 /// <summary>Creates a new IniFileSectionStart object basing on a name of section and the formatting style of this section.</summary>
 /// <param name="sectName">Name of the new section</param>
 public IniFileSectionStart CreateNew(string sectName)
 {
     IniFileSectionStart ret = new IniFileSectionStart();
     ret.sectionName = sectName;
     if (IniFileSettings.PreserveFormatting)
     {
         ret.formatting = formatting;
         ret.Format();
     }
     else
         ret.Format();
     return ret;
 }
 /// <summary>Crates a IniFileSectionStart object from name of a section.</summary>
 /// <param name="sectionName">Name of a section</param>
 public static IniFileSectionStart FromName(string sectionName)
 {
     IniFileSectionStart ret = new IniFileSectionStart();
     ret.SectionName = sectionName;
     ret.FormatDefault();
     return ret;
 }