本文整理汇总了C#中PropertyList.AddEntry方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyList.AddEntry方法的具体用法?C# PropertyList.AddEntry怎么用?C# PropertyList.AddEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyList
的用法示例。
在下文中一共展示了PropertyList.AddEntry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
//.........这里部分代码省略.........
string key = groupStartGroups["k"].Value;
string comment = groupStartGroups["c"].Value;
var newList = new PropertyList(key, comment);
newList.Parent = list;
list = newList;
previousValueEntry = null;
}
var keyValueGroups = keyValueRegex.Match(allText).Groups;
if (result == null && keyValueGroups["r"].Success)
{
result = keyValueGroups["r"].Value;
string key = keyValueGroups["k"].Value;
string value = keyValueGroups["v"].Value;
string comment = keyValueGroups["c"].Value;
newEntry = new PropertyEntry(key, value, comment);
previousValueEntry = newEntry;
}
var arrayValueGroups = arrayValueRegex.Match(allText).Groups;
if (result == null && arrayValueGroups["r"].Success)
{
result = arrayValueGroups["r"].Value;
string value = arrayValueGroups["v"].Value;
string comment = arrayValueGroups["c"].Value;
newEntry = new ArrayEntry(value, comment);
previousValueEntry = newEntry;
}
var concatGroups = concatRegex.Match(allText).Groups;
if (result == null && concatGroups["r"].Success)
{
if (previousValueEntry != null)
{
result = concatGroups["r"].Value;
string value = concatGroups["v"].Value;
string comment = concatGroups["c"].Value;
if (previousValueEntry is ConcatenatedEntry)
{
(previousValueEntry as ConcatenatedEntry).AddConcat(value, comment);
}
else
{
list.RemoveEntry(previousValueEntry);
newEntry = new ConcatenatedEntry(
previousValueEntry.Key,
new string[]{ previousValueEntry.StringValue, value },
new string[]{ previousValueEntry.Comment, comment });
newEntry.LineNumber = previousValueEntry.LineNumber;
previousValueEntry = newEntry;
}
}
}
var blockCommentGroups = blockCommentRegex.Match(allText).Groups;
if (result == null && blockCommentGroups["r"].Success)
{
result = blockCommentGroups["r"].Value;
string comment = blockCommentGroups["c"].Value;
newEntry = new BlockCommentEntry(comment);
}
var commentGroups = commentRegex.Match(allText).Groups;
if (result == null && commentGroups["r"].Success)
{
result = commentGroups["r"].Value;
string comment = commentGroups["c"].Value;
newEntry = new CommentEntry(comment);
}
var groupEndGroups = groupEndRegex.Match(allText).Groups;
if (result == null && groupEndGroups["r"].Success)
{
result = groupEndGroups["r"].Value;
string comment = groupEndGroups["c"].Value;
list.CloseComment = comment;
list = list.Parent;
previousValueEntry = null;
}
var newLineGroups = newLineRegex.Match(allText).Groups;
if (result == null && newLineGroups["r"].Success)
{
result = newLineGroups["r"].Value;
newEntry = new NewLineEntry();
}
var invalidGroups = invalidRegex.Match(allText).Groups;
if (result == null)
{
result = invalidGroups["r"].Value;
}
if (newEntry != null)
{
if (newEntry.LineNumber == 0)
newEntry.LineNumber = currentLineNumber;
newEntry.Loaded = !CommentUnloadedEntries;
list.AddEntry(newEntry);
}
currentLineNumber += Tools.Count('\n', result);
allText = allText.Remove(0, result.Length);
}
if (list.Parent != null)
throw new PropertyException("Missing closing curly brace.", list);
Properties = list.Root;
}
}