Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new <see cref="Gw2Client"/>.
        /// </summary>
        /// <param name="connection">The connection used to make requests, see <see cref="IConnection"/>.</param>
        /// <exception cref="ArgumentNullException"><paramref name="connection"/> is <see langword="null"/>.</exception>
        public Gw2Client(IConnection connection)
        {
            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }

            this.mumble = new Gw2MumbleClient(connection.MumbleClientReaderFactory);
            this.webApi = new Gw2WebApiClient(connection, this);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new <see cref="Gw2Client"/>.
        /// </summary>
        /// <param name="connection">The connection used to make requests, see <see cref="IConnection"/>.</param>
        /// <exception cref="ArgumentNullException"><paramref name="connection"/> is <c>null</c>.</exception>
        public Gw2Client(IConnection connection) :
            base(connection, null)
        {
            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }

            this.Gw2Client = this;
            this.mumble    = new Gw2MumbleClient(connection, this.Gw2Client);
            this.webApi    = new Gw2WebApiClient(connection, this.Gw2Client);
        }
Ejemplo n.º 3
0
        public ManagedConnection(string accessToken, ICacheMethod webApiCache, ICacheMethod renderCache = null, TimeSpan?renderCacheDuration = null)
        {
            string ua = $"BlishHUD/{Program.OverlayVersion}";

            _internalConnection = new Connection(accessToken,
                                                 GameService.Overlay.UserLocale.Value,
                                                 webApiCache,
                                                 renderCache,
                                                 renderCacheDuration ?? TimeSpan.MaxValue,
                                                 ua);

            _internalClient = new Gw2Client(_internalConnection).WebApi;

            Logger.Debug("Created managed Gw2Sharp connection {useragent}.", ua);

            SetupListeners();
        }