private void StoreGuidInfoAndOwnership(XElement rt, ErrorLogger errorLogger)
{
Guid guid = new Guid(rt.Attribute("guid").Value);
if (m_guids.Contains(guid))
{
errorLogger(String.Format(Strings.ksObjectWithGuidAlreadyExists, guid), false);
m_dupGuidElements.Add(rt);
}
else
{
m_guids.Add(guid);
}
var objsurGuids = new HashSet<string>();
foreach (var objsur in rt.Descendants("objsur"))
{
XAttribute xaType = objsur.Attribute("t");
if (xaType == null || xaType.Value != "o")
continue;
XAttribute xaGuidObj = objsur.Attribute("guid");
Guid guidObj = new Guid(xaGuidObj.Value);
if (m_owners.ContainsKey(guidObj))
{
errorLogger(String.Format(Strings.ksObjectWithGuidAlreadyOwned, guidObj, guid), false);
m_dupOwnedElements.Add(objsur);
}
else
{
m_owners.Add(guidObj, guid);
}
objsurGuids.Add(objsur.Attribute("guid").Value);
}
//Now that all we have collected all the objects owned by the current rt element store it for later use.
//There is no need to store this information if the rt element does not own anything.
if (objsurGuids.Count > 0)
m_parentToOwnedObjsur.Add(rt.Attribute("guid").Value, objsurGuids);
}