本文整理汇总了C#中System.Xml.Serialization.CodeIdentifiers.MakeRightCase方法的典型用法代码示例。如果您正苦于以下问题:C# CodeIdentifiers.MakeRightCase方法的具体用法?C# CodeIdentifiers.MakeRightCase怎么用?C# CodeIdentifiers.MakeRightCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Serialization.CodeIdentifiers
的用法示例。
在下文中一共展示了CodeIdentifiers.MakeRightCase方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IgnoreCase
public void IgnoreCase ()
{
CodeIdentifiers c = new CodeIdentifiers (false);
c.Add ("test", "x");
c.Add ("Test", "y");
Assert.IsTrue ("test" != c.AddUnique ("Test", "z"), "#1");
Assert.IsTrue (c.IsInUse ("tEsT"), "#2");
Assert.AreEqual ("camelCase", c.MakeRightCase ("CAMELCASE"), "#3");
}
示例2: ImportTextMember
void ImportTextMember(CodeIdentifiers members, XmlQualifiedName simpleContentType) {
TypeMapping mapping;
bool isMixed = false;
if (simpleContentType != null) {
mapping = ImportType(simpleContentType, typeof(TypeMapping), null);
if (!(mapping is PrimitiveMapping || mapping.TypeDesc.CanBeTextValue)) {
return;
}
}
else {
// this is a case of the mixed content type, just generate string typeDesc
isMixed = true;
mapping = new PrimitiveMapping();
mapping.TypeDesc = scope.GetTypeDesc(typeof(string));
mapping.TypeName = mapping.TypeDesc.DataType.Name;
}
TextAccessor accessor = new TextAccessor();
accessor.Mapping = mapping;
MemberMapping member = new MemberMapping();
member.Elements = new ElementAccessor[0];
member.Text = accessor;
if (isMixed) {
// just generate code for the standard mixed case (string[] text)
member.TypeDesc = accessor.Mapping.TypeDesc.CreateArrayTypeDesc();
member.Name = members.MakeRightCase("Text");
}
else {
// import mapping for the simpleContent
PrimitiveMapping pm = (PrimitiveMapping)accessor.Mapping;
if (pm.IsList) {
member.TypeDesc = accessor.Mapping.TypeDesc.CreateArrayTypeDesc();
member.Name = members.MakeRightCase("Text");
}
else {
member.TypeDesc = accessor.Mapping.TypeDesc;
member.Name = members.MakeRightCase("Value");
}
}
member.Name = members.AddUnique(member.Name, member);
}
示例3: ImportAnyMember
void ImportAnyMember(XmlSchemaAny any, string identifier, CodeIdentifiers members, string ns, bool mixed) {
ElementAccessor accessor = ImportAny(any, !mixed);
accessor.Name = identifier;
accessor.Namespace = ns;
MemberMapping member = new MemberMapping();
member.Elements = new ElementAccessor[] { accessor };
member.Name = members.MakeRightCase("Any");
member.Name = members.AddUnique(member.Name, member);
member.TypeDesc = ((TypeMapping)accessor.Mapping).TypeDesc;
bool repeats = any.IsMultipleOccurrence;
if (mixed) {
SpecialMapping textMapping = new SpecialMapping();
textMapping.TypeDesc = scope.GetTypeDesc(typeof(XmlNode));
textMapping.TypeName = textMapping.TypeDesc.Name;
member.TypeDesc = textMapping.TypeDesc;
TextAccessor text = new TextAccessor();
text.Mapping = textMapping;
member.Text = text;
repeats = true;
}
if (repeats) {
member.TypeDesc = member.TypeDesc.CreateArrayTypeDesc();
}
}
示例4: ImportAnyAttributeMember
void ImportAnyAttributeMember(XmlSchemaAnyAttribute any, CodeIdentifiers members) {
SpecialMapping mapping = new SpecialMapping();
mapping.TypeDesc = scope.GetTypeDesc(typeof(XmlAttribute));
mapping.TypeName = mapping.TypeDesc.Name;
AttributeAccessor accessor = new AttributeAccessor();
accessor.Any = true;
accessor.Mapping = mapping;
MemberMapping member = new MemberMapping();
member.Elements = new ElementAccessor[0];
member.Attribute = accessor;
member.Name = members.MakeRightCase("AnyAttr");
member.Name = members.AddUnique(member.Name, member);
member.TypeDesc = ((TypeMapping)accessor.Mapping).TypeDesc;
member.TypeDesc = member.TypeDesc.CreateArrayTypeDesc();
}
示例5: ImportAnyMember
private MemberMapping ImportAnyMember(XmlSchemaAny any, string identifier, CodeIdentifiers members, CodeIdentifiers membersScope, INameScope elementsScope, string ns, ref bool mixed, ref bool needExplicitOrder, bool allowDuplicates)
{
ElementAccessor[] accessors = ImportAny(any, !mixed, ns);
AddScopeElements(elementsScope, accessors, ref needExplicitOrder, allowDuplicates);
MemberMapping member = new MemberMapping();
member.Elements = accessors;
member.Name = membersScope.MakeRightCase("Any");
member.Name = membersScope.AddUnique(member.Name, member);
members.Add(member.Name, member);
member.TypeDesc = ((TypeMapping)accessors[0].Mapping).TypeDesc;
bool repeats = any.IsMultipleOccurrence;
if (mixed)
{
SpecialMapping textMapping = new SpecialMapping();
textMapping.TypeDesc = Scope.GetTypeDesc(typeof(XmlNode));
textMapping.TypeName = textMapping.TypeDesc.Name;
member.TypeDesc = textMapping.TypeDesc;
TextAccessor text = new TextAccessor();
text.Mapping = textMapping;
member.Text = text;
repeats = true;
mixed = false;
}
if (repeats)
{
member.TypeDesc = member.TypeDesc.CreateArrayTypeDesc();
}
return member;
}
示例6: ImportAnyMember
private MemberMapping ImportAnyMember(XmlSchemaAny any, string identifier, CodeIdentifiers members, CodeIdentifiers membersScope, INameScope elementsScope, string ns, ref bool mixed, ref bool needExplicitOrder, bool allowDuplicates)
{
MemberMapping mapping;
ElementAccessor[] elements = this.ImportAny(any, !mixed, ns);
this.AddScopeElements(elementsScope, elements, ref needExplicitOrder, allowDuplicates);
mapping = new MemberMapping {
Elements = elements,
Name = membersScope.MakeRightCase("Any"),
Name = membersScope.AddUnique(mapping.Name, mapping)
};
members.Add(mapping.Name, mapping);
mapping.TypeDesc = elements[0].Mapping.TypeDesc;
bool isMultipleOccurrence = any.IsMultipleOccurrence;
if (mixed)
{
SpecialMapping mapping2;
mapping2 = new SpecialMapping {
TypeDesc = base.Scope.GetTypeDesc(typeof(XmlNode)),
TypeName = mapping2.TypeDesc.Name
};
mapping.TypeDesc = mapping2.TypeDesc;
TextAccessor accessor = new TextAccessor {
Mapping = mapping2
};
mapping.Text = accessor;
isMultipleOccurrence = true;
mixed = false;
}
if (isMultipleOccurrence)
{
mapping.TypeDesc = mapping.TypeDesc.CreateArrayTypeDesc();
}
return mapping;
}
示例7: ImportAnyAttributeMember
private void ImportAnyAttributeMember(XmlSchemaAnyAttribute any, CodeIdentifiers members, CodeIdentifiers membersScope)
{
SpecialMapping mapping;
MemberMapping mapping2;
mapping = new SpecialMapping {
TypeDesc = base.Scope.GetTypeDesc(typeof(XmlAttribute)),
TypeName = mapping.TypeDesc.Name
};
AttributeAccessor accessor = new AttributeAccessor {
Any = true,
Mapping = mapping
};
mapping2 = new MemberMapping {
Elements = new ElementAccessor[0],
Attribute = accessor,
Name = membersScope.MakeRightCase("AnyAttr"),
Name = membersScope.AddUnique(mapping2.Name, mapping2)
};
members.Add(mapping2.Name, mapping2);
mapping2.TypeDesc = accessor.Mapping.TypeDesc;
mapping2.TypeDesc = mapping2.TypeDesc.CreateArrayTypeDesc();
}
示例8: ImportTextMember
private void ImportTextMember(CodeIdentifiers members, CodeIdentifiers membersScope, XmlQualifiedName simpleContentType)
{
TypeMapping defaultMapping;
bool flag = false;
if (simpleContentType != null)
{
defaultMapping = this.ImportType(simpleContentType, typeof(TypeMapping), null, TypeFlags.CanBeElementValue | TypeFlags.CanBeTextValue, false);
if (!(defaultMapping is PrimitiveMapping) && !defaultMapping.TypeDesc.CanBeTextValue)
{
return;
}
}
else
{
flag = true;
defaultMapping = this.GetDefaultMapping(TypeFlags.CanBeElementValue | TypeFlags.CanBeTextValue);
}
TextAccessor accessor = new TextAccessor {
Mapping = defaultMapping
};
MemberMapping mapping2 = new MemberMapping {
Elements = new ElementAccessor[0],
Text = accessor
};
if (flag)
{
mapping2.TypeDesc = accessor.Mapping.TypeDesc.CreateArrayTypeDesc();
mapping2.Name = members.MakeRightCase("Text");
}
else
{
PrimitiveMapping mapping = (PrimitiveMapping) accessor.Mapping;
if (mapping.IsList)
{
mapping2.TypeDesc = accessor.Mapping.TypeDesc.CreateArrayTypeDesc();
mapping2.Name = members.MakeRightCase("Text");
}
else
{
mapping2.TypeDesc = accessor.Mapping.TypeDesc;
mapping2.Name = members.MakeRightCase("Value");
}
}
mapping2.Name = membersScope.AddUnique(mapping2.Name, mapping2);
members.Add(mapping2.Name, mapping2);
}