public static int Main(string[] args) { Console.WriteLine( (Utils.IsRunningOnMono() ? "Mono" : ".Net Core") + " OPC UA Console Server sample"); // command line options bool showHelp = false; int stopTimeout = 0; bool autoAccept = false; string reverseConnectUrlString = null; Uri reverseConnectUrl = null; Mono.Options.OptionSet options = new Mono.Options.OptionSet { { "h|help", "show this message and exit", h => showHelp = h != null }, { "a|autoaccept", "auto accept certificates (for testing only)", a => autoAccept = a != null }, { "t|timeout=", "the number of seconds until the server stops.", (int t) => stopTimeout = t }, { "r|reverse=", "a url for a reverse connection", (string r) => reverseConnectUrlString = r } }; try { IList <string> extraArgs = options.Parse(args); foreach (string extraArg in extraArgs) { Console.WriteLine("Error: Unknown option: {0}", extraArg); showHelp = true; } if (reverseConnectUrlString != null) { reverseConnectUrl = new Uri(reverseConnectUrlString); } } catch (OptionException e) { Console.WriteLine(e.Message); showHelp = true; } if (showHelp) { Console.WriteLine(Utils.IsRunningOnMono() ? "Usage: mono NetCoreConsoleServer.exe [OPTIONS]" : "Usage: dotnet NetCoreConsoleServer.dll [OPTIONS]"); Console.WriteLine(); Console.WriteLine("Options:"); options.WriteOptionDescriptions(Console.Out); return((int)ExitCode.ErrorInvalidCommandLine); } MySampleServer server = new MySampleServer(autoAccept, stopTimeout, reverseConnectUrl); server.Run(); return((int)MySampleServer.ExitCode); }
public static void Main(string[] args) { MySampleServer server = new MySampleServer(); server.Start(); }
public static void Main(string[] args) { MySampleServer server = new MySampleServer(); server.Start(); }