Exemple #1
0
        private void addToTweetRaidQueue(string raidID, RaidData raiditem)
        {
            if (!tweetraidID.ContainsKey(raidID))
            {
                if (tweetraidIDqueue.Count > queueLimit)
                {
                    tweetraidID.Remove(tweetraidIDqueue.Dequeue());
                }

                tweetraidIDqueue.Enqueue(raidID);
                tweetraidID.Add(raidID, raiditem);
                addToListView(raidID, raiditem.Name);
            }
        }
Exemple #2
0
        public void refreshRaidInfoData()
        {
            raidInfoList.Clear();

            var             raidtable    = raidDataTableAdapter.GetData();
            List <raidItem> raidItemList = new List <raidItem>();

            foreach (DataRow row in raidtable.Rows)
            {
                RaidData temp = new RaidData((int)row[0], (string)row[1], (string)row[2], (byte[])row[3]);
                raidInfoList.Add((int)row[0], temp);

                raidItemList.Add(new raidItem {
                    id = (int)row[0], name = (string)row[1]
                });
            }

            this.raidInfoListBox.DataSource = raidItemList;
        }
Exemple #3
0
        private async Task refreshraids()
        {
            int counter = 1;

            while (true)
            {
                testtextbox.Text  = raidUserList.Count + "\r\n";
                testtextbox.Text += counter + "\r\n";
                if (raidUserList.Count > 0)
                {
                    if (counter > raidUserList.Count)
                    {
                        counter = 1;
                    }
                    testtextbox.Text += (DateTime.Now - savedTime).TotalSeconds + "";
                    if ((DateTime.Now - savedTime).TotalSeconds > 2)
                    {
                        List <ITweet> tweets = await Task.Run(() => SearchRaids(counter));

                        testtextbox.Text = tweets.Count + "";
                        foreach (var tweet in tweets)
                        {
                            int raidID = tweet.Text.LastIndexOf(" :参戦ID");
                            if (raidID != -1 &&
                                (savedTime - tweet.CreatedAt).TotalSeconds <= 30 + (2 * raidUserList.Count))
                            {
                                RaidData temp = new RaidData(raidInfoList[counter].ID, raidInfoList[counter].Name, raidInfoList[counter].Jname, raidInfoList[counter].Image);
                                addToTweetRaidQueue(tweet.Text.Substring(raidID - 8, 8), temp);
                                checkListViewLimit();
                                tweetID = tweet.Id;
                            }
                        }

                        savedTime = DateTime.Now;
                        counter++;
                    }
                }
            }
        }