2 using System
.Collections
.Generic
;
3 using System
.Reflection
;
4 using System
.Runtime
.Serialization
;
8 [assembly
: AssemblyTitle ("Mono service contract conversion tool")]
9 [assembly
: AssemblyDescription ("")]
10 [assembly
: AssemblyVersion ("0.1.0")]
11 [assembly
: AssemblyCopyright ("Copyright (C) 2006 Novell, Inc.")]
13 namespace Mono
.ServiceContractTool
15 public enum OutputType
18 [EnumMember (Value
= "code")]
20 [EnumMember (Value
= "metadata")]
22 [EnumMember (Value
= "xmlSerializer")]
26 public class CommandLineOptions
28 public CommandLineOptions ()
30 options
= CreateOptions ();
33 public bool Help
, Usage
, Version
;
36 public OptionSet
CreateOptions ()
38 return new OptionSet
{
40 "Generate async methods.",
41 v
=> GenerateAsync
= v
!= null },
43 "Configuration file names to generate.",
44 v
=> ConfigFiles
.AddRange (v
.Split (',')) },
46 "Generate types as internal.",
47 v
=> GenerateTypesAsInternal
= v
!= null },
49 "Specify target code {LANGUAGE}. Default is 'csharp'.",
52 "Generate MonoTouch client. (This option may vanish)",
53 v
=> GenerateMonoTouchProxy
= v
!= null },
55 "Generate moonlight client. (This option may vanish)",
56 v
=> GenerateMoonlightProxy
= v
!= null },
58 "Code namespace name to generate.",
61 "Do not generate config file.",
62 v
=> NoConfig
= v
!= null },
64 "Do not show tool logo.",
65 v
=> NoLogo
= v
!= null },
67 "Output code filename.",
68 v
=> OutputFilename
= v
},
70 "Referenced assembly files.",
71 v
=> ReferencedAssemblies
.AddRange (v
.Split (',')) },
72 { "tcv|targetClientVersion:",
73 "Indicate target client version. Valid values:\n" +
78 switch (v
.ToLowerInvariant ()) {
80 TargetClientVersion35
= true;
85 "Generate typed messages.",
86 v
=> GenerateTypedMessages
= v
!= null },
88 "Show usage syntax and exit.",
89 v
=> Usage
= v
!= null },
91 "Display version and licensing information.",
92 v
=> Version
= v
!= null },
94 "Show this help list.",
95 v
=> Help
= v
!= null },
99 public void ProcessArgs (string[] args
)
101 RemainingArguments
= options
.Parse (args
);
104 public void DoHelp ()
107 Console
.WriteLine ();
109 Console
.WriteLine ("Options:");
110 options
.WriteOptionDescriptions (Console
.Out
);
111 Console
.WriteLine ();
112 Console
.WriteLine ("metadataPath : ws-mex file path.");
113 Console
.WriteLine ("metadataUrl: URL to ws-mex");
114 Console
.WriteLine ("assemblyPath: path to an assembly");
117 public void DoUsage ()
119 Console
.WriteLine ("Usage: svcutil [options] [metadataPath* | metadataUrl* | assemblyPath*]");
122 public void DoVersion ()
127 public void ShowBanner ()
129 Console
.WriteLine ("Mono service contract conversion tool {0} - Copyright (C) 2006 Novell, Inc.",
130 Assembly
.GetExecutingAssembly ().GetName ().Version
);
133 public List
<string> RemainingArguments
;
135 //[Option ("Target directory to create files", 'd', "directory")]
136 public string TargetDirectory
;
138 public string OutputFilename
;
140 //[Option ("Target output type", 't', "target")]
141 public OutputType OutputType
= OutputType
.Code
;
143 //[Option ("Validate all service endpoints", 'v', "validate")]
144 public bool Validate
;
146 public List
<string> ConfigFiles
= new List
<string> ();
149 public bool ChannelInterface
;
152 public bool GenerateProxy
;
154 public bool GenerateAsync
;
156 public bool GenerateTypedMessages
;
158 public bool TargetClientVersion35
;
160 bool generate_moonlight_proxy
, generate_monotouch_proxy
;
162 public bool GenerateMoonlightProxy
{
163 get { return generate_moonlight_proxy; }
167 generate_moonlight_proxy
= true;
168 GenerateAsync
= true;
172 public bool GenerateMonoTouchProxy
{
173 // this is a hack. It does not differentiate from GenerateMoonlightProxy on getter.
174 get { return generate_monotouch_proxy; }
178 GenerateMoonlightProxy
= true;
179 generate_monotouch_proxy
= true;
183 public bool GenerateTypesAsInternal
;
185 public bool NoConfig
;
187 public string Language
= "csharp";
189 public string Namespace
= String
.Empty
;
191 public List
<string> ReferencedAssemblies
= new List
<string> ();