Example #1
0
        public static void Merge([NotNull] this IniSection current, [NotNull] IniSection other, IniMergeOption options)
        {
            foreach (var otherEntry in other.Entries)
            {
                var currentEntry = current.GetEntry(otherEntry.GetName());

                if (currentEntry is null)
                {
                    current.Entries.Add(otherEntry);
                }
                else
                {
                    currentEntry.Merge(otherEntry, options);
                }
            }

            if ((options & IniMergeOption.OverwriteComments) != 0)
            {
                current.Comment.AddRange(other.Comment);
            }
        }
Example #2
0
        public static void Merge([NotNull] this IniEntry current, [NotNull] IniEntry other, IniMergeOption options)
        {
            if ((options & IniMergeOption.OverwriteValues) != 0)
            {
                current.Entry     = other.Entry;
                current.Start     = other.Start;
                current.Separator = other.Separator;
            }

            if ((options & IniMergeOption.OverwriteComments) != 0)
            {
                current.Comment.AddRange(other.Comment);
            }
        }
Example #3
0
        public static void Merge([NotNull] this IniFile current, [NotNull] IniFile other, IniMergeOption options)
        {
            foreach (var otherSection in other.Sections)
            {
                var currentSection = current.GetSection(otherSection.GetName());

                if (currentSection is null)
                {
                    current.Sections.Add(otherSection);
                }
                else
                {
                    currentSection.Merge(otherSection, options);
                }
            }

            if ((options & IniMergeOption.OverwriteComments) != 0)
            {
                current.EofComment.AddRange(other.EofComment);
            }
        }