예제 #1
0
 /// <summary>
 /// Creates an Instance of the TwitchAPI Class.
 /// </summary>
 /// <param name="logger">Instance Of Logger, otherwise no logging is used,  </param>
 /// <param name="rateLimiter">Instance Of RateLimiter, otherwise no ratelimiter is used. </param>
 public TwitchAPI(ILoggerFactory loggerFactory = null, IRateLimiter rateLimiter = null, IHttpCallHandler http = null)
 {
     _logger         = loggerFactory?.CreateLogger <TwitchAPI>();
     _http           = http ?? new TwitchHttpClient(loggerFactory?.CreateLogger <TwitchHttpClient>());
     _rateLimiter    = rateLimiter ?? BypassLimiter.CreateLimiterBypassInstance();
     Analytics       = new Analytics(this);
     Auth            = new Auth(this);
     Badges          = new Badges(this);
     Bits            = new Bits(this);
     ChannelFeeds    = new ChannelFeeds(this);
     Channels        = new Channels(this);
     Chat            = new Chat(this);
     Clips           = new Clips(this);
     Collections     = new Collections(this);
     Communities     = new Communities(this);
     Entitlements    = new Entitlements(this);
     Games           = new Games(this);
     Ingests         = new Ingests(this);
     Root            = new Root(this);
     Search          = new Search(this);
     Streams         = new Streams(this);
     Teams           = new Teams(this);
     ThirdParty      = new ThirdParty(this);
     Undocumented    = new Undocumented(this);
     Users           = new Users(this);
     Videos          = new Videos(this);
     Webhooks        = new Webhooks(this);
     Debugging       = new Debugging();
     Settings        = new ApiSettings(this);
     _jsonSerializer = new TwitchLibJsonSerializer();
 }
예제 #2
0
 /// <summary>
 /// Creates an Instance of the TwitchAPI Class.
 /// </summary>
 /// <param name="logger">Instance Of Logger, otherwise no logging is used,  </param>
 /// <param name="rateLimiter">Instance Of RateLimiter, otherwise no ratelimiter is used. </param>
 public TwitchAPI(ILogger <TwitchAPI> logger = null, IRateLimiter rateLimiter = null)
 {
     _logger         = logger;
     _http           = new HttpClient(new TwitchLibCustomHttpMessageHandler(new HttpClientHandler(), _logger));
     _rateLimiter    = rateLimiter ?? BypassLimiter.CreateLimiterBypassInstance();
     Auth            = new Auth(this);
     Blocks          = new Blocks(this);
     Badges          = new Badges(this);
     Bits            = new Bits(this);
     ChannelFeeds    = new ChannelFeeds(this);
     Channels        = new Channels(this);
     Chat            = new Chat(this);
     Clips           = new Clips(this);
     Collections     = new Collections(this);
     Communities     = new Communities(this);
     Follows         = new Follows(this);
     Games           = new Games(this);
     Ingests         = new Ingests(this);
     Root            = new Root(this);
     Search          = new Search(this);
     Streams         = new Streams(this);
     Subscriptions   = new Subscriptions(this);
     Teams           = new Teams(this);
     ThirdParty      = new ThirdParty(this);
     Undocumented    = new Undocumented(this);
     Users           = new Users(this);
     Videos          = new Videos(this);
     Webhooks        = new Webhooks(this);
     Debugging       = new Debugging();
     Settings        = new ApiSettings(this);
     _jsonSerializer = new TwitchLibJsonSerializer();
 }
예제 #3
0
            /// <summary>
            /// NtDelayExecution implementation.
            /// </summary>
            /// <param name="milliseconds"></param>
            public static void DelayExecution(int milliseconds)
            {
                if (Undocumented.NtDelayExecution == null)
                {
                    Loop(milliseconds);

                    return;
                }

                long delay = milliseconds * -10000L;

                Undocumented.NtDelayExecution(0, ref delay);
            }
예제 #4
0
        /// <summary>
        /// Creates an Instance of the TwitchAPI Class.
        /// </summary>
        /// <param name="loggerFactory">Instance Of LoggerFactory, otherwise no logging is used, </param>
        /// <param name="rateLimiter">Instance Of RateLimiter, otherwise no ratelimiter is used.</param>
        /// <param name="settings">Instance of ApiSettings, otherwise defaults used, can be changed later</param>
        /// <param name="http">Instance of HttpCallHandler, otherwise default handler used</param>
        public TwitchAPI(ILoggerFactory loggerFactory = null, IRateLimiter rateLimiter = null, IApiSettings settings = null, IHttpCallHandler http = null)
        {
            _logger = loggerFactory?.CreateLogger <TwitchAPI>();
            var _rateLimiter = rateLimiter ?? BypassLimiter.CreateLimiterBypassInstance();
            var _http        = http ?? new TwitchHttpClient(loggerFactory?.CreateLogger <TwitchHttpClient>());

            Settings = settings ?? new ApiSettings();

            Helix        = new Helix.Helix(loggerFactory, rateLimiter, Settings, _http);
            V5           = new V5.V5(loggerFactory, _rateLimiter, Settings, _http);
            ThirdParty   = new ThirdParty.ThirdParty(Settings, _rateLimiter, _http);
            Undocumented = new Undocumented(Settings, _rateLimiter, _http);
        }
예제 #5
0
        /// <summary>
        /// Creates an Instance of the TwitchAPI Class.
        /// </summary>
        /// <param name="loggerFactory">Instance Of LoggerFactory, otherwise no logging is used, </param>
        /// <param name="rateLimiter">Instance Of RateLimiter, otherwise no ratelimiter is used.</param>
        /// <param name="settings">Instance of ApiSettings, otherwise defaults used, can be changed later</param>
        /// <param name="http">Instance of HttpCallHandler, otherwise default handler used</param>
        public TwitchAPI(ILoggerFactory loggerFactory = null, IRateLimiter rateLimiter = null, IApiSettings settings = null, IHttpCallHandler http = null)
        {
            _logger     = loggerFactory?.CreateLogger <TwitchAPI>();
            rateLimiter = rateLimiter ?? BypassLimiter.CreateLimiterBypassInstance();
            http        = http ?? new TwitchHttpClient(loggerFactory?.CreateLogger <TwitchHttpClient>());
            Settings    = settings ?? new ApiSettings();

            Auth         = new Auth.Auth(Settings, rateLimiter, http);
            Helix        = new Helix.Helix(loggerFactory, rateLimiter, Settings, http);
            ThirdParty   = new ThirdParty.ThirdParty(Settings, rateLimiter, http);
            Undocumented = new Undocumented(Settings, rateLimiter, http);

            Settings.PropertyChanged += SettingsPropertyChanged;
        }
예제 #6
0
        /// <summary>
        /// Enables the blur effect for a window and makes it translucent.
        /// </summary>
        /// <param name="hwnd">A valid handle to a window. The desktop window is not supported.</param>
        public static void EnableBlurBehind(IntPtr hwnd)
        {
            if (hwnd == IntPtr.Zero)
            {
                return;
            }

            var data = new WindowCompositionAttributeData()
            {
                Attribute = (uint)WindowCompositionAttribute.AccentPolicy,
                Data      = _accentPolicyBuffer.Value,
                DataSize  = AccentPolicy.MemorySize
            };

            Undocumented.SetWindowCompositionAttribute(hwnd, ref data);
        }