internal ChoIniIncludeFileNode(ChoIniDocument ownerDocument, string filePath, ChoIniCommentNode inlineCommentNode, Stream stream = null) : base(ownerDocument) { ChoGuard.ArgumentNotNullOrEmpty(filePath, "Ini Include File Path"); _filePath = filePath; _inlineCommentNode = inlineCommentNode; ChoIniDocument iniDocument = OwnerDocument; while (true) { if (iniDocument == null) { break; } if (_filePath == iniDocument.Path) { throw new ChoIniDocumentException(String.Format("Can't include {0} document, it is already included in the include chain of documents.", _filePath)); } iniDocument = iniDocument.ParentIniDocument; } _iniDocument = new ChoIniDocument(_filePath, ownerDocument); }
internal ChoIniNameValueNode(ChoIniDocument ownerDocument, string name, string value, char nameValueSeperator, ChoIniCommentNode inlineCommentNode) : base(ownerDocument) { ChoGuard.ArgumentNotNullOrEmpty(name, "Name"); //Check for valid delimiter if (ownerDocument.NameValueSeperator != nameValueSeperator) { throw new ChoIniDocumentException(String.Format("Invalid NameValue Seperator [{0}] passed.", nameValueSeperator)); } _nameValueSeperator = nameValueSeperator; _name = name.Trim(); if (!ownerDocument.IgnoreValueWhiteSpaces) { _rawValue = value; } else { _rawValue = value != null?value.Trim() : null; } _inlineCommentNode = inlineCommentNode; NormalizeValue(); }
internal ChoIniSectionNode(ChoIniDocument ownerDocument, string name, ChoIniCommentNode inlineCommentNode) : base(ownerDocument) { ChoGuard.ArgumentNotNullOrEmpty(name, "Name"); _name = name != null?name.Trim() : null; _inlineCommentNode = inlineCommentNode; }
public ChoIniCommentNode AddInlineComment(string inlineComment) { ChoIniCommentNode inlineCommentNode = new ChoIniCommentNode(OwnerDocument, inlineComment); if (!OwnerDocument.OnNodeInserting(this, inlineCommentNode)) { OwnerDocument.Dirty = true; _inlineCommentNode = inlineCommentNode; OwnerDocument.OnNodeInserted(this, inlineCommentNode); } return(_inlineCommentNode); }
public ChoIniCommentNode AddInlineCommentNode(ChoIniCommentNode inlineCommentNode) { if (!OwnerDocument.OnNodeInserting(this, inlineCommentNode)) { OwnerDocument.Dirty = true; _inlineCommentNode = inlineCommentNode; OwnerDocument.OnNodeInserted(this, inlineCommentNode); return(_inlineCommentNode); } return(null); }
public ChoIniCommentNode GetCommentNode(string commentLine) { ChoIniCommentNode commentNode = null; if (TryGetCommentNode(commentLine, out commentNode)) { return(commentNode); } else { throw new ChoIniDocumentException(String.Format("Can't find comment node. [Comment: {0}]", commentLine)); } }
public bool ReplaceInlineComment(ChoIniCommentNode inlineCommentNode) { if (!OwnerDocument.OnNodeChanging(this, _inlineCommentNode, inlineCommentNode, ChoIniNodeChangedAction.ReplaceNode)) { OwnerDocument.Dirty = true; ChoIniCommentNode oldValue = _inlineCommentNode; _inlineCommentNode = inlineCommentNode; OwnerDocument.OnNodeChanged(this, oldValue, _inlineCommentNode, ChoIniNodeChangedAction.ReplaceNode); } else { return(false); } return(true); }
public bool RemoveInlineComment() { if (!OwnerDocument.OnNodeRemoving(this, _inlineCommentNode)) { OwnerDocument.Dirty = true; ChoIniCommentNode oldValue = _inlineCommentNode; _inlineCommentNode = null; OwnerDocument.OnNodeRemoved(this, oldValue); } else { return(false); } return(true); }
public bool TryGetCommentNode(string commentLine, out ChoIniCommentNode commentNode) { commentNode = null; foreach (ChoIniNode iniNode in _iniNodes) { if (!(iniNode is ChoIniCommentNode)) { continue; } if (((ChoIniCommentNode)iniNode).Value == commentLine) { commentNode = iniNode as ChoIniCommentNode; return(true); } } return(false); }
public bool ReplaceInlineComment(string inlineComment) { ChoIniCommentNode inlineCommentNode = new ChoIniCommentNode(OwnerDocument, inlineComment); if (!OwnerDocument.OnNodeChanging(this, _inlineCommentNode, inlineCommentNode, ChoIniNodeChangedAction.ReplaceNode)) { OwnerDocument.Dirty = true; object oldValue = _inlineCommentNode; _inlineCommentNode = inlineCommentNode; OwnerDocument.OnNodeChanged(this, oldValue, _inlineCommentNode, ChoIniNodeChangedAction.ReplaceNode); return(true); } else { return(false); } }
public bool ReplaceCommentNode(string origCommentLine, string newCommentLine) { ChoIniCommentNode newCommentNode = new ChoIniCommentNode(OwnerDocument, newCommentLine); ChoIniCommentNode commentNode = GetCommentNode(origCommentLine); if (!OwnerDocument.OnNodeChanging(this, commentNode, newCommentNode, ChoIniNodeChangedAction.ReplaceNode)) { OwnerDocument.Dirty = true; object oldValue = commentNode; commentNode.Value = newCommentLine; OwnerDocument.OnNodeChanged(this, oldValue, newCommentNode, ChoIniNodeChangedAction.ReplaceNode); return(true); } else { return(false); } }
public override void Clear() { OwnerDocument.Dirty = true; _iniNodes.Clear(); _inlineCommentNode = null; }
public bool RemoveCommentNode(string commentLine) { ChoIniCommentNode commentNode = GetCommentNode(commentLine); return(Remove(commentNode)); }
public ChoIniCommentNode AddCommentNode(string commentLine) { ChoIniCommentNode commentNode = new ChoIniCommentNode(OwnerDocument, commentLine); return(AddIniNode(commentNode) as ChoIniCommentNode); }
public ChoIniCommentNode CreateOrReplaceInlineCommentNode(ChoIniCommentNode inlineCommentNode) { _inlineCommentNode = inlineCommentNode; return(_inlineCommentNode); }
public void ReplaceInlineComment(ChoIniCommentNode InlineComment) { _inlineCommentNode = InlineComment; }
public void RemoveInlineComment() { _inlineCommentNode = null; }