public void Merge(SectionDataCollection sectionsToMerge)
        {
            foreach (var sectionDataToMerge in sectionsToMerge)
            {
                var sectionDataInThis = GetSectionData(sectionDataToMerge.SectionName);

                if (sectionDataInThis == null)
                {
                    AddSection(sectionDataToMerge.SectionName);
                }

                this[sectionDataToMerge.SectionName].Merge(sectionDataToMerge.Keys);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 ///     Initializes a new IniData instance using a previous
 ///     <see cref="SectionDataCollection"/>.
 /// </summary>
 /// <param name="sdc">
 ///     <see cref="SectionDataCollection"/> object containing the
 ///     data with the sections of the file
 /// </param>
 public IniData(SectionDataCollection sdc)
 {
     _sections           = (SectionDataCollection)sdc.Clone();
     Global              = new KeyDataCollection();
     SectionKeySeparator = '.';
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new IniData instance using a previous
 /// <see cref="SectionDataCollection"/>.
 /// </summary>
 /// <param name="sdc">
 /// <see cref="SectionDataCollection"/> object containing the
 /// data with the sections of the file</param>
 public IniData(SectionDataCollection sdc)
 {
     _sections = (SectionDataCollection)sdc.Clone();
     Global    = new KeyDataCollection();
 }
Ejemplo n.º 4
0
 /// <summary>
 ///     Initializes a new IniData instance using a previous
 ///     <see cref="SectionDataCollection" />.
 /// </summary>
 /// <param name="sdc">
 ///     <see cref="SectionDataCollection" /> object containing the
 ///     data with the sections of the file
 /// </param>
 public IniDataCaseInsensitive(SectionDataCollection sdc)
     : base(new SectionDataCollection(sdc, StringComparer.OrdinalIgnoreCase))
 {
     Global = new KeyDataCollection(StringComparer.OrdinalIgnoreCase);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SectionDataCollection"/> class
        /// from a previous instance of <see cref="SectionDataCollection"/>.
        /// </summary>
        /// <remarks>
        /// Data is deeply copied
        /// </remarks>
        /// <param name="ori">
        /// The instance of the <see cref="SectionDataCollection"/> class
        /// used to create the new instance.</param>
        /// <param name="searchComparer">
        ///     Search comparer used to find the key by name in the collection
        /// </param>
        public SectionDataCollection(SectionDataCollection ori, IEqualityComparer <string> searchComparer)
        {
            _searchComparer = searchComparer ?? EqualityComparer <string> .Default;

            _sectionData = new Dictionary <string, SectionData> (ori._sectionData, _searchComparer);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SectionDataCollection"/> class
 /// from a previous instance of <see cref="SectionDataCollection"/>.
 /// </summary>
 /// <remarks>
 /// Data is deeply copied
 /// </remarks>
 /// <param name="ori">
 /// The instance of the <see cref="SectionDataCollection"/> class
 /// used to create the new instance.</param>
 public SectionDataCollection(SectionDataCollection ori)
 {
     _sectionData = new Dictionary <string, SectionData> (ori._sectionData);
 }