本文整理汇总了C#中MonoDevelop.Core.Serialization.DataItem.UpdateFromItem方法的典型用法代码示例。如果您正苦于以下问题:C# DataItem.UpdateFromItem方法的具体用法?C# DataItem.UpdateFromItem怎么用?C# DataItem.UpdateFromItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoDevelop.Core.Serialization.DataItem
的用法示例。
在下文中一共展示了DataItem.UpdateFromItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateFromItem
internal void UpdateFromItem (DataItem item, HashSet<DataItem> removedItems)
{
var counter = new Dictionary<string, int> ();
foreach (var d in item.ItemData) {
DataNode current = null;
DataCollection col;
if (!counter.ContainsKey (d.Name))
counter [d.Name] = 0;
var index = ItemData.FindData (d.Name, out col, false, counter[d.Name]);
counter [d.Name]++;
if (index != -1) {
current = col [index];
}
if (current != null) {
if (d.IsDefaultValue || d is DataDeletedNode) {
if (current is DataItem)
removedItems.Add ((DataItem)current);
ItemData.Remove (current);
} else if (current.GetType () != d.GetType () || current is DataValue) {
var i = ItemData.IndexOf (current);
ItemData [i] = d;
if (current is DataItem)
removedItems.Add ((DataItem)current);
} else if (current is DataItem) {
((DataItem)current).UpdateFromItem ((DataItem)d, removedItems);
}
} else if (!d.IsDefaultValue && !(d is DataDeletedNode)) {
var dataItem = d as DataItem;
if (dataItem != null) {
var newDataItem = new DataItem () {
Name = d.Name,
UniqueNames = dataItem.UniqueNames
};
newDataItem.UpdateFromItem (dataItem, removedItems);
ItemData.Add (newDataItem);
} else {
ItemData.Add (d);
}
}
}
}