private bool VerifyItem(IniItem item) { if (item == null) { throw new ArgumentNullException("item"); } if (item.ParentFile != this.parentFile) { throw new InvalidOperationException(); } if (item.ParentCollectionCore != null) { throw new InvalidOperationException(); } if (!this.VerifyItemName(item.Name)) { return(false); } item.ParentCollectionCore = this; return(true); }
internal IniItemCollection(IniFile parentFile, IniItem owner, IniDuplication duplication, bool caseSensitive) { this.caseSensitive = caseSensitive; this.duplication = duplication; this.parentFile = parentFile; this.owner = owner; this.items = new List <T>(); }
// Deep copy constructor. internal IniItem(IniFile parentFile, IniItem sourceItem) { if (parentFile == null) { throw new ArgumentNullException("parentFile"); } this.name = sourceItem.name; this.parentFile = parentFile; if (sourceItem.HasLeadingComment) { this.leadingComment = new IniComment(sourceItem.leadingComment); } if (sourceItem.HasTrailingComment) { this.trailingComment = new IniComment(sourceItem.trailingComment); } }
private void WriteItem(IniItem item, string itemContent) { if (item.HasTrailingComment) { this.WriteTrailingComment(item.TrailingComment); } if (item.HasLeadingComment) { this.WriteEmptyLines(item.LeadingComment.EmptyLinesBefore); } this.writer.Write(itemContent); if (item.HasLeadingComment) { this.WriteLeadingComment(item.LeadingComment); } else { this.writer.WriteLine(); } }