public void ReadObjectNodes(XmlDocument doc, MainWindow win) { XmlNodeList objectNodeList = doc.SelectNodes("//object"); foreach (XmlNode objectNode in objectNodeList) { ObjectDef def = new ObjectDef(); def.Setup(); ReadObjectCoreData(objectNode, ref def, win); ReadObjectNames(objectNode, ref def); if (def.useRandomTextSelection == true) { ReadObjectRandomTextData(objectNode, ref def); } else { ReadObjectTextData(objectNode, ref def); } if (def.useRandomImageSelection == true) { ReadObjectRandomImageData(objectNode, ref def); } else { ReadObjectOnImages(objectNode, ref def); ReadObjectOffImages(objectNode, ref def); } def.PostLoad(); objectList.Add(def); } }