Пример #1
0
        public VlcDriver(IVlcStarter starter = null, IPortAllocator allocator = null, IVlcLocator locator = null, ILogger logger = null)
        {
            this.logger = logger;
            this.logger = this.logger ?? LogManager.GetCurrentClassLogger();

            Starter = starter ?? new VlcStarter(this.logger);

            Locator = locator ?? new VlcLocator();

            var portAllocator = allocator ?? new PortAllocator(this.logger){ StartPort = Properties.Settings.Default.StartPort };

            container = new WindsorContainer();
            container.Register(Component.For<VlcAudioJob>().LifestyleTransient());
            container.Register(Component.For<VlcVideoJob>().LifestyleTransient());
            container.Register(Component.For<IAudioConfiguration>().ImplementedBy<AudioConfiguration>().LifestyleTransient());
            container.Register(Component.For<IVideoConfiguration>().ImplementedBy<VideoConfiguration>().LifestyleTransient());

            container.Register(Component.For<IPortAllocator>().Instance(portAllocator));
            container.Register(Component.For<ILogger>().Instance(this.logger));

            container.Register(Component.For<IStatusParser>().ImplementedBy<StatusParser>().LifestyleTransient());
            container.Register(Component.For<IVlcStatusSource>().ImplementedBy<HttpVlcStatusSource>().LifestyleTransient());
            container.Register(Component.For<ITimeSouce>().ImplementedBy<TimeSouce>().LifestyleTransient());

            LogCurrentAssemblyInfo();
        }
Пример #2
0
        public VlcDriver(IVlcStarter starter = null, IPortAllocator allocator = null, IVlcLocator locator = null, ILogger logger = null)
        {
            this.logger = logger;
            this.logger = this.logger ?? LogManager.GetCurrentClassLogger();

            Starter = starter ?? new VlcStarter(this.logger);

            Locator = locator ?? new VlcLocator();

            var portAllocator = allocator ?? new PortAllocator(this.logger)
            {
                StartPort = Properties.Settings.Default.StartPort
            };

            container = new WindsorContainer();
            container.Register(Component.For <VlcAudioJob>().LifestyleTransient());
            container.Register(Component.For <VlcVideoJob>().LifestyleTransient());
            container.Register(Component.For <IAudioConfiguration>().ImplementedBy <AudioConfiguration>().LifestyleTransient());
            container.Register(Component.For <IVideoConfiguration>().ImplementedBy <VideoConfiguration>().LifestyleTransient());

            container.Register(Component.For <IPortAllocator>().Instance(portAllocator));
            container.Register(Component.For <ILogger>().Instance(this.logger));

            container.Register(Component.For <IStatusParser>().ImplementedBy <StatusParser>().LifestyleTransient());
            container.Register(Component.For <IVlcStatusSource>().ImplementedBy <HttpVlcStatusSource>().LifestyleTransient());
            container.Register(Component.For <ITimeSouce>().ImplementedBy <TimeSouce>().LifestyleTransient());

            LogCurrentAssemblyInfo();
        }