mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 17:10:20 -10:00
* TypeTranslator.cs: Added support for more primitive types. Added GetDefaultPrimitiveTypeData, which returns the type data to which a clr type maps by default. * XmlCodeExporter.cs: Generate XmlRoot attribute only if root element name and ns are different from the type ns and name. Generate class and field comments. Fixed default attribute generation. In elements with ref attribute, it has to be generated in the referred attribute. * XmlReflectionImporter.cs: Added check: simple type extensions can't add new elements. Added suport for text nodes in members of type "any". * XmlSchemaExporter.cs: Several fixes. Fixed generation of complex types with simple content. * XmlSchemaImporter.cs: Several fixes. The importer now collects documentation info. * XmlSerializationWriter.cs: WriteNamespaceDeclarations(): do not declare namespaces that have already been declared. WriteStartElement(): elements from schema namespace are always written with ns prefix. * XmlTypeMapMember.cs: Added documentation property. * XmlTypeMapping.cs: Added documentation property. Added property to check if a class map represents a simple type. svn path=/trunk/mcs/; revision=17175
51 lines
1.0 KiB
C#
51 lines
1.0 KiB
C#
//
|
|
// System.Xml.Serialization.CodeIdentifier.cs
|
|
//
|
|
// Author:
|
|
// Tim Coleman ([email protected])
|
|
//
|
|
// Copyright (C) Tim Coleman, 2002
|
|
//
|
|
|
|
using System;
|
|
|
|
namespace System.Xml.Serialization {
|
|
public class CodeIdentifier {
|
|
|
|
public CodeIdentifier ()
|
|
{
|
|
}
|
|
|
|
public static string MakeCamel (string identifier)
|
|
{
|
|
string validIdentifier = MakeValid (identifier);
|
|
return (Char.ToLower (validIdentifier[0]) + validIdentifier.Substring (1));
|
|
}
|
|
|
|
public static string MakePascal (string identifier)
|
|
{
|
|
string validIdentifier = MakeValid (identifier);
|
|
return (Char.ToUpper (validIdentifier[0]) + validIdentifier.Substring (1));
|
|
}
|
|
|
|
public static string MakeValid (string identifier)
|
|
{
|
|
if (identifier == null)
|
|
throw new NullReferenceException ();
|
|
if (identifier.Length == 0)
|
|
return identifier;
|
|
|
|
string output = "";
|
|
|
|
if (!Char.IsLetter (identifier[0]) && (identifier[0]!='_') )
|
|
output = "Item";
|
|
|
|
foreach (char c in identifier)
|
|
if (Char.IsLetterOrDigit (c) || c == '_')
|
|
output += c;
|
|
|
|
return output;
|
|
}
|
|
}
|
|
}
|