public ConnectionSentByVehicleEventHandler(
     IPingService pingService,
     ILogger <ConnectionSentByVehicleEventHandler> logger)
 {
     _pingService = pingService;
     _logger      = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Exemplo n.º 2
0
        public static ParamContainer CreateParamContainer(ILogger loggerController, IActionExecuter actionExecuter)
        {
            ILogReader         logReader         = Logger.GetLogReader();
            IAppSettingService appSettingService = AppSettingService.Instance;
            ParamContainer     paramContainer    = new ParamContainer();

            IDBService       dbService       = ApplicationConfig.DependencyResolver.GetInstance <IDBService>();
            IPingService     pingService     = ApplicationConfig.DependencyResolver.GetInstance <IPingService>();
            IViewEngine      viewEngine      = ApplicationConfig.DependencyResolver.GetInstance <IViewEngine>();
            IEncryption      encryption      = ApplicationConfig.DependencyResolver.GetInstance <IEncryption>();
            IKeyValueStorage keyValueStorage = ApplicationConfig.DependencyResolver.GetInstance <IKeyValueStorage>();

            ISMSService   smsService   = new SMSService(loggerController, dbService, actionExecuter, viewEngine, paramContainer);
            IEmailService emailService = new EmailService(loggerController, dbService, actionExecuter, viewEngine, paramContainer);
            IOTPService   otpService   = new OTPService(loggerController, dbService, smsService, emailService, appSettingService);

            paramContainer.AddKey(CommonConst.CommonValue.PARAM_DBPROXY, () => { return(dbService); });
            paramContainer.AddKey(CommonConst.CommonValue.PARAM_LOGGER, () => { return(loggerController); });
            paramContainer.AddKey(CommonConst.CommonValue.PARAM_ACTIONEXECUTER, () => { return(actionExecuter); });
            paramContainer.AddKey(CommonConst.CommonValue.PARAM_PING_SERVICE, () => { return(pingService); });
            paramContainer.AddKey(CommonConst.CommonValue.PARAM_PING_SERVICE, () => { return(pingService); });
            paramContainer.AddKey(CommonConst.CommonValue.PARAM_APP_SETTING, () => { return(appSettingService); });
            paramContainer.AddKey(CommonConst.CommonValue.PARAM_VIEW_ENGINE, () => { return(viewEngine); });
            paramContainer.AddKey(CommonConst.CommonValue.PARAM_OTP_SERVICE, () => { return(otpService); });
            paramContainer.AddKey(CommonConst.CommonValue.PARAM_SMS_SERVICE, () => { return(smsService); });
            paramContainer.AddKey(CommonConst.CommonValue.PARAM_EMAIL_SERVICE, () => { return(emailService); });
            paramContainer.AddKey(CommonConst.CommonValue.PARAM_ENCRYPTION_SERVICE, () => { return(encryption); });
            paramContainer.AddKey(CommonConst.CommonValue.PARAM_KEY_VALUE_STORAGE, () => { return(keyValueStorage); });
            paramContainer.AddKey(CommonConst.CommonValue.PARAM_HTTP_CLIENT, () => { return(new HttpRestClient()); });

            return(paramContainer);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommonNetworkServices"/> class.
 /// </summary>
 /// <param name="commonServices">The common services.</param>
 /// <param name="pingService">The ping service.</param>
 /// <param name="arpService">The arp service.</param>
 /// <exception cref="ArgumentNullException">
 /// commonServices
 /// or
 /// pingService
 /// or
 /// arpService
 /// </exception>
 /// <autogeneratedoc />
 public CommonNetworkServices(ICommonServices commonServices, IPingService pingService, IArpService arpService) :
     base(commonServices?.LoggerFactory)
 {
     CommonServices = commonServices ?? throw new ArgumentNullException(nameof(commonServices));
     PingService    = pingService ?? throw new ArgumentNullException(nameof(pingService));
     ArpService     = arpService ?? throw new ArgumentNullException(nameof(arpService));
 }
        public TelemetrySenderService()
        {
            this.Endpoints   = new List <string>();
            this.PingService = DependencyService.Resolve <IPingService>();

            ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
        }
Exemplo n.º 5
0
        public HomeModule(IPingService pingService)
        {
            _pingService = pingService;

            Get["/"] = _ =>
            {
                return("Hello from xedap629 DNS");
            };

            Get["/domain/{domain}/update/{ipAddresses}", true] = async(ctx, ct) =>
            {
                var domainName = ctx.domain;
                var clientIp   = Request.UserHostAddress + "," + ctx.ipAddresses;
                var result     = await _pingService.SetAsync(domainName, clientIp);

                return(result);
            };

            Get["/domain/{domain}/ip", true] = async(ctx, ct) =>
            {
                return(await _pingService.GetAsync((string)ctx.domain));
            };

            Get["/list", true] = async(ctx, ct) =>
            {
                return(await _pingService.ListAsync());
            };
        }
Exemplo n.º 6
0
        public MonitorService(IConnectionFailureService connectionFailureService, IPingService pingService,
			IWebImageService webImageService, IEventAggregator eventAggregator)
        {
            this.connectionFailureService = connectionFailureService;
            this.pingService = pingService;
            this.webImageService = webImageService;
            _eventAggregator = eventAggregator;
        }
Exemplo n.º 7
0
        public HttpsPingTask(IPingService pingService)
        {
            if (pingService == null)
            {
                throw new ArgumentNullException(nameof(pingService));
            }

            _pingService = pingService;
        }
        private void InitializeKeepAliveService(VoiceProfileViewModel viewModel)
        {
            var settings = new FormAppSettings
            {
                Host        = viewModel.IpAddress,
                PingEnabled = viewModel.PingEnabled,
            };

            this.pingService = new PingService(settings, this.progressCallback);
        }
Exemplo n.º 9
0
 private Installer(IPingService pingService, DataBuilderHelper dataBuilderHelper, ILogger logger, IDBService dbProxy, IEncryption encryptionService, IModuleInstaller moduleInstaller, IRoutings routing)
 {
     _pingService       = pingService;
     _dataBuilderHelper = dataBuilderHelper;
     _logger            = logger;
     _dbProxy           = dbProxy;
     _encryptionService = encryptionService;
     _moduleInstaller   = moduleInstaller;
     _routings          = routing;
     GetInstallStatus();
 }
Exemplo n.º 10
0
        private static async Task <IPingService> GetCaller(WampPlayground playground)
        {
            IWampChannel channel = playground.CreateNewChannel("realm1");

            await channel.Open();

            IPingService pingService =
                channel.RealmProxy.Services.GetCalleeProxy <IPingService>();

            return(pingService);
        }
Exemplo n.º 11
0
 public static IAppInstaller GetInstance(IPingService pingService, DataBuilderHelper dataBuilderHelper, ILogger logger, IDBService dbProxy, IEncryption encryptionService, IModuleInstaller moduleInstaller, IRoutings routing)
 {
     if (_appInstaller == null)
     {
         lock (lockObject)
         {
             _appInstaller = new Installer(pingService, dataBuilderHelper, logger, dbProxy, encryptionService, moduleInstaller, routing);
         }
     }
     return(_appInstaller);
 }
 public NodeServicesController(
     INodesServicesDataService data,
     IPingService pingService,
     IExecutablesManagerService execServices,
     IWebServiceLauncherService webServices,
     IErrorReportAssemblerService errAssembler
     ) : base(errAssembler)
 {
     _data         = data;
     _pingService  = pingService;
     _execServices = execServices;
     _webServices  = webServices;
 }
Exemplo n.º 13
0
        public ActionResult Ping()
        {
            BasicHttpBinding myBinding  = new BasicHttpBinding();
            EndpointAddress  myEndpoint = new EndpointAddress("http://localhost:51620/PingService.svc");
            ChannelFactory <IPingService> myChannelFactory = new ChannelFactory <IPingService>(myBinding, myEndpoint);

            IPingService instance = myChannelFactory.CreateChannel();
            // Call Service.
            object s = instance.Ping();

            myChannelFactory.Close();

            return(View(s));
        }
Exemplo n.º 14
0
        public async Task <IActionResult> GetPingAsync(int id, [FromServices] IPingService ping)
        {
            IActionResult badRequest = null;
            var           addr       = IPOrBadRequest(
                out badRequest,
                () => repo.GetNodeIPForPing(id)
                );

            if (badRequest != null)
            {
                return(badRequest);
            }
            return(Ok(await ping.TestConnectionAsync(addr, 4)));
        }
Exemplo n.º 15
0
        public DoorCheckService(IPingService pingService, IConfiguration configuration)
        {
            _pingService = pingService ?? throw new ArgumentNullException(nameof(pingService));
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            if (!TimeSpan.TryParse(configuration["Retry:Interval"], out _interval))
            {
                _interval = TimeSpan.FromSeconds(2);
            }
            if (!Int32.TryParse(configuration["Retry:Count"], out _retryCount))
            {
                _retryCount = 2;
            }
        }
Exemplo n.º 16
0
        public async Task RoundRobinPolicy()
        {
            WampPlayground playground = new WampPlayground();

            playground.Host.Open();

            IPingService pingService = await GetCaller(playground);

            List <int> calls = new List <int>();

            List <Registration> registrations =
                await RegisterCallees(playground, calls, 10, "roundrobin");

            for (int i = 0; i < 15; i++)
            {
                await pingService.PingAsync();
            }

            await registrations[0].DisposeAsync();
            await registrations[7].DisposeAsync();

            for (int i = 0; i < 15; i++)
            {
                await pingService.PingAsync();
            }

            List <int> modifiedIndexes =
                Enumerable.Range(0, 10).Where(x => x != 0 && x != 7).ToList();

            IEnumerable <int> expected =
                Enumerable.Range(0, 15)
                .Select(x => x % 10)
                .Concat(Enumerable.Range(15 % 10, 15)
                        .Select(x => x % 8)
                        .Select(x => modifiedIndexes[x]))
                .ToList();

            CollectionAssert.AreEquivalent(expected, calls);
        }
Exemplo n.º 17
0
        public async Task LastPolicyCallsLastCallee()
        {
            WampPlayground playground = new WampPlayground();

            playground.Host.Open();

            IPingService pingService = await GetCaller(playground);

            List <int> calls = new List <int>();

            List <Registration> registrations =
                await RegisterCallees(playground, calls, 10, "last");

            await pingService.PingAsync();

            await registrations[0].DisposeAsync();
            await pingService.PingAsync();

            await pingService.PingAsync();

            await registrations[9].DisposeAsync();
            await pingService.PingAsync();

            await registrations[1].DisposeAsync();
            await pingService.PingAsync();

            await registrations[8].DisposeAsync();
            await registrations[2].DisposeAsync();
            await pingService.PingAsync();

            await registrations[7].DisposeAsync();
            await registrations[3].DisposeAsync();
            await registrations[6].DisposeAsync();
            await registrations[4].DisposeAsync();
            await pingService.PingAsync();

            CollectionAssert.AreEquivalent(new[] { 9, 9, 9, 8, 8, 7, 5 }, calls);
        }
Exemplo n.º 18
0
 public ProgramViewmodel(IPingService pingService)
 {
     _pingService    = pingService;
     _messageSubject = new Subject <string>();
 }
Exemplo n.º 19
0
 public StatusBarViewModel(
     IPingService pingService)
 {
     _pingService = pingService;
 }
 public GetVehicleStatusQueryHandler(IPingService pingService)
 {
     _pingService = pingService;
 }
Exemplo n.º 21
0
        //

        public MainWindowViewModel(IPingService ping)
        {
            _ping = ping;
            Text  = string.Format(Template, "??");
            Main();
        }
Exemplo n.º 22
0
 public PingController(IPingService service)
 {
     this.service = service;
 }
 public CostsController(ICostsService costService, ILoggerManager logger, IPingService pingService) : base()
 {
     this.costService = costService;
     this.logger      = logger;
     this.pingService = pingService;
 }
Exemplo n.º 24
0
 public NetworkScannerService(IPingService pingService)
 {
     _pingService  = pingService;
     _foundDevices = new List <NetworkDeviceResponseDto>();
     _stopwatch    = new Stopwatch();
 }
Exemplo n.º 25
0
        public MainWindowViewmodel(IPingTimer pingTimer,
                                   IPingService pingService,
                                   IPingCollectionVectorFactory pingCollectionVectorFactory,
                                   IPingVectorFactory pingVectorFactory,
                                   IVectorComparer vectorComparer,
                                   IIpAddressService ipAddressService,
                                   IDispatcherAccessor dispatcherAccessor,
                                   PingStatsUtil pingStatsUtil,
                                   IPingResponseUtil pingResponseUtil)
        {
            _pingTimer   = pingTimer;
            _pingService = pingService;
            _pingCollectionVectorFactory = pingCollectionVectorFactory;
            _pingVectorFactory           = pingVectorFactory;
            _vectorComparer   = vectorComparer;
            _pingStatsUtil    = pingStatsUtil;
            _pingResponseUtil = pingResponseUtil;
            IObservable <long> pingTimerObservable      = _pingTimer.Start(() => false);
            IDisposable        pingResponseSubscription = null;

            _targetDatamodels = new ConcurrentDictionary <IPAddress, PingState>();
            _stats            = new ConcurrentDictionary <IPAddress, PingStats>();
            System.Windows.Threading.Dispatcher d = dispatcherAccessor.GetDispatcher();
            Subject <int> resortSubject           = new Subject <int>();

            ResortObservable = resortSubject;

            ipAddressService.IpAddressObservable.Subscribe(ipAddresses =>
            {
                pingResponseSubscription?.Dispose();
                IObservable <IEnumerable <Task <IPingResponse> > > pingResponseObservable =
                    pingTimerObservable.Select(l => _pingService.Ping(ipAddresses));
                pingResponseSubscription = pingResponseObservable.Subscribe(async pingResponseTasks =>
                {
                    IPingResponse[] responses = await Task.WhenAll(pingResponseTasks);
                    IVector[] vectors         = responses.Select(pingResponse =>
                    {
                        IPingStats stats   = GetUpdatedStats(pingResponse);
                        IVector pingVector = _pingVectorFactory.GetVector(pingResponse, stats);
                        if (_targetDatamodels.TryGetValue(pingResponse.TargetIpAddress, out PingState pingState))
                        {
                            TargetDatamodel targetDatamodelX = pingState.TargetDatamodel;
                            targetDatamodelX.RoundTripTime   = pingResponse.RoundTripTime;
                            targetDatamodelX.StatusSuccess   = GetStatusSuccess(pingResponse.Status);
                            IVector boring = _pingVectorFactory.GetVector(new PingResponse(IPAddress.Loopback, TimeSpan.Zero, IPStatus.DestinationHostUnreachable, IPAddress.Loopback),
                                                                          new PingStats(DateTime.Now.AddDays(-1), DateTime.Now)
                            {
                                Average25 = 0, Average25Count = 25, StatusHistory = new bool[PingStatsUtil.MaxHistoryCount]
                            });
                            double change           = _vectorComparer.Compare(boring, pingVector);
                            targetDatamodelX.Change = change;

                            if (targetDatamodelX.Change > 0.008)
                            {
                                targetDatamodelX.ShowUntil = DateTime.Now.Add(TimeToShowOddTargets);
                            }

                            if (targetDatamodelX.ShowUntil <= DateTime.Now)
                            {
                                targetDatamodelX.ShowUntil = null;
                            }

                            pingState.Previous = pingVector;
                        }
                        else
                        {
                            TargetDatamodel targetDatamodel = new TargetDatamodel(address: pingResponse.TargetIpAddress,
                                                                                  statusSuccess: GetStatusSuccess(pingResponse.Status),
                                                                                  roundTripTime: pingResponse.RoundTripTime);
                            _targetDatamodels.Add(pingResponse.TargetIpAddress, new PingState {
                                TargetDatamodel = targetDatamodel, Previous = pingVector
                            });
                            d.Invoke(() => TargetDatamodels.Add(targetDatamodel));
                        }

                        return(pingVector);
                    }).ToArray();
                    resortSubject.OnNext(0);
                });
            });

            TargetDatamodels = new ObservableCollection <TargetDatamodel>();
        }
Exemplo n.º 26
0
        protected void _sendPing_Command(object sender, CommandEventArgs e)
        {
            IPingService service = (IPingService)RemotingHelper.GetObject(typeof(IPingService));

            _pingReturn.Text = service.Ping();
        }
Exemplo n.º 27
0
 public RsopService(IUnitOfWork unitOfWork, ISysmonService sysmonService, IPingService pingService)
 {
     this.unitOfWork    = unitOfWork;
     this.sysmonService = sysmonService;
     this.pingService   = pingService;
 }
Exemplo n.º 28
0
 public HomeController(IPingService pingService, IEventLogService eventLogService)
 {
     PingService     = pingService;
     EventLogService = eventLogService;
 }
Exemplo n.º 29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ArpService"/> class.
 /// </summary>
 /// <param name="commonServices">The common services.</param>
 /// <param name="pingService">The ping service.</param>
 /// <param name="applicationLifetime">The application lifetime.</param>
 /// <autogeneratedoc />
 public ArpService(ICommonServices commonServices, IPingService pingService,
                   IApplicationLifetime applicationLifetime = null) :
     base(commonServices, applicationLifetime, ServiceHost.ArpService)
 {
     _pingService = pingService;
 }
Exemplo n.º 30
0
 public PingController(IPingService pingService)
 {
     _pingService = pingService;
 }
 public SendPingRequestCommandHandler(IPingService pingService)
 {
     _pingService = pingService;
 }
Exemplo n.º 32
0
 public SysmonService(IUnitOfWork unitOfWork, IPingService pingService)
 {
     this.unitOfWork  = unitOfWork;
     this.pingService = pingService;
 }