public static async Task <bool> ConnectUser(IChannelSettings settings)
        {
            bool result = false;

            ChannelSession.Settings = settings;

            try
            {
                MixerConnection connection = await MixerConnection.ConnectViaOAuthToken(settings.OAuthToken);

                if (connection != null)
                {
                    ChannelSession.Connection = new MixerConnectionWrapper(connection);
                    result = await ChannelSession.InitializeInternal(ChannelSession.Settings.IsStreamer, ChannelSession.Settings.Channel.user.username);
                }
            }
            catch (RestServiceRequestException ex)
            {
                Util.Logger.Log(ex);
                result = await ChannelSession.ConnectUser(ChannelSession.StreamerScopes, settings.IsStreamer?null : settings.Channel.user.username);
            }
            catch (Exception ex)
            {
                Util.Logger.Log(ex);
            }

            return(result);
        }
        public static async Task <bool> ConnectUser(IEnumerable <OAuthClientScopeEnum> scopes, string channelName = null)
        {
            try
            {
                MixerConnection connection = await MixerConnection.ConnectViaLocalhostOAuthBrowser(ChannelSession.ClientID, scopes, false, loginSuccessHtmlPageFilePath : OAuthServiceBase.LoginRedirectPageFileName);

                if (connection != null)
                {
                    ChannelSession.Connection = new MixerConnectionWrapper(connection);
                    return(await ChannelSession.InitializeInternal((channelName == null), channelName));
                }
            }
            catch (Exception ex)
            {
                Util.Logger.Log(ex);
            }
            return(false);
        }