Пример #1
0
 private void InitializeEndpoints()
 {
     Cards = new CardEndpoint(this);
     CustomerStatements   = new CustomerStatementEndpoint(this);
     Devices              = new DeviceEndpoint(this);
     DeviceServers        = new DeviceServerEndpoint(this);
     Installations        = new InstallationEndpoint(this);
     Invoices             = new InvoiceEndpoint(this);
     MonetaryAccountBanks = new MonetaryAccountBankEndpoint(this);
     Payments             = new PaymentEndpoint(this);
     Sessions             = new SessionEndpoint(this);
 }
        /// <summary>
        /// Initializes the listener from a binding element.
        /// </summary>
        internal UaTcpChannelListener(UaTcpTransportBindingElement bindingElement, BindingContext context)
            :
            base(context.Binding)
        {
            // assign a unique guid to the listener.
            m_listenerId = Guid.NewGuid().ToString();

            SetUri(context.ListenUriBaseAddress, context.ListenUriRelativeAddress);

            m_descriptions  = bindingElement.Descriptions;
            m_configuration = bindingElement.Configuration;

            m_quotas = new TcpChannelQuotas();

            m_quotas.MaxBufferSize         = m_configuration.MaxBufferSize;
            m_quotas.MaxMessageSize        = m_configuration.MaxMessageSize;
            m_quotas.ChannelLifetime       = m_configuration.ChannelLifetime;
            m_quotas.SecurityTokenLifetime = m_configuration.SecurityTokenLifetime;
            m_quotas.MessageContext        = bindingElement.MessageContext;

            foreach (object parameter in context.BindingParameters)
            {
                ServiceCredentials credentials = parameter as ServiceCredentials;

                if (credentials != null)
                {
                    // TBD - paste the cert with the private key with the additional chain.
                    m_serverCertificate           = CertificateFactory.Create(credentials.ServiceCertificate.Certificate, credentials.ServiceCertificate.Certificate);
                    m_quotas.CertificateValidator = credentials.ClientCertificate.Authentication.CustomCertificateValidator;
                }
            }

            m_bufferManager = new BufferManager("Server", (int)bindingElement.MaxBufferPoolSize, m_quotas.MaxBufferSize);

            m_channels     = new Dictionary <uint, TcpServerChannel>();
            m_channelQueue = new Queue <UaTcpReplyChannel>();
            m_acceptQueue  = new Queue <TcpAsyncOperation <IReplySessionChannel> >();

            // link the channel directly to the server.
            // this is a hack designed to work around a bug in the WCF framework that results in lost requests during stress testing.
            if (bindingElement.ServiceHost != null)
            {
                if (bindingElement.ServiceHost.Server is DiscoveryServerBase)
                {
                    m_callback = new DiscoveryEndpoint(bindingElement.ServiceHost);
                }
                else
                {
                    m_callback = new SessionEndpoint(bindingElement.ServiceHost);
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Create a R6S API instance with optional remember me option.
        /// </summary>
        /// <param name="email">
        /// Email address of a Ubisoft account.
        /// </param>
        /// <param name="password">
        /// Password of a Ubisoft account.
        /// </param>
        /// <param name="rememberMe">
        /// Option for Ubisoft to remember this instance's session (can be changed over time by <see cref="RememberMe"/>.
        /// </param>
        public R6Api(string email, string password, bool rememberMe)
        {
            if (string.IsNullOrWhiteSpace(email))
            {
                throw new ArgumentNullException(this.GetType().FullName, "Email address cannot be null or empty.");
            }
            else if (string.IsNullOrWhiteSpace(password))
            {
                throw new ArgumentNullException(this.GetType().FullName, "Password cannot be null or empty.");
            }

            _session                    = new SessionEndpoint(email, password, rememberMe);
            Profile                     = new ProfileEndpoint(_session);
            PlayerProgression           = new PlayerProgressionEndpoint(_session);
            Player                      = new PlayerEndpoint(_session);
            PlayersSkillRecordsEndpoint = new PlayersSkillRecordsEndpoint(_session);
            PlayerStatisticsEndpoint    = new PlayerStatisticsEndpoint(_session);
        }