in src/StructuredLogger/BinaryLogger/BuildEventArgsReader.cs [1072:1152]
private IEnumerable ReadProjectItems()
{
IList<DictionaryEntry> list;
// starting with format version 10 project items are grouped by name
// so we only have to write the name once, and then the count of items
// with that name. When reading a legacy binlog we need to read the
// old style flat list where the name is duplicated for each item.
if (fileFormatVersion < 10)
{
int count = ReadInt32();
if (count == 0)
{
return null;
}
list = new DictionaryEntry[count];
for (int i = 0; i < count; i++)
{
string itemName = ReadString();
ITaskItem item = ReadTaskItem();
list[i] = new DictionaryEntry(itemName, item);
}
}
else if (fileFormatVersion < 12)
{
int count = ReadInt32();
if (count == 0)
{
return null;
}
list = new List<DictionaryEntry>();
for (int i = 0; i < count; i++)
{
string itemType = ReadDeduplicatedString();
var items = ReadTaskItemList();
if (items != null)
{
foreach (var item in items)
{
list.Add(new DictionaryEntry(itemType, item));
}
}
}
if (list.Count == 0)
{
list = null;
}
}
else
{
list = new List<DictionaryEntry>();
while (true)
{
string itemType = ReadDeduplicatedString();
if (string.IsNullOrEmpty(itemType))
{
break;
}
var items = ReadTaskItemList();
if (items != null)
{
foreach (var item in items)
{
list.Add(new DictionaryEntry(itemType, item));
}
}
}
if (list.Count == 0)
{
list = null;
}
}
return list;
}