public FindRelatedWindow(string sid)
        {
            _sid = sid;
            _discovery = new Discovery(((App)Application.Current).Session);

            InitializeComponent();
        }
        public PlayerTestWindow()
        {
            InitializeComponent();

            _refreshTimer = new DispatcherTimer(TimeSpan.FromSeconds(0.1), DispatcherPriority.Background, (sender, args) =>
            {
                var length = MeAudio.NaturalDuration.HasTimeSpan ? MeAudio.NaturalDuration.TimeSpan : (TimeSpan?)null;
                TbCurrentPosition.Text = MeAudio.Position.ToString(@"mm\:ss");
                TbLength.Text = length?.ToString(@"mm\:ss") ?? "--:--";
                PbProgress.Minimum = 0;
                PbProgress.Maximum = length?.TotalMilliseconds ?? 1;
                PbProgress.Value = MeAudio.Position.TotalMilliseconds;
            }, Dispatcher);

            Player = new Player(((App)Application.Current).Session);
            Player.CurrentChannelChanged += (sender, args) => TbCurrentChannel.Text = args.Object?.ToString();
            Player.CurrentSongChanged += (sender, args) =>
            {
                ImgCover.Source = args.Object != null ? new BitmapImage(new Uri(args.Object.PictureUrl)) : null;
                TbTitle.Text = args.Object?.Title;
                TbArtist.Text = args.Object?.Artist;
                TbAlbum.Text = args.Object?.AlbumTitle;

                TbCurrentSong.Text = args.Object != null ? JsonConvert.SerializeObject(args.Object, Formatting.Indented) : null;
                MeAudio.Source = args.Object == null ? null : new Uri(args.Object.Url);
                MeAudio.Play();
                _playing = true;
            };
            Discovery = new Discovery(((App)Application.Current).Session);
        }
Пример #3
0
 public void Setup()
 {
     _log       = (LogSpy)_kernel.Get <ILog>();
     _discovery = Substitute.For <IDiscovery>();
     _discovery.GetNodes(Arg.Any <DeploymentIdentifier>()).Returns(_ => Task.FromResult(_getSourceNodes()));
     _reachabilityCheck = (n, c) => throw new EnvironmentException("node is unreachable");
     _environment       = Substitute.For <IEnvironment>();
 }
Пример #4
0
 private void Setup(IDiscoveryCache cache)
 {
     _restClient = new MockRestClient();
     _cache      = cache;
     _discovery  = new MobileConnect.Discovery.Discovery(cache, this._restClient);
     _config     = new MobileConnectConfig()
     {
         ClientId = "1234567890", ClientSecret = "1234567890", DiscoveryUrl = "http://localhost:8080/v2/discovery/"
     };
 }
Пример #5
0
 private void SetSourceDatabaseAutomatically(IDiscovery discover)
 {
     SourceDatabase.Database   = discover.GetDatabaseName();
     SourceDatabase.DataseFile = discover.GetDatabaseFile();
     SourceDatabase.Host       = discover.GetDatabaseHost();
     SourceDatabase.Password   = discover.GetDatabasePassword();
     SourceDatabase.Port       = discover.GetDatabasePort();
     SourceDatabase.Provider   = discover.GetDatabaseProvider();
     SourceDatabase.Username   = discover.GetDatabaseUsername();
 }
Пример #6
0
 public AvailabilityZoneServiceDiscovery(
     string serviceName,
     CancellationToken ctk, IDiscovery discovery,
     Rewrite.IConsulClient consulClient)
 {
     Info.ServiceName          = serviceName;
     _disposeCancellationToken = ctk;
     _discovery    = discovery;
     _consulClient = consulClient;
     Task.Run(UpdateAndMonitorAvailabilityZoneAsync, _disposeCancellationToken);
 }
Пример #7
0
        public override void Setup()
        {
            base.Setup();
            _dateTimeFake = new DateTimeFake();

            _createdNodeSources = new List <Type>();
            SetupConsulNodeSource();
            SetupSlowNodeSource();

            _discovery            = _unitTestingKernel.Get <IDiscovery>();
            _deploymentIdentifier = new DeploymentIdentifier(ServiceName, Env, Substitute.For <IEnvironment>());
        }
Пример #8
0
 public RoutingTableManager(
     IInitialServerAddressProvider initialServerAddressProvider,
     IDiscovery discovery,
     IRoutingTable routingTable,
     IClusterConnectionPoolManager poolManager,
     IDriverLogger logger)
 {
     _initialServerAddressProvider = initialServerAddressProvider;
     _discovery    = discovery;
     _routingTable = routingTable;
     _poolManager  = poolManager;
     _logger       = logger;
 }
Пример #9
0
        public void Setup()
        {
            _dateTimeFake = new DateTimeFake();

            _createdNodeSources = new List <Type>();
            SetupConsulNodeSource();
            SetupSlowNodeSource();

            _discoveryConfig          = new DiscoveryConfig();
            _discoveryConfig.Services = new ServiceDiscoveryCollection(new Dictionary <string, ServiceDiscoveryConfig>(), new ServiceDiscoveryConfig(), new PortAllocationConfig());

            _discovery            = _kernel.Get <IDiscovery>();
            _deploymentIdentifier = new DeploymentIdentifier(ServiceName, Env, Substitute.For <IEnvironment>());
        }
Пример #10
0
        public MainWindowViewModel(IDiscovery discovery, ITraceListener traceListener)
        {
            _discovery     = discovery;
            _traceListener = traceListener;

            Text = "Welcome to the analysis viewer. This tool is used to demonstrate how different analyzers process text into tokens. You can edit this text to try different input such as numbers like 23231.23 or characters ([email protected]). Once happy, select an Analyzer from the list of analyzers found on the current assemblies path and then hit the Analyze button. The tokens produced are shown below and when you select them the right panel shows their attributes, and the corresponding span in the original text is highlighted.";

            TokenChangedCommand = new DelegateCommand(OnTokenChanging);
            AnalyzeCommand      = new DelegateCommand <IAnalyzer>(OnAnalyzing);
            Analyzers           = new ObservableCollection <IAnalyzer>();
            Tokens = new ObservableCollection <IToken>();

            Initialize();
        }
Пример #11
0
 public UserProfileAppService(
     IRepository <UserProfile> repository,
     IRepository <UserUpload> userUploadRepository,
     IMapper mapper,
     IPersonalityInsights watsonPI,
     IDiscovery watsonDiscovery,
     INaturalLanguageUnderstanding watsonNLU) : base(repository)
 {
     _userProfileRepository = repository;
     _userUploadRepository  = userUploadRepository;
     _mapper          = mapper;
     _watsonPI        = watsonPI;
     _watsonDiscovery = watsonDiscovery;
     _watsonNLU       = watsonNLU;
 }
Пример #12
0
        public MultiEnvironmentServiceDiscovery(string serviceName, IEnvironment environment, ReachabilityCheck reachabilityCheck,
                                                IDiscovery discovery, Func <DiscoveryConfig> getDiscoveryConfig, Func <string, AggregatingHealthStatus> getAggregatingHealthStatus,
                                                IDateTime dateTime)
        {
            _healthStatus      = new HealthMessage(Health.Info, message: null, suppressMessage: true);
            ServiceName        = serviceName;
            Environment        = environment;
            ReachabilityCheck  = reachabilityCheck;
            Discovery          = discovery;
            GetDiscoveryConfig = getDiscoveryConfig;
            DateTime           = dateTime;
            _lastUsageTime     = DateTime.UtcNow;
            var aggregatingHealthStatus = getAggregatingHealthStatus(serviceName);

            _healthCheck = aggregatingHealthStatus.Register(Environment.DeploymentEnvironment, CheckHealth);
        }
Пример #13
0
        internal static async Task <MobileConnectStatus> HandleUrlRedirect(IDiscovery discovery, IAuthentication authentication, Uri redirectedUrl, DiscoveryResponse discoveryResponse, string expectedState, string expectedNonce, MobileConnectConfig config)
        {
            if (HttpUtils.ExtractQueryValue(redirectedUrl.Query, "code") != null)
            {
                return(await RequestToken(authentication, discoveryResponse, redirectedUrl, expectedState, expectedNonce, config));
            }
            else if (HttpUtils.ExtractQueryValue(redirectedUrl.Query, "mcc_mnc") != null)
            {
                return(await AttemptDiscoveryAfterOperatorSelection(discovery, redirectedUrl, config));
            }

            string errorCode = HttpUtils.ExtractQueryValue(redirectedUrl.Query, "error") ?? "invalid_request";
            string errorDesc = HttpUtils.ExtractQueryValue(redirectedUrl.Query, "error_description") ?? string.Format("Unable to parse next step using {0}", redirectedUrl.AbsoluteUri);

            return(MobileConnectStatus.Error(errorCode, errorDesc, null));
        }
Пример #14
0
        private static MobileConnectStatus GenerateStatusFromDiscoveryResponse(IDiscovery discovery, DiscoveryResponse response)
        {
            if (!response.Cached && response.ErrorResponse != null)
            {
                return(MobileConnectStatus.Error(response.ResponseData?.error, response.ResponseData?.description ?? "Failure at discovery endpoint, see response for more information", null, response));
            }

            var operatorSelectionUrl = discovery.ExtractOperatorSelectionURL(response);

            if (!string.IsNullOrEmpty(operatorSelectionUrl))
            {
                return(MobileConnectStatus.OperatorSelection(operatorSelectionUrl));
            }

            return(MobileConnectStatus.StartAuthorization(response));
        }
Пример #15
0
 public void ShowSingleServer(Opc.Da.Server server, BrowseFilters filters)
 {
     if (server == null)
     {
         throw new System.ArgumentNullException("server");
     }
     this.Clear();
     this.m_discovery                       = null;
     this.m_filters                         = ((filters == null) ? new BrowseFilters() : filters);
     this.BrowseTV.ContextMenu              = this.PopupMenu;
     this.m_singleServer                    = new System.Windows.Forms.TreeNode(server.Name);
     this.m_singleServer.ImageIndex         = Resources.IMAGE_LOCAL_SERVER;
     this.m_singleServer.SelectedImageIndex = Resources.IMAGE_LOCAL_SERVER;
     this.m_singleServer.Tag                = server.Duplicate();
     this.Connect(this.m_singleServer);
     this.BrowseTV.Nodes.Add(this.m_singleServer);
 }
Пример #16
0
        void IDiscovery.OnDiscoveryRequest(string contractName, string contractNamespace, Uri[] scopesToMatch)
        {
            if (m_Addresses.Count == 0)
            {
                return;
            }
            //Callback to the client wanting to discover
            IDiscoveryCallback clientCallback  = OperationContext.Current.GetCallbackChannel <IDiscoveryCallback>();
            DiscoveryCallback  serviceCallback = new DiscoveryCallback(clientCallback);

            Action <string> discover = (address) =>
            {
                IDiscovery serviceProxy = DuplexChannelFactory <IDiscovery, IDiscoveryCallback> .CreateChannel(serviceCallback, DiscoveryFactory.Binding, new EndpointAddress(address as string));

                CancellationTokenSource cancellationSource = new CancellationTokenSource();
                EventHandler            cleanup            = delegate
                {
                    //Will still be Opening if service was not found and the discovery period expires.
                    ICommunicationObject proxy = serviceProxy as ICommunicationObject;
                    if (proxy.State != CommunicationState.Faulted)
                    {
                        try
                        {
                            proxy.Close();
                        }
                        catch
                        {}
                    }
                    cancellationSource.Cancel();
                };
                (clientCallback as ICommunicationObject).Closed  += cleanup;
                (clientCallback as ICommunicationObject).Faulted += cleanup;
                Task.Delay(DiscoveryFactory.Binding.SendTimeout).ContinueWith(_ => cleanup(null, EventArgs.Empty), cancellationSource.Token);

                try
                {
                    serviceProxy.OnDiscoveryRequest(contractName, contractNamespace, scopesToMatch);
                }
                catch
                {
                    Trace.Write("Some problem occurred publishing to a service.");
                }
            };

            m_Addresses.ForEachAsync(discover);
        }
        public void Setup(RestClient client)
        {
            _restClient     = client;
            _cache          = new ConcurrentDiscoveryCache();
            _discovery      = new GSMA.MobileConnect.Discovery.Discovery(_cache, _restClient);
            _authentication = new GSMA.MobileConnect.Authentication.Authentication(_restClient);

            _config = new MobileConnectConfig()
            {
                DiscoveryUrl = _testConfig.DiscoveryUrl,
                ClientId     = _testConfig.ClientId,
                ClientSecret = _testConfig.ClientSecret,
                RedirectUrl  = _testConfig.RedirectUrl,
            };

            _mobileConnect = new MobileConnectInterface(_discovery, _authentication, _config);
        }
Пример #18
0
        public override void Start()
        {
            if (_isRunning)
            {
                throw new InvalidOperationException("MQTT Data Transport is already running");
            }

            if (_config.IsBroker)
            {
                _broker = StartBroker(_config.BrokerPort);
            }

            _discovery = _config.UseAutoDiscovery ? (IDiscovery) new AutoDiscovery(_config) : new StaticDiscovery(_config);
            _discovery.BrokerDiscovered += (networkID, address, port) =>
            {
                _brokerIP   = address;
                _brokerPort = port;
                InvokeBrokerDiscovered(networkID, address, port);
                _startWait.Set();

                if (!_isRunning)
                {
                    Log.Information($"MQTTDataTransport: MQTT Broker found.");
                    Log.Information($"MQTTDataTransport:     RoboCore Network: {networkID}");
                    Log.Information($"MQTTDataTransport:     Broker Address: {address}:{port}");
                }
            };
            Log.Information("MQTTDataTransport: Waiting to discover the MQTT Broker");
            _discovery.Start();

            while (!_startWait.WaitOne())
            {
            }

            Log.Information("MQTTDataTransport: Connecting to Broker...");
            CreateMQTTClient();

            while (!_connectWait.WaitOne())
            {
            }

            Log.Information("MQTTDataTransport: Connected to Broker");

            _isRunning = true;
        }
Пример #19
0
        internal static RoutingTableManager NewRoutingTableManager(
            IRoutingTable routingTable,
            IClusterConnectionPoolManager poolManager, IDiscovery discovery = null,
            IInitialServerAddressProvider addressProvider = null,
            IDriverLogger logger = null)
        {
            if (addressProvider == null)
            {
                addressProvider = new InitialServerAddressProvider(InitialUri, new PassThroughServerAddressResolver());
            }

            if (discovery == null)
            {
                discovery = Mock.Of <IDiscovery>();
            }

            return(new RoutingTableManager(addressProvider, discovery, routingTable, poolManager, logger));
        }
Пример #20
0
        public void Setup()
        {
            _restClient     = new RestClient();
            _cache          = new ConcurrentDiscoveryCache();
            _discovery      = new GSMA.MobileConnect.Discovery.Discovery(_cache, _restClient);
            _authentication = new GSMA.MobileConnect.Authentication.Authentication(_restClient);

            _testConfig = TestConfig.GetConfig(TestConfig.DEFAULT_TEST_CONFIG);
            _config     = new MobileConnectConfig()
            {
                DiscoveryUrl = _testConfig.DiscoveryUrl,
                ClientId     = _testConfig.ClientId,
                ClientSecret = _testConfig.ClientSecret,
                RedirectUrl  = _testConfig.RedirectUrl,
            };

            _mobileConnect = new MobileConnectWebInterface(_discovery, _authentication, _config);
        }
Пример #21
0
 public LoadBalancer(
     IDiscovery discovery,
     DeploymentIdentifier deploymentIdentifier,
     ReachabilityCheck reachabilityCheck,
     TrafficRoutingStrategy trafficRoutingStrategy,
     Func <Node, DeploymentIdentifier, ReachabilityCheck, Action, NodeMonitoringState> createNodeMonitoringState,
     IHealthMonitor healthMonitor,
     IDateTime dateTime,
     ILog log)
 {
     DeploymentIdentifier      = deploymentIdentifier;
     Discovery                 = discovery;
     ReachabilityCheck         = reachabilityCheck;
     TrafficRoutingStrategy    = trafficRoutingStrategy;
     CreateNodeMonitoringState = createNodeMonitoringState;
     DateTime       = dateTime;
     Log            = log;
     _healthMonitor = healthMonitor.SetHealthFunction(DeploymentIdentifier.ToString(), () => new ValueTask <HealthCheckResult>(_healthStatus));
 }
        public RoutingTableManager(
            IInitialServerAddressProvider initialServerAddressProvider,
            IDiscovery discovery,
            IClusterConnectionPoolManager poolManager,
            ILogger logger,
            TimeSpan routingTablePurgeDelay,
            params IRoutingTable[] routingTables)
        {
            _initialServerAddressProvider = initialServerAddressProvider;
            _discovery              = discovery;
            _poolManager            = poolManager;
            _logger                 = logger;
            _routingTablePurgeDelay = routingTablePurgeDelay;

            foreach (var routingTable in routingTables)
            {
                _routingTables.TryAdd(routingTable.Database, routingTable);
            }
        }
Пример #23
0
        public IDecoration[] Compile(IDiscovery <T> discovery, IDecorationFactoryBuilder builder)
        {
            var decorations = _compiler.Compile(discovery, builder);

            foreach (var decoration in decorations)
            {
                var decorationType = decoration.GetType();
                var genArgs        = decorationType.GenericTypeArguments;
                var typeWithoutGen = decorationType.GetGenericTypeDefinition();

                // TODO: exception if not exist
                var attatchmentType = _attatchmentToDecoration[typeWithoutGen];
                attatchmentType.MakeGenericType(genArgs);
                var attatchment = (IAttatchment)Activator.CreateInstance(attatchmentType);

                // TODO: something
            }

            return(decorations);
        }
Пример #24
0
        /// <summary>
        /// NBench Runner takes the following <see cref="args"/>
        ///
        /// C:\> NBench.Runner.exe [assembly name] [output-directory={dir-path}]
        ///
        /// </summary>
        /// <param name="args">The commandline arguments</param>
        static int Main(string[] args)
        {
            Output    = new CompositeBenchmarkOutput(new ConsoleBenchmarkOutput(), new MarkdownBenchmarkOutput(CommandLine.GetProperty("output-directory")));
            Discovery = new ReflectionDiscovery(Output);
            string assemblyPath = Path.GetFullPath(args[0]);

            // TODO: See issue https://github.com/petabridge/NBench/issues/3
            var assembly = AssemblyRuntimeLoader.LoadAssembly(assemblyPath);


            /*
             * Set processor affinity
             */
            Process Proc = Process.GetCurrentProcess();

            Proc.ProcessorAffinity = new IntPtr(2); // either of the first two processors

            /*
             * Set priority
             */
            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
            Thread.CurrentThread.Priority = ThreadPriority.Highest;


            var  benchmarks        = Discovery.FindBenchmarks(assembly);
            bool anyAssertFailures = false;

            foreach (var benchmark in benchmarks)
            {
                Output.WriteLine($"------------ STARTING {benchmark.BenchmarkName} ---------- ");
                benchmark.Run();
                benchmark.Finish();

                // if one assert fails, all fail
                anyAssertFailures = anyAssertFailures || !benchmark.AllAssertsPassed;
                Output.WriteLine($"------------ FINISHED {benchmark.BenchmarkName} ---------- ");
            }
            return(anyAssertFailures ? -1 : 0);
        }
Пример #25
0
        public ShortcutController(IDiscovery discovery, IBindingValidator bindingValidator, IShortcutProfileStore profileStore, ILastUsedProfileIdProvider lastUsedProfileIdProvider)
        {
            m_Discovery                 = discovery;
            this.bindingValidator       = bindingValidator;
            m_LastUsedProfileIdProvider = lastUsedProfileIdProvider;

            profileManager = new ShortcutProfileManager(m_Discovery.GetAllShortcuts(), bindingValidator, profileStore);
            profileManager.shortcutBindingChanged += OnShortcutBindingChanged;
            profileManager.activeProfileChanged   += OnActiveProfileChanged;
            profileManager.ReloadProfiles();

            var conflictResolverView = new ConflictResolverView();
            var conflictResolver     = new ConflictResolver(profileManager, contextManager, conflictResolverView);


            m_Directory = new Directory(profileManager.GetAllShortcuts());
            trigger     = new Trigger(m_Directory, conflictResolver);

            ActivateLastUsedProfile();
            MigrateUserSpecifiedPrefKeys();

            ModeService.modeChanged += HandleModeChanged;
        }
Пример #26
0
        /// <summary>
        /// NBench Runner takes the following <see cref="args"/>
        /// 
        /// C:\> NBench.Runner.exe [assembly name] [output-directory={dir-path}]
        /// 
        /// </summary>
        /// <param name="args">The commandline arguments</param>
        static int Main(string[] args)
        {
            Output = new CompositeBenchmarkOutput(new ConsoleBenchmarkOutput(), new MarkdownBenchmarkOutput(CommandLine.GetProperty("output-directory")));
            Discovery = new ReflectionDiscovery(Output);
            string assemblyPath = Path.GetFullPath(args[0]);

            // TODO: See issue https://github.com/petabridge/NBench/issues/3
            var assembly = AssemblyRuntimeLoader.LoadAssembly(assemblyPath);


            /*
             * Set processor affinity
             */
            Process Proc = Process.GetCurrentProcess();
            Proc.ProcessorAffinity = new IntPtr(2); // either of the first two processors

            /*
             * Set priority
             */
            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
            Thread.CurrentThread.Priority = ThreadPriority.Highest;


            var benchmarks = Discovery.FindBenchmarks(assembly);
            bool anyAssertFailures = false;
            foreach (var benchmark in benchmarks)
            {
                Output.WriteLine($"------------ STARTING {benchmark.BenchmarkName} ---------- ");
                benchmark.Run();
                benchmark.Finish();

                // if one assert fails, all fail
                anyAssertFailures = anyAssertFailures || !benchmark.AllAssertsPassed;
                Output.WriteLine($"------------ FINISHED {benchmark.BenchmarkName} ---------- ");
            }
            return anyAssertFailures ? -1 : 0;
        }
Пример #27
0
 public void ShowAllServers(IDiscovery discovery, Specification specification, BrowseFilters filters)
 {
     if (discovery == null)
     {
         throw new System.ArgumentNullException("discovery");
     }
     this.Clear();
     this.m_discovery                       = discovery;
     this.m_specification                   = specification;
     this.m_filters                         = ((filters == null) ? new BrowseFilters() : filters);
     this.BrowseTV.ContextMenu              = this.PopupMenu;
     this.m_localServers                    = new System.Windows.Forms.TreeNode("Local Servers");
     this.m_localServers.ImageIndex         = Resources.IMAGE_LOCAL_COMPUTER;
     this.m_localServers.SelectedImageIndex = Resources.IMAGE_LOCAL_COMPUTER;
     this.m_localServers.Tag                = null;
     this.BrowseServers(this.m_localServers);
     this.BrowseTV.Nodes.Add(this.m_localServers);
     this.m_localNetwork                    = new System.Windows.Forms.TreeNode("Local Network");
     this.m_localNetwork.ImageIndex         = Resources.IMAGE_LOCAL_NETWORK;
     this.m_localNetwork.SelectedImageIndex = Resources.IMAGE_LOCAL_NETWORK;
     this.m_localNetwork.Tag                = null;
     this.BrowseNetwork(this.m_localNetwork);
     this.BrowseTV.Nodes.Add(this.m_localNetwork);
 }
Пример #28
0
        public DiscoveryContract ToContract(IDiscovery model)
        {
            var contract = new DiscoveryContract
            {
                DistanceInMiles = model.DistanceInMiles
            };

            if (model.User != null)
            {
                contract.User = _userMapper.ToContract(model.User);
            }

            if (model.CommonFriends != null)
            {
                contract.CommonFriends = model.CommonFriends.Select(_friendMapper.ToContract);
            }

            if (model.CommonInterests != null)
            {
                contract.CommonInterests = model.CommonInterests.Select(_interestMapper.ToContract);
            }

            return contract;
        }
 public VSEditor(IDiscovery discovery, IGenerator projectGeneration)
 {
     m_Discoverability = discovery;
     m_Generation      = projectGeneration;
 }
Пример #30
0
 public RiderScriptEditor(IDiscovery discovery, IGenerator projectGeneration)
 {
     m_Discoverability   = discovery;
     m_ProjectGeneration = projectGeneration;
 }
Пример #31
0
        internal static async Task <MobileConnectStatus> AttemptDiscoveryAfterOperatorSelection(IDiscovery discovery, Uri redirectedUrl, MobileConnectConfig config)
        {
            var parsedRedirect = discovery.ParseDiscoveryRedirect(redirectedUrl);

            if (!parsedRedirect.HasMCCAndMNC)
            {
                return(MobileConnectStatus.StartDiscovery());
            }

            DiscoveryResponse response;

            try
            {
                response = await discovery.CompleteSelectedOperatorDiscoveryAsync(config, config.RedirectUrl, parsedRedirect.SelectedMCC, parsedRedirect.SelectedMNC);

                if (response.ResponseData?.subscriber_id == null)
                {
                    response.ResponseData.subscriber_id = parsedRedirect.EncryptedMSISDN;
                }
            }
            catch (MobileConnectInvalidArgumentException e)
            {
                return(MobileConnectStatus.Error("invalid_argument", string.Format("An argument was found to be invalid during the process. The argument was {0}.", e.Argument), e));
            }
            catch (MobileConnectEndpointHttpException e)
            {
                return(MobileConnectStatus.Error("http_failure", "An HTTP failure occured while calling the discovery endpoint, the endpoint may be inaccessible", e));
            }
            catch (Exception e)
            {
                return(MobileConnectStatus.Error("unknown_error", "An unknown error occured while calling the Discovery service to obtain operator details", e));
            }

            return(GenerateStatusFromDiscoveryResponse(discovery, response));
        }
Пример #32
0
 /// <summary>
 /// Registers a discovery plugin.
 /// </summary>
 /// <param name="plugIn">IDiscovery object to register.</param>
 public void RegisterPlugIn(IDiscovery plugIn)
 {
     for (int i = 0; i < _DiscoveryPlugIns.Count; i++)
     {
         if (_DiscoveryPlugIns[i].GetType() == plugIn.GetType())
         {
             _DiscoveryPlugIns[i] = plugIn;
             return;
         }
     }
     _DiscoveryPlugIns.Add(plugIn);
 }
Пример #33
0
 private BenchmarkRunCache(IBenchmarkOutput output)
 {
     discovery = new ReflectionDiscovery(output);
 }
 public ShortcutController(IDiscovery discovery)
 {
     profileManager = new ShortcutProfileManager(discovery.GetAllShortcuts());
     profileManager.shortcutsModified += Initialize;
     profileManager.ApplyActiveProfile();
 }
Пример #35
0
 /// <summary>
 /// Initialises a client for API communication.
 /// </summary>
 /// <param name="discovery">The `IDiscovery` component</param>
 /// <param name="merchantIdentifier">The merchants unique identifier provided by Worldpay</param>
 public AccessCheckoutClient(IDiscovery discovery, string merchantIdentifier)
 {
     _discovery          = discovery;
     _merchantIdentifier = merchantIdentifier;
 }