<commit_before>﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Net;
using TweetSharp;

namespace Ocell.Library.Twitter
{
    public class UserProvider : IUserProvider
    {
        public SafeObservable<TwitterUser> Users { get; set; }
        public UserToken User { get; set; }
        public bool GetFollowers { get; set; }
        public bool GetFollowing { get; set; }
        private ITwitterService _service;

        public UserProvider()
        {
            GetFollowers = true;
            GetFollowing = true;
            Users = new SafeObservable<TwitterUser>();
        }

        private void GetService()
        {
            if (User == null)
                _service = ServiceDispatcher.GetDefaultService();
            else
                _service = ServiceDispatcher.GetService(User);
        }

        public void Start()
        {
            if (_service == null)
                GetService();

            if(GetFollowing)
                _service.ListFriends(-1, ReceiveList);
            if (GetFollowers)
                _service.ListFollowers(-1, ReceiveList);
        }

        private void ReceiveList(TwitterCursorList<TwitterUser> users, TwitterResponse response)
        {
            bool finish = false;
            if (users == null || response.StatusCode != HttpStatusCode.OK)
            {
                if (Error != null)
                    Error(this, response);
            }<commit_msg>Bug fix<commit_after>﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Net;
using TweetSharp;

namespace Ocell.Library.Twitter
{
    public class UserProvider : IUserProvider
    {
        public SafeObservable<TwitterUser> Users { get; set; }
        public UserToken User { get; set; }
        public bool GetFollowers { get; set; }
        public bool GetFollowing { get; set; }
        private ITwitterService _service;

        public UserProvider()
        {
            GetFollowers = true;
            GetFollowing = true;
            Users = new SafeObservable<TwitterUser>();
        }

        private void GetService()
        {
            if (User == null)
                _service = ServiceDispatcher.GetDefaultService();
            else
                _service = ServiceDispatcher.GetService(User);
        }

        public void Start()
        {
            if (_service == null)
                GetService();

            if(GetFollowing)
                _service.ListFriends(-1, ReceiveList);
            if (GetFollowers)
                _service.ListFollowers(-1, ReceiveList);
        }

        private void ReceiveList(TwitterCursorList<TwitterUser> users, TwitterResponse response)
        {
            bool finish = false;
            if (users == null || response.StatusCode != HttpStatusCode.OK)
            {
                if (Error != null)
                    Error(this, response);
                finish = true;
                return;
            }
{'fraction_non_alphanumeric': 0.08358110340270895, 'fraction_numerical': 0.0013214403700033035, 'mean_word_length': 1.7084078711985689, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5697255', 'n_tokens_mistral': 775, 'n_tokens_neox': 728, 'n_words': 188}