private void ImportGroupMembers(XmlSchemaParticle particle, string identifier, CodeIdentifiers members, CodeIdentifiers membersScope, INameScope elementsScope, string ns, bool groupRepeats, ref bool mixed, ref bool needExplicitOrder, bool allowDuplicates, bool allowUnboundedElements)
{
if (particle is XmlSchemaGroupRef)
{
XmlSchemaGroupRef refGroup = (XmlSchemaGroupRef)particle;
if (!refGroup.RefName.IsEmpty)
{
AddReference(refGroup.RefName, GroupsInUse, SR.XmlCircularGroupReference);
ImportGroupMembers(FindGroup(refGroup.RefName).Particle, identifier, members, membersScope, elementsScope, refGroup.RefName.Namespace, groupRepeats | refGroup.IsMultipleOccurrence, ref mixed, ref needExplicitOrder, allowDuplicates, allowUnboundedElements);
RemoveReference(refGroup.RefName, GroupsInUse);
}
}
else if (particle is XmlSchemaGroupBase)
{
XmlSchemaGroupBase group = (XmlSchemaGroupBase)particle;
if (group.IsMultipleOccurrence)
groupRepeats = true;
if (GenerateOrder && groupRepeats && group.Items.Count > 1)
{
ImportChoiceGroup(group, identifier, members, membersScope, elementsScope, ns, groupRepeats, ref needExplicitOrder, allowDuplicates);
}
else
{
for (int i = 0; i < group.Items.Count; i++)
{
object item = group.Items[i];
if (item is XmlSchemaChoice)
ImportChoiceGroup((XmlSchemaGroupBase)item, identifier, members, membersScope, elementsScope, ns, groupRepeats, ref needExplicitOrder, allowDuplicates);
else if (item is XmlSchemaElement)
ImportElementMember((XmlSchemaElement)item, identifier, members, membersScope, elementsScope, ns, groupRepeats, ref needExplicitOrder, allowDuplicates, allowUnboundedElements);
else if (item is XmlSchemaAny)
{
ImportAnyMember((XmlSchemaAny)item, identifier, members, membersScope, elementsScope, ns, ref mixed, ref needExplicitOrder, allowDuplicates);
}
else if (item is XmlSchemaParticle)
{
ImportGroupMembers((XmlSchemaParticle)item, identifier, members, membersScope, elementsScope, ns, groupRepeats, ref mixed, ref needExplicitOrder, allowDuplicates, true);
}
}
}
}
}