EnumMapping ImportEnumMapping(EnumModel model) {
SoapAttributes a = GetAttributes(model.Type);
string typeNs = defaultNs;
if (a.SoapType != null && a.SoapType.Namespace != null)
typeNs = a.SoapType.Namespace;
string typeName = XsdTypeName(model.Type, a, model.TypeDesc.Name);
typeName = XmlConvert.EncodeLocalName(typeName);
EnumMapping mapping = (EnumMapping)GetTypeMapping(typeName, typeNs, model.TypeDesc);
if (mapping == null) {
mapping = new EnumMapping();
mapping.IsSoap = true;
mapping.TypeDesc = model.TypeDesc;
mapping.TypeName = typeName;
mapping.Namespace = typeNs;
mapping.IsFlags = model.Type.IsDefined(typeof(FlagsAttribute), false);
typeScope.AddTypeMapping(mapping);
types.Add(typeName, typeNs, mapping);
ArrayList constants = new ArrayList();
for (int i = 0; i < model.Constants.Length; i++) {
ConstantMapping constant = ImportConstantMapping(model.Constants[i]);
if (constant != null) constants.Add(constant);
}
if (constants.Count == 0) {
throw new InvalidOperationException(Res.GetString(Res.XmlNoSerializableMembers, model.TypeDesc.FullName));
}
mapping.Constants = (ConstantMapping[])constants.ToArray(typeof(ConstantMapping));
}
return mapping;
}