Example #1
0
        private static void Main(string[] args)
        {
            try
            {
                var options = new CommandLineOptions();
                if (!CommandLine.Parser.Default.ParseArguments(args, options))
                {
                    Environment.Exit(1);
                }

                var appName = typeof(Program).Assembly.GetName().Name;
                var versionInfo = string.Format("{0}, {1}", appName, new BuildInfo());

                if (options.Version)
                {
                    Console.WriteLine(versionInfo);
                    Environment.Exit(0);
                }

                if (options.LogPath != null)
                {
                    Logger.TargetFile(options.LogPath, options.Verbose);
                }
                else
                {
                    Logger.TargetConsole(options.Verbose);
                }

                Logger.Info(versionInfo);

                if (!ExitHandler.SetHandler(OnExitHandler))
                {
                    Logger.Warn("Colud not set OnExit cleanup handlers.");
                }

                var listeningPort = options.Port;
                AppLifetimeDisposables.Add(EmulatorFactory.Instance);
                listener = new Listener(listeningPort);
                Listener.UrnPrefix = options.UrlBase;

                Console.WriteLine("Starting {0} on port {1}\n", appName, listeningPort);

                listener.StartListening();
            }
            catch (Exception ex)
            {
                Logger.Fatal("Failed to start driver: {0}", ex);
                Environment.Exit(ex.HResult);
            }
        }
Example #2
0
        private static void Main(string[] args)
        {
            try
            {
                var options = new CommandLineOptions();
                CommandLine.Parser.Default.ParseArgumentsStrict(args, options);

                var appName = typeof(Program).Assembly.GetName().Name;
                var versionInfo = string.Format("{0}, {1}", appName, new BuildInfo());

                if (options.Version)
                {
                    Console.WriteLine(versionInfo);
                    Environment.Exit(0);
                }

                if (options.LogPath != null)
                {
                    Logger.TargetFile(options.LogPath, options.Verbose);
                }
                else
                {
                    Logger.TargetConsole(options.Verbose);
                }

                Capabilities.BoundDeviceName = options.BoundDeviceName;

                Logger.Info(versionInfo);

                if (!ExitHandler.SetHandler(OnExitHandler))
                {
                    Logger.Warn("Colud not set OnExit cleanup handlers.");
                }

                AppLifetimeDisposables.Add(EmulatorFactory.Instance);

                listener = new Listener(options.Port, options.UrlBase, options.NodeConfig);

                Console.WriteLine("Starting {0} on port {1}\n", appName, listener.Port);

                listener.StartListening();
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex.ToString());
                Environment.Exit(ex.HResult);
            }
        }
Example #3
0
        private static void Main(string[] args)
        {
            var listeningPort = 9999;

            var options = new CommandLineOptions();
            if (CommandLine.Parser.Default.ParseArguments(args, options))
            {
                if (options.Port.HasValue)
                {
                    listeningPort = options.Port.Value;
                }
            }

            if (options.LogPath != null)
            {
                Logger.TargetFile(options.LogPath, options.Verbose);
            }
            else
            {
                Logger.TargetConsole(options.Verbose);
            }

            try
            {
                var listener = new Listener(listeningPort);
                Listener.UrnPrefix = options.UrlBase;

                Console.WriteLine("Starting WindowsPhone Driver on port {0}\n", listeningPort);

                listener.StartListening();
            }
            catch (Exception ex)
            {
                Logger.Fatal("Failed to start driver: {0}", ex);
                throw;
            }
        }