private static void Run(string[] args) { Arguments arguments; try { arguments = Arguments.Parse(args); } catch (Exception e) { throw new ArgumentException(string.Format("Error parsing arguments: {0}", e.Message), e); } string urlString = arguments.Url; if (urlString == null) throw new ArgumentException("Url to API has to be specified."); if (!urlString.StartsWith("http")) urlString = "http://" + urlString; var url = new Uri(urlString, UriKind.Absolute); string baseUrl = url.GetLeftPart(UriPartial.Authority); string apiPath = url.AbsolutePath; if (apiPath == "/") apiPath = "/w/api.php"; var wiki = new Wiki(baseUrl, apiPath, arguments.Namespace, arguments.PropsFile); wiki.AddAllModules(); wiki.AddAllQueryModules(); var result = wiki.Compile(arguments.OutputName, arguments.Directory); foreach (CompilerError error in result.Errors) Console.WriteLine(error); }
private static void Run(string[] args) { Arguments arguments; try { arguments = Arguments.Parse(args); } catch (Exception e) { throw new ArgumentException(string.Format("Error parsing arguments: {0}", e.Message), e); } string urlString = arguments.Url; if (urlString == null) { throw new ArgumentException("Url to API has to be specified."); } if (!urlString.StartsWith("http")) { urlString = "http://" + urlString; } var url = new Uri(urlString, UriKind.Absolute); string baseUrl = url.GetLeftPart(UriPartial.Authority); string apiPath = url.AbsolutePath; if (apiPath == "/") { apiPath = "/w/api.php"; } var wiki = new Wiki(baseUrl, apiPath, arguments.Namespace, arguments.PropsFile); wiki.AddAllModules(); wiki.AddAllQueryModules(); var result = wiki.Compile(arguments.OutputName, arguments.Directory); foreach (CompilerError error in result.Errors) { Console.WriteLine(error); } }