public RunWithSeleniumHandler(
     IRepository repository,
     RouterOptions routerOptions)
 {
     this.repository    = repository;
     this.routerOptions = routerOptions;
 }
Example #2
0
 public void WithSeleniumBrowser(RouterOptions routerOptions)
 {
     kernel.Bind <JsonSerializer>().ToMethod(ctx =>
     {
         var serializer = new JsonSerializer();
         serializer.Converters.Add(new StringEnumConverter());
         serializer.Converters.Add(new IDConverter());
         return(serializer);
     }).InSingletonScope();
     kernel.Bind <RouterOptions>().ToConstant(routerOptions);
     kernel.Rebind <IBrowser>().To <SeleniumBrowser>().InNamedScope("user");
 }
Example #3
0
        /// <summary>
        /// Creates a process options instance
        /// </summary>
        /// <returns>The process options instance</returns>
        public override IProcessOptions CreateOptions()
        {
            var opts = new RouterOptions()
            {
                ProcessId = this.ProcessId
            };

            opts.PortNetworkMappings.AddRange(
                this.PortMappings.Select(mapping => new KeyValuePair <byte, ushort>(mapping.PortId, mapping.Network)));

            return(opts);
        }
Example #4
0
        public static void Main(string[] args)
        {
            /*
             * ForeignDevicePortOptions options = new ForeignDevicePortOptions()
             * {
             *  PortId = 1,
             *  BbmdHost = "<bbmd-ip-here>",
             *  BbmdPort = 47808,
             *  LocalHost = "0.0.0.0",
             *  LocalPort = 47808,
             *  RegistrationInterval = TimeSpan.FromSeconds(30)
             * };
             */

            EthernetPortOptions ethOptions = new EthernetPortOptions()
            {
                PortId = 1
            };

            PortManagerOptions portMgrOptions = new PortManagerOptions();
            RouterOptions      routerOpts     = new RouterOptions();

            routerOpts.PortNetworkMappings.Add(new KeyValuePair <byte, ushort>(1, 0));
            HostOptions         hostOpts   = new HostOptions();
            DeviceFinderOptions finderOpts = new DeviceFinderOptions();

            //using (ForeignDevicePort port = new ForeignDevicePort(options))
            using (EthernetPort port = new EthernetPort(ethOptions))
                using (PortManager manager = new PortManager(portMgrOptions))
                    using (Router router = new Router(routerOpts))
                        using (Host host = new Host(hostOpts))
                            using (DeviceFinder finder = new DeviceFinder(finderOpts))
                                using (Session session = new Session(port, manager, router, host, finder))
                                {
                                    var client = new BACnet.Client.Client(host);

                                    // as long as there is at least 1 new devices found every 10 seconds,
                                    // for each found device, read that devices name and print it to the console

                                    finder.Timeout(TimeSpan.FromSeconds(10))
                                    .Catch(Observable.Empty <DeviceTableEntry>())
                                    .ForEachAsync(entry =>
                                    {
                                        Console.WriteLine(entry.Instance);
                                    })
                                    .Wait();
                                }
        }
        /// <summary>
        /// Adds a listener
        /// </summary>
        /// <param name="target">Target output device</param>
        /// <param name="options">Filtration options</param>
        /// <param name="filterItems">Keywords to filter out (or include)</param>
        public void AddListener(IConsoleOutput target, RouterOptions options, IEnumerable <string> filterItems)
        {
            if (TargetsInternal.Where(i => i.Target == target).Count() > 0)
            {
                throw new ArgumentException(nameof(target), "This " + nameof(IConsoleOutput) + " is allready registered");
            }

            if (!options.HasFlag(RouterOptions.ReceivesErrors) && !options.HasFlag(RouterOptions.ReceivesWarnings) && !options.HasFlag(RouterOptions.ReceivesMessages))
            {
                throw new ArgumentException(nameof(options), "This listener has no target streams");
            }

            TargetsInternal.Add(new RouterItem()
            {
                Target = target, Options = options, ExcludedKeywords = filterItems.ToArray()
            });
        }
Example #6
0
        private static int RunRouter(RouterOptions options)
        {
            var root       = Path.GetFullPath(options.Root, Environment.CurrentDirectory);
            var outputRoot = Path.Combine(root, options.OutputDir);

            Directory.CreateDirectory(outputRoot);

            var builder = new RouterConfigBuilder(BuildServiceDiscoveryOptions(options, root), new NamingConventions(options.Name));

            var config       = builder.Build();
            var configString = JsonConvert.SerializeObject(config, Formatting.Indented, JsonMessage.Settings);

            var outputPath = Path.GetFullPath(options.Output, outputRoot);

            File.WriteAllText(outputPath, configString);

            return(0);
        }
Example #7
0
 public FormConverter(RouterOptions routerOptions)
 {
     this.routerOptions = routerOptions;
 }
 public PageInspector(RouterOptions routerOptions)
 {
     this.routerOptions = routerOptions;
 }
Example #9
0
 public PageGraphBuilder(RouterOptions routerOptions)
 {
     this.routerOptions = routerOptions;
 }
Example #10
0
 public PageConverter(RouterOptions routerOptions, RouteToUrl routeToUrl)
 {
     this.routerOptions = routerOptions;
     this.routeToUrl    = routeToUrl;
 }
Example #11
0
 public void WithSeleniumBrowser(RouterOptions routerOptions)
 {
     kernel.Bind <RouterOptions>().ToConstant(routerOptions);
     kernel.Rebind <IBrowser>().To <SeleniumBrowser>();
 }
Example #12
0
 public RouteToUrl(RouterOptions routerOptions)
 {
     this.routerOptions = routerOptions;
 }
Example #13
0
 public Tests_Id_Handler(RouterOptions routerOptions)
 {
     this.routerOptions = routerOptions;
 }
Example #14
0
 public PageConverter(RouterOptions routerOptions)
 {
     this.routerOptions = routerOptions;
 }
 public static bool HasFlag(this RouterOptions ro, RouterOptions flag)
 {
     return((ro & flag) == flag);
 }