Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/tools/mono-xsd/NewMonoXSD.cs')
-rwxr-xr-xmcs/tools/mono-xsd/NewMonoXSD.cs45
1 files changed, 11 insertions, 34 deletions
diff --git a/mcs/tools/mono-xsd/NewMonoXSD.cs b/mcs/tools/mono-xsd/NewMonoXSD.cs
index 9c5628c9d00..0ba6ac69584 100755
--- a/mcs/tools/mono-xsd/NewMonoXSD.cs
+++ b/mcs/tools/mono-xsd/NewMonoXSD.cs
@@ -40,10 +40,8 @@ namespace Mono.Util {
" /e /element:NAME Element from schema to generate code for.\n" +
" Multiple elements can be specified.\n" +
" /u /uri:NAME Namespace uri of the elements to generate code for.\n" +
- " /l /language:NAME The language, or type name of custom CodeDomProvider\n" +
- " to use for the generated code.\n" +
- " Shorthand specifiers are: \"CS\" (C#) and \"VB\" (VB.NET).\n" +
- " For type name, assembly qualified name is required.\n" +
+ " /l /language:NAME The language to use for the generated code.\n" +
+ " Currently, the only supported language is CS (C#).\n" +
" /g /generator:TYPE Code Generator type name, followed by ','\n" +
" and assembly file name.\n" +
" /o /outputdir:PATH The directory where to generate the code or schemas.\n" +
@@ -112,11 +110,8 @@ namespace Mono.Util {
foreach (string arg in args)
{
- if (!arg.StartsWith ("--") && !arg.StartsWith ("/") ||
- (arg.StartsWith ("/") && arg.IndexOfAny (Path.InvalidPathChars) == -1)
- )
- {
- if ((arg.EndsWith (".dll") || arg.EndsWith (".exe")) && !arg.Substring (1).StartsWith ("generator:") && !arg.Substring (1).StartsWith ("g:"))
+ if (!arg.StartsWith ("--") && !arg.StartsWith ("/")) {
+ if (arg.EndsWith (".dll") || arg.EndsWith (".exe"))
{
if (!readingFiles) throw new Exception (incorrectOrder);
assemblies.Add (arg);
@@ -137,7 +132,7 @@ namespace Mono.Util {
inference = true;
continue;
}
- else if (!arg.StartsWith ("/"))
+ else //if (!arg.StartsWith ("/") && !arg.StartsWith ("-"))
{
if (!readingFiles) Error (incorrectOrder);
unknownFiles.Add (arg);
@@ -222,9 +217,6 @@ namespace Mono.Util {
if (outputDir == null) outputDir = ".";
- string typename = null;
- Type generatorType = null;
-
if (language != null) {
switch (language) {
case "CS":
@@ -234,20 +226,18 @@ namespace Mono.Util {
provider = new VBCodeProvider ();
break;
default:
- typename = StripQuot (language);
-
- generatorType = Type.GetType (typename);
- if (generatorType == null)
- Error (generatorTypeNotFound, typename);
+ Error (languageNotSupported, language);
break;
}
}
if (providerOption != null) {
string param = providerOption;
+ string typename;
+ Type generatorType;
int comma = param.IndexOf (',');
if (comma < 0) {
- typename = StripQuot (param);
+ typename = param;
generatorType = Type.GetType (param);
} else {
typename = param.Substring (0, comma);
@@ -263,16 +253,14 @@ namespace Mono.Util {
}
if (generatorType == null)
Error (generatorTypeNotFound, typename);
- }
- if (generatorType != null) {
if (!generatorType.IsSubclassOf (typeof (CodeDomProvider)))
Error (generatorTypeIsNotCodeGenerator, typename);
try {
provider = (CodeDomProvider) Activator.CreateInstance (generatorType, null);
} catch (Exception ex) {
- Error (generatorThrewException, generatorType.AssemblyQualifiedName.ToString () + " --> " + ex.Message);
+ Error (generatorThrewException, param);
}
- Console.WriteLine ("Loaded custom generator type " + generatorType + " .");
+ Console.WriteLine ("Loaded custom generator type " + param + " .");
}
if (provider == null)
provider = new CSharpCodeProvider ();
@@ -481,16 +469,5 @@ namespace Mono.Util {
{
throw new Exception (string.Format(msg,param));
}
-
- private string StripQuot (string input)
- {
- if (input.Length < 2)
- return input;
- if (input [0] == '"' && input [input.Length -1] == '"' ||
- input [0] == '\'' && input [input.Length - 1] == '\'')
- return input.Substring (1, input.Length - 2);
- else
- return language;
- }
}
}