internal void Verify(IClientConfiguration config, IExtClient client)
 {
     Assert.AreSame(config, _config);
     Assert.AreSame(client, _client);
     Assert.AreEqual(1, _prepareCount);
     Assert.AreEqual(1, _applyCount);
 }
예제 #2
0
 //!! Метод Вызывается из Дизайнера!!
 public void InitializeFromDisigner(IClientConfiguration configuration)
 {
     try
     {
         _configuration = configuration;
         _showNotifier = new ShowNotifier(_configuration);
         _showNotifier.OnPreparationFinished += _showNotifier_OnPreparationFinished;
         _showNotifier.OnProgressChanged += _showNotifier_OnProgressChanged;
         _showNotifier.OnEquipmentStateChanged += _showNotifier_OnEquipmentStateChanged;
         _showNotifier.OnNotEnoughSpace += _showNotifier_OnNotEnoughSpace;
         _showNotifier.OnShownStatusChanged += (_showNotifier_OnShownStatusChanged);
         _showNotifier.OnReceiveAgentResourcesList += _showNotifier_OnReceiveAgentResourcesList;
         _showNotifier.OnUploadSpeed += new Action<double, string, string>(_showNotifier_OnUploadSpeed);
         _showNotifier.OnPreparationForDisplayEnded += new Action<string, bool>(_showNotifier_OnPreparationForDisplayEnded);
         _showNotifier.OnLogMessage+=new Action<string>(_showNotifier_OnLogMessage);
         _svc = new DuplexClient<IShowCommon>(new InstanceContext(_showNotifier), _pingInterval);
         _svc.Open();
         _created = true;
     }
     catch (CommunicationException)
     {
         _svc.Dispose();
         _svc = null;
         _created = false;
     }
 }
        public DaemonServiceImpl(IEggHost host, IClientConfiguration configuration)
        {
            logger.Info("Constructing Daemon Service");

             this.host = host;
             this.configuration = configuration;
        }
 public TemporaryFileServiceImpl(IClientConfiguration configuration, IFileSystemProxy fileSystemProxy)
 {
     this.configuration = configuration;
      this.fileSystemProxy = fileSystemProxy;
      this.temporaryDirectoryRoot = Path.Combine(configuration.UserDataDirectoryPath, "temp"); ;
      this.temporaryFilesLockPath = Path.Combine(temporaryDirectoryRoot, "LOCK");
      this.temporaryFilesLock = new FileLock(temporaryFilesLockPath);
 }
 public ModificationListingSynchronizer(IPofSerializer pofSerializer, IFileSystemProxy fileSystemProxy, IClientConfiguration clientConfiguration, TemporaryFileService temporaryFileService, ExeggutorService exeggutorService, ModificationLoader modificationLoader, ObservableCollection<ModificationViewModel> modificationViewModels, LeagueBuildUtilities leagueBuildUtilities)
 {
     this.pofSerializer = pofSerializer;
      this.fileSystemProxy = fileSystemProxy;
      this.clientConfiguration = clientConfiguration;
      this.temporaryFileService = temporaryFileService;
      this.exeggutorService = exeggutorService;
      this.modificationLoader = modificationLoader;
      this.modificationViewModels = modificationViewModels;
      this.leagueBuildUtilities = leagueBuildUtilities;
 }
예제 #6
0
 protected override dynamic BuildAccessTokenExchangeObject(NameValueCollection parameters, IClientConfiguration configuration)
 {
     return new
     {
         code = parameters["code"],
         client_id = configuration.ClientId,
         client_secret = configuration.ClientSecret,
         redirect_uri = configuration.RedirectUri,
         state = this.State,
     };
 }
예제 #7
0
        public ImapMailBox(IClientConfiguration config, IMailBoxLogger mbLogger, IImapWorker imapWorker, IImapIdler imapIdler, IEmailSender emailSender)
        {
            _config = config;
            _mbLogger = mbLogger;
            _imapWorker = imapWorker;
            _imapIdler = imapIdler;
            _emailSender = emailSender;

            MailBoxName = _config.MailBoxName;
            MailBoxId = _config.Id;
        }
예제 #8
0
 public ExportPresentation(IClientConfiguration config,
     IPresentationClient remotePresentationClient,
     IPresentationClient standalonePresentationClient,
     IExportPresentationController exportPresentationController)
 {
     _config = config;
     //_standaloneSourceDAL = standaloneSourceDAL;
     //_standaloneDeviceResourceEx = standaloneDeviceResourceEx;
     _standalonePresentationClient = standalonePresentationClient;
     _remotePresentationClient = remotePresentationClient;
     _exportPresentationController = exportPresentationController;
 }
예제 #9
0
 public ExportConfiguration(IClientConfiguration config,
     IPresentationClient standalonePresentationClient, IPresentationClient remotePresentationClient,
     Action<string> successMessageDelegate, Action<string> errorMessageDelegate,
     Func<string, string, string> getFileNameForConfigurationDelegate)
 {
     _config = config;
     _standalonePresentationClient = standalonePresentationClient;
     _remotePresentationClient = remotePresentationClient;
     _successMessageDelegate = successMessageDelegate;
     _errorMessageDelegate = errorMessageDelegate;
     _getFileNameForConfigurationDelegate = getFileNameForConfigurationDelegate;
 }
예제 #10
0
		/// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
		/// <exception cref="Db4objects.Db4o.Ext.OldFormatException"></exception>
		/// <exception cref="Db4objects.Db4o.Ext.InvalidPasswordException"></exception>
		public virtual IObjectContainer OpenClient(IClientConfiguration clientConfig, string
			 hostName, int port, string user, string password)
		{
			if (user == null || password == null)
			{
				throw new InvalidPasswordException();
			}
			Config4Impl config = AsLegacy(clientConfig);
			Config4Impl.AssertIsNotTainted(config);
			Socket4Adapter networkSocket = new Socket4Adapter(clientConfig.Networking.SocketFactory
				, hostName, port);
			return new ClientObjectContainer(clientConfig, networkSocket, user, password, true
				);
		}
예제 #11
0
        public RemotePresentationClient(IPresentationNotifier presentationNotifier,
            IClientConfiguration clientConfiguration, ISourceDAL sourceDAL, IDeviceSourceDAL deviceSourceDAL)
        {
            _sourceDAL = sourceDAL;
            _deviceSourceDAL = deviceSourceDAL;
            _presentationNotifier = presentationNotifier;
            _configuration = clientConfiguration;
            _presentationClient = new DuplexClient<IPresentationService>(new InstanceContext(presentationNotifier),
                clientConfiguration.PingInterval);
            _presentationClient.Open();
            _presentationClient.OnChanged += new EventHandler<ClientState>(_presentationClient_OnChanged);

            _deviceDescriptorCache = new DeviceDescriptorCache(presentationNotifier);
        }
 public ClientConfigurationDto(IClientConfiguration conf)
 {
     UserName = conf.UserName;
     Password = conf.Password;
     HostName = conf.HostName;
     Port = conf.Port;
     UseSecure = conf.UseSecure;
     MailBoxName = conf.MailBoxName;
     Id = conf.Id;
     SmtpUserName = conf.SmtpUserName;
     SmtpPassword = conf.SmtpPassword;
     SmtpHostName = conf.SmtpHostName;
     SmtpPort = conf.SmtpPort;
 }
예제 #13
0
        //public IClientConfiguration ClientConfiguration
        //{
            //get { return _configuration; }
        //}

        public bool Initialize(IClientConfiguration configuration)
        {
            using (_svc = new SimpleClient<IAdministrationService>())
            {
                try
                {
                    _svc.Open();
                }
                catch (Exception /*ex*/)
                {
                    return false;
                }
                _configuration = configuration;
                return true;
            }
        }
예제 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LanguageClient" /> class.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <param name="baasicClientFactory">The baasic client factory.</param>
 public LanguageClient(IClientConfiguration configuration,
                       IBaasicClientFactory baasicClientFactory)
     : base(configuration)
 {
     BaasicClientFactory = baasicClientFactory;
 }
 public FoursquareClientDescendant(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
 }
예제 #16
0
 public GitHubClientDescendant(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
 }
        // ****
        // **** SERVER-ONLY CALLED METHODS
        // ****

        /// <summary>
        /// Attempts to register the client with the server.
        /// </summary>
        /// <param name="data">Information related to registration.</param>
        /// <param name="newRegisterableClientConfiguration">A <see cref="IClientConfiguration"/> for the newly registered client.</param>
        /// <returns>A response relative to the registration process.</returns>
        public byte[] TryAddDataFromRegistrationChannel(byte[] data, out IClientConfiguration newRegisterableClientConfiguration)
        {
            if ((data == null) || (data.Length == 0))
            {
                throw new ArgumentNullException("data");
            }
            newRegisterableClientConfiguration = null;
            var transportConfigurationConvertor = new dodSON.Core.Converters.TypeSerializer <ITransportConfiguration>();
            var transportDataConverter          = new dodSON.Core.Converters.TypeSerializer <TransportData>();
            var listConverter = new dodSON.Core.Converters.TypeSerializer <List <byte[]> >();
            var boolConverter = new dodSON.Core.Converters.TypeSerializer <bool>();
            var clientConfigurationConverter = new dodSON.Core.Converters.TypeSerializer <IClientConfiguration>();
            //
            var request = transportDataConverter.FromByteArray(data);

            if (request.Alpha == ContextFor("Hello"))
            {
                // ######## create tunnel
                // create public/private keys
                var KeyGenerator     = AsymmetricCryptoProvider;
                var serverPublicKey  = KeyGenerator.ToXmlString(false);
                var serverPrivateKey = KeyGenerator.ToXmlString(true);
                // clear some bullshit here, I do not understand this, it refuses to register clients whom have, in theory, already unregistered...
                if (_RegistrationCandidates.ContainsKey(request.Beta))
                {
                    _RegistrationCandidates.Remove(request.Beta);
                }
                // add candidate
                _RegistrationCandidates.Add(request.Beta,
                                            new ServerRegistrationCandidate()
                {
                    ClientId         = request.Beta,
                    ClientPublicKey  = System.Text.Encoding.Unicode.GetString(request.Gamma),
                    CreatedDate      = DateTime.Now,
                    ServerPrivateKey = serverPrivateKey,
                    ServerPublicKey  = serverPublicKey
                });
                // generate response
                var response = transportDataConverter.ToByteArray(
                    new TransportData()
                {
                    Alpha   = ContextFor("Hello"),
                    Beta    = request.Beta,
                    Gamma   = System.Text.Encoding.Unicode.GetBytes(serverPublicKey),
                    Delta   = null,
                    Epsilon = null
                });
                return(response);
            }
            else if (request.Alpha == ContextFor("Challenge"))
            {
                if (_RegistrationCandidates.ContainsKey(request.Beta))
                {
                    var candidate      = _RegistrationCandidates[request.Beta];
                    var cryptoProvider = AsymmetricCryptoProvider;
                    cryptoProvider.FromXmlString(candidate.ServerPrivateKey);
                    var challengeEvidence = RestoreFromTransport(request.Epsilon, cryptoProvider);
                    if (ChallengeController.Challenge(challengeEvidence))
                    {
                        return(boolConverter.ToByteArray(true));
                    }
                    _RegistrationCandidates.Remove(request.Beta);
                    return(boolConverter.ToByteArray(false));
                }
                return(boolConverter.ToByteArray(false));
            }
            else if (request.Alpha == ContextFor("RequestServerSetup"))
            {
                if (_RegistrationCandidates.ContainsKey(request.Beta))
                {
                    var candidate      = _RegistrationCandidates[request.Beta];
                    var cryptoProvider = AsymmetricCryptoProvider;
                    cryptoProvider.FromXmlString(candidate.ServerPrivateKey);
                    var challengeEvidence = RestoreFromTransport(request.Epsilon, cryptoProvider);
                    if (ChallengeController.Challenge(challengeEvidence))
                    {
                        var clientProvider = AsymmetricCryptoProvider;
                        clientProvider.FromXmlString(candidate.ClientPublicKey);

                        // ################
                        // TODO: Problem ID: dc95c9d1ab4a422cbca3834e1361aa0 : The Problem
                        //                   The Problem. The TransportConfiguration referenced here is different depending on the ctor used to create it.
                        //                            Using the Standard Ctors, this reference here is the same as the reference in RegistrationController.
                        //                            However, using the IConfigurable interface code results in the two references being different objects.
                        //
                        //                            ######## When building in code, be sure to use the same reference in all types ########.
                        //
                        //                            Search for the Problem ID: dc95c9d1ab4a422cbca3834e1361aa0 for other elements of this problem.
                        //                            Current hypothesis is that somehow the referenced registration controller are different in the two places when it should be one.
                        //                            This problem manifests itself ONLY when the objects are created using the IConfiguration system.
                        //                            The answer is apparent, the IConfiguration system is creating two of these items.
                        var response = listConverter.ToByteArray(PrepareForTransport(transportConfigurationConvertor.ToByteArray(TransportConfiguration),
                                                                                     clientProvider,
                                                                                     TransportPartsLengthInBytes));
                        return(response);
                    }
                    _RegistrationCandidates.Remove(request.Beta);
                    return(null);
                }
                return(null);
            }
            else if (request.Alpha == ContextFor("Register"))
            {
                if (_RegistrationCandidates.ContainsKey(request.Beta))
                {
                    var candidate      = _RegistrationCandidates[request.Beta];
                    var cryptoProvider = AsymmetricCryptoProvider;
                    cryptoProvider.FromXmlString(candidate.ServerPrivateKey);
                    var challengeEvidence = RestoreFromTransport(request.Epsilon, cryptoProvider);
                    if (ChallengeController.Challenge(challengeEvidence))
                    {
                        // register
                        newRegisterableClientConfiguration = clientConfigurationConverter.FromByteArray(RestoreFromTransport(request.Delta, cryptoProvider));
                        _RegistrationCandidates.Remove(request.Beta);
                        // generate response
                        return(boolConverter.ToByteArray(true));
                    }
                    _RegistrationCandidates.Remove(request.Beta);
                    return(boolConverter.ToByteArray(false));
                }
                return(boolConverter.ToByteArray(false));
            }
            else if (request.Alpha == ContextFor("Unregister"))
            {
                if (_RegistrationCandidates.ContainsKey(request.Beta))
                {
                    var candidate      = _RegistrationCandidates[request.Beta];
                    var cryptoProvider = AsymmetricCryptoProvider;
                    cryptoProvider.FromXmlString(candidate.ServerPrivateKey);
                    var challengeEvidence = RestoreFromTransport(request.Epsilon, cryptoProvider);
                    if (ChallengeController.Challenge(challengeEvidence))
                    {
                        // unregister
                        newRegisterableClientConfiguration = clientConfigurationConverter.FromByteArray(RestoreFromTransport(request.Delta, cryptoProvider));
                        _RegistrationCandidates.Remove(request.Beta);
                        // generate response
                        return(boolConverter.ToByteArray(true));
                    }
                    _RegistrationCandidates.Remove(request.Beta);
                    return(boolConverter.ToByteArray(false));
                }
                return(boolConverter.ToByteArray(false));
            }
            return(null);
        }
예제 #18
0
 public OdnoklassnikiOAuth2UriQueryParameterAuthenticator(string accessToken, IClientConfiguration clientConfiguration)
     : base(accessToken)
 {
     _clientConfiguration = clientConfiguration;
 }
예제 #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OdnoklassnikiClient"/> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="configuration">The configuration.</param>
 public OdnoklassnikiClient(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
     _configuration = configuration;
 }
		public void Prepare(IClientConfiguration configuration)
		{
			configuration.Networking.SocketFactory = new SslSocketFactory(configuration.Networking.SocketFactory, _validationCallback);
		}
 /// <summary>
 /// Initializes a new instance of the <see cref="SalesforceClient"/> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="configuration">The configuration.</param>
 public SalesforceClient(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
 }
예제 #22
0
 protected virtual dynamic BuildAccessTokenExchangeObject(NameValueCollection parameters, IClientConfiguration configuration)
 {
     return(new
     {
         code = parameters["code"],
         client_id = configuration.ClientId,
         client_secret = configuration.ClientSecret,
         redirect_uri = configuration.RedirectUri,
         grant_type = "authorization_code"
     });
 }
예제 #23
0
 public void Prepare(IClientConfiguration configuration)
 {
     configuration.Networking.SocketFactory = new SslSocketFactory(configuration.Networking.SocketFactory, _validationCallback);
 }
 public Builder withConfiguration(IClientConfiguration configuration)
 {
     this.configuration = configuration;
     return(this);
 }
예제 #25
0
 public DashOAuthClient(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
     _factory = factory;
 }
예제 #26
0
 public GitHubClient(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
     _factory = factory;
 }
예제 #27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FacebookClient"/> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="configuration">The configuration.</param>
 public FacebookClient(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
 }
예제 #28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InstagramClient"/> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="configuration">The configuration.</param>
 public InstagramClient(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
 }
예제 #29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WindowsLiveClient"/> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="configuration">The configuration.</param>
 public WindowsLiveClient(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
 }
 public ConfigurationController(IClientConfiguration clientConfiguration)
 {
     this.clientConfiguration = clientConfiguration;
 }
예제 #31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyValueClient" /> class.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <param name="baasicClientFactory">The baasic client factory.</param>
 public KeyValueClient(IClientConfiguration configuration,
                       IBaasicClientFactory baasicClientFactory)
     : base(configuration)
 {
     BaasicClientFactory = baasicClientFactory;
 }
예제 #32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProfileClient" /> class.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <param name="baasicClientFactory">The baasic client factory.</param>
 public ProfileClient(IClientConfiguration configuration,
                      IBaasicClientFactory baasicClientFactory)
     : base(configuration)
 {
     BaasicClientFactory = baasicClientFactory;
 }
예제 #33
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LinkedInClient"/> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="configuration">The configuration.</param>
 public LinkedInClient(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
 }
예제 #34
0
 public DefaultCorrelationIdProvider(IClientConfiguration clientConfiguration)
 {
     this.clientConfiguration = clientConfiguration;
 }
        private static IHttpClientBuilder SetupClient(this Container services, IServiceCollection collection, string clientName, IClientConfiguration clientConfiguration, TokenFlow tokenFlow)
        {
            var httpClientBuilder = collection.AddHttpClient(clientName)
                                    .ConfigureHttpClient(client =>
                                                         client.BaseAddress = new Uri(clientConfiguration.ApiBaseAddress + clientConfiguration.ProjectKey + "/"))
                                    .AddHttpMessageHandler(c =>
            {
                var providers = services.GetAllInstances <ITokenProvider>();
                var provider  = providers.FirstOrDefault(tokenProvider => tokenProvider.TokenFlow == tokenFlow);
                provider.ClientConfiguration = clientConfiguration;
                return(new AuthorizationHandler(provider));
            })
                                    .AddHttpMessageHandler(c =>
                                                           new CorrelationIdHandler(new DefaultCorrelationIdProvider(clientConfiguration)))
                                    .AddHttpMessageHandler(c =>
                                                           new ErrorHandler(new ApiExceptionFactory(clientConfiguration, services.GetService <ISerializerService>())))
                                    .AddHttpMessageHandler(c => new LoggerHandler(services.GetService <ILoggerFactory>()));

            return(httpClientBuilder);
        }
 public ServiceBusClientFactory(IClientConfiguration config)
 {
     _config = config ?? throw new ArgumentNullException($"{nameof(config)} could not be null.");
 }
예제 #37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UberClient"/> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="configuration">The configuration.</param>
 public UberClient(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
 }
 /// <summary>opens a db4o client instance with the specified configuration.</summary>
 /// <remarks>opens a db4o client instance with the specified configuration.</remarks>
 /// <param name="config">the configuration to be used</param>
 /// <param name="host">the host name of the server that is to be connected to</param>
 /// <param name="port">the server port to connect to</param>
 /// <param name="user">the username for authentication</param>
 /// <param name="password">the password for authentication</param>
 /// <seealso cref="OpenServer(Db4objects.Db4o.CS.Config.IServerConfiguration, string, int)
 ///     ">OpenServer(Db4objects.Db4o.CS.Config.IServerConfiguration, string, int)</seealso>
 /// <seealso cref="Db4objects.Db4o.IObjectServer.GrantAccess(string, string)">Db4objects.Db4o.IObjectServer.GrantAccess(string, string)
 ///     </seealso>
 /// <exception cref="System.ArgumentException">if the configuration passed in has already been used.
 ///     </exception>
 public static IObjectContainer OpenClient(IClientConfiguration config, string host
                                           , int port, string user, string password)
 {
     return(config.Networking.ClientServerFactory.OpenClient(config, host, port, user,
                                                             password));
 }
예제 #39
0
 protected OAuthClient(IRequestFactory factory, IClientConfiguration configuration)
 {
     this.factory = factory;
     this.configuration = configuration;
 }
예제 #40
0
 public ModificationListingSynchronizer(IPofSerializer pofSerializer, IFileSystemProxy fileSystemProxy, IClientConfiguration clientConfiguration, TemporaryFileService temporaryFileService, ExeggutorService exeggutorService, ModificationLoader modificationLoader, ObservableCollection <ModificationViewModel> modificationViewModels, LeagueBuildUtilities leagueBuildUtilities)
 {
     this.pofSerializer          = pofSerializer;
     this.fileSystemProxy        = fileSystemProxy;
     this.clientConfiguration    = clientConfiguration;
     this.temporaryFileService   = temporaryFileService;
     this.exeggutorService       = exeggutorService;
     this.modificationLoader     = modificationLoader;
     this.modificationViewModels = modificationViewModels;
     this.leagueBuildUtilities   = leagueBuildUtilities;
 }
 public GitHubWithPrivateEmailsClient(IRequestFactory factory, IClientConfiguration configuration) : base(factory, configuration) {
     _factory = factory;
 }
예제 #42
0
 public TwitterClient(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
 }
예제 #43
0
 public void Initialize(IClientConfiguration configuration, bool isStandAlone)
 {
     _configuration = configuration;
     IsStandAlone = isStandAlone;
     _sourceDAL = new SourceDALCaching(_configuration, isStandAlone);
     _deviceSourceDAL = new DeviceSourceDALCaching(_configuration, isStandAlone);
 }
예제 #44
0
 public OAuth2ClientDescendant(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
 }
예제 #45
0
 public CarePassClientDescendant(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
 }
예제 #46
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OAuth2Client"/> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="configuration">The configuration.</param>
 protected OAuth2Client(IRequestFactory factory, IClientConfiguration configuration)
 {
     _factory = factory;
     Configuration = configuration;
 }
예제 #47
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LinkedInClient"/> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="configuration">The configuration.</param>
 public LinkedInClient(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
 }
예제 #48
0
		public ClientObjectContainer(IClientConfiguration config, Socket4Adapter socket, 
			string user, string password, bool login) : this((ClientConfigurationImpl)config
			, socket, user, password, login)
		{
		}
 public InstagramClientDescendant(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
 }
예제 #50
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ArticleCommentsClient" /> class.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <param name="baasicClientFactory">The baasic client factory.</param>
 public ArticleCommentsClient(IClientConfiguration configuration,
                              IBaasicClientFactory baasicClientFactory)
     : base(configuration)
 {
     BaasicClientFactory = baasicClientFactory;
 }
예제 #51
0
		/// <summary>opens a db4o client instance with the specified configuration.</summary>
		/// <remarks>opens a db4o client instance with the specified configuration.</remarks>
		/// <param name="config">the configuration to be used</param>
		/// <param name="host">the host name of the server that is to be connected to</param>
		/// <param name="port">the server port to connect to</param>
		/// <param name="user">the username for authentication</param>
		/// <param name="password">the password for authentication</param>
		/// <seealso cref="OpenServer(Db4objects.Db4o.CS.Config.IServerConfiguration, string, int)
		/// 	">OpenServer(Db4objects.Db4o.CS.Config.IServerConfiguration, string, int)</seealso>
		/// <seealso cref="Db4objects.Db4o.IObjectServer.GrantAccess(string, string)">Db4objects.Db4o.IObjectServer.GrantAccess(string, string)
		/// 	</seealso>
		/// <exception cref="System.ArgumentException">if the configuration passed in has already been used.
		/// 	</exception>
		public static IObjectContainer OpenClient(IClientConfiguration config, string host
			, int port, string user, string password)
		{
			return config.Networking.ClientServerFactory.OpenClient(config, host, port, user, 
				password);
		}
예제 #52
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ClientBase" /> class.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 public ClientBase(IClientConfiguration configuration)
 {
     Configuration = configuration;
 }
예제 #53
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WindowsLiveClient"/> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="configuration">The configuration.</param>
 public WindowsLiveClient(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
 }
예제 #54
0
        public RetrievalModel(IPreferenceSet prefs, IClientConfiguration clientConfiguration,
                              Lazy <IMarkupGenerator> markupGenerator, Lazy <IWebsiteDeployer> websiteDeployer)
        {
            _prefs = prefs;
            _clientConfiguration  = clientConfiguration;
            _markupGenerator      = markupGenerator;
            _websiteDeployer      = websiteDeployer;
            _taskManager          = new TaskManager();
            _taskManager.Changed += (s, e) => ReportAction(e);

            _prefs.PreferenceChanged += (s, e) =>
            {
                switch (e.Preference)
                {
                case Preference.ClientRetrievalTask:
                    if (_prefs.Get <bool>(Preference.ClientRetrievalTaskEnabled))
                    {
                        if (_clientConfiguration.Count != 0)
                        {
                            _taskManager.Restart(ClientTaskKey, ClientInterval);
                        }
                    }
                    else
                    {
                        _taskManager.Stop(ClientTaskKey);
                    }
                    break;

                case Preference.WebGenerationTask:
                    if (_prefs.Get <bool>(Preference.WebGenerationTaskEnabled) &&
                        _prefs.Get <bool>(Preference.WebGenerationTaskAfterClientRetrieval) == false)
                    {
                        if (_clientConfiguration.Count != 0)
                        {
                            _taskManager.Restart(WebTaskKey, WebInterval);
                        }
                    }
                    else
                    {
                        _taskManager.Stop(WebTaskKey);
                    }
                    break;
                }
            };

            _clientConfiguration.ConfigurationChanged += (s, e) =>
            {
                if (e.ChangedType == ConfigurationChangedType.Remove ||
                    e.ChangedType == ConfigurationChangedType.Clear)
                {
                    // Disable timers if no hosts
                    if (_taskManager.Enabled && _clientConfiguration.Count == 0)
                    {
                        Logger.Info("No clients... stopping all scheduled tasks");
                        //_taskManager.Stop();
                        _taskManager.Cancel();
                    }
                }
                else if (e.ChangedType == ConfigurationChangedType.Add)
                {
                    var clientTaskEnabled = _prefs.Get <bool>(Preference.ClientRetrievalTaskEnabled);
                    if (e.Client == null)
                    {
                        // no client specified - retrieve all
                        _taskManager.Run(ClientTaskKey, ClientInterval, clientTaskEnabled);
                    }
                    else if (clientTaskEnabled)
                    {
                        _taskManager.Start(ClientTaskKey, ClientInterval);
                    }

                    if (_prefs.Get <bool>(Preference.WebGenerationTaskEnabled) &&
                        _prefs.Get <bool>(Preference.WebGenerationTaskAfterClientRetrieval) == false)
                    {
                        _taskManager.Start(WebTaskKey, WebInterval);
                    }
                }
            };

            _taskManager.Add(ClientTaskKey, ClientRetrievalAction, ClientInterval);
            _taskManager.Add(WebTaskKey, WebGenerationAction, WebInterval);
        }
예제 #55
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OdnoklassnikiClient"/> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="configuration">The configuration.</param>
 public OdnoklassnikiClient(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
     _configuration = configuration;
 }
예제 #56
0
 public DigitalOceanClientDescendant(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="OAuth2Client"/> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="configuration">The configuration.</param>
 protected OAuth2Client(IRequestFactory factory, IClientConfiguration configuration)
 {
     ExpirationSafetyMargin = TimeSpan.FromSeconds(5);
     _factory = factory;
     Configuration = configuration;
 }
예제 #58
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MailRuClient"/> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="configuration">The configuration.</param>
 public MailRuClient(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
     _configuration = configuration;
 }
예제 #59
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AsanaClient"/> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="configuration">The configuration.</param>
 public AsanaClient(IRequestFactory factory, IClientConfiguration configuration)
     : base(factory, configuration)
 {
 }
예제 #60
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OAuthClient" /> class.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="configuration">The configuration.</param>
 protected OAuthClient(IRequestFactory factory, IClientConfiguration configuration)
 {
     _factory      = factory;
     Configuration = configuration;
 }