コード例 #1
0
        //was work2 before
        public async Task InfluencersFriendsSearch(IUser user, int index)
        {
            try
            {
                var timeline = await ProFeedTwitterModel.GetUserTimeline(user);

                var fullUser = await ProFeedTwitterModel.GetUserByID(user.Id);

                //need to test
                await taskSemaphore.WaitAsync();

                SearchData.FinalList.Add(new TProfile());
                var inBusiness = ProFeedAlgorithm.IsProfetional(timeline, SearchData.SearchKeys, SearchData.FinalList.Last());
                //to here
                if (inBusiness > ProFeedApiParameters.ProFeedAppParameters.PRO_RANGE)
                {
                    InsertDataToTProfile(user, index);
                    SearchData.FinalList.Last().Profetional = true;
                    ProFeedAlgorithm.RankingStage(fullUser, SearchData.FinalList.Last());
                }
                else
                {
                    SearchData.FinalList.Remove(SearchData.FinalList.Last());
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
                taskSemaphore.Release();
            }
        }
コード例 #2
0
        //was work before
        public async Task InfluencersToProfile(IUser user, int index)
        {
            try
            {
                var timeline = await ProFeedTwitterModel.GetUserTimeline(user);

                var fullUser = await ProFeedTwitterModel.GetUserByID(user.Id);

                //need to test
                await taskSemaphore.WaitAsync();

                SearchData.FinalList.Add(new TProfile());
                var inBusiness = ProFeedAlgorithm.IsProfetional(timeline, SearchData.SearchKeys, SearchData.FinalList.Last());
                //to here
                InsertDataToTProfile(user, index);
                if (inBusiness > ProFeedApiParameters.ProFeedAppParameters.MIN_RANGE)
                {
                    SearchData.FinalList.Last().Profetional = true;
                    if (!ProFeedAlgorithm.Profetionals.Equals(user))
                    {
                        if (ProFeedAlgorithm.Profetionals.Count > 4)
                        {
                            ProFeedAlgorithm.Profetionals.RemoveAt(0);
                        }
                        ProFeedAlgorithm.Profetionals.Add(user);
                    }
                }
                ProFeedAlgorithm.RankingStage(fullUser, SearchData.FinalList.Last());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                taskSemaphore.Release();
            }
        }