int Run (string[] args)
{
try
{
// parse command line arguments
foreach (string argument in args)
ImportArgument(argument);
if (noLogo == false)
Console.WriteLine(ProductId);
if (help || urls.Count == 0)
{
Console.WriteLine(UsageMessage);
return 0;
}
CodeCompileUnit codeUnit = new CodeCompileUnit();
CodeNamespace proxyCode = GetCodeNamespace();
codeUnit.Namespaces.Add (proxyCode);
WebReferenceCollection references = new WebReferenceCollection ();
DiscoveryClientProtocol dcc = CreateClient ();
foreach (string murl in urls)
{
string url = murl;
if (!url.StartsWith ("http://") && !url.StartsWith ("https://") && !url.StartsWith ("file://"))
url = new Uri (Path.GetFullPath (url)).ToString ();
dcc.DiscoverAny (url);
dcc.ResolveAll ();
}
WebReference reference = new WebReference (dcc.Documents, proxyCode, protocol, appSettingURLKey, appSettingBaseURL);
references.Add (reference);
if (sampleSoap != null)
ConsoleSampleGenerator.Generate (descriptions, schemas, sampleSoap, protocol);
if (sampleSoap != null)
return 0;
// generate the code
GenerateCode (references, codeUnit);
return 0;
}
catch (Exception exception)
{
Console.WriteLine("Error: {0}", exception.Message);
// Supress this except for when debug is enabled
Console.WriteLine("Stack:\n {0}", exception.StackTrace);
return 2;
}
}