Пример #1
0
        private void buttonListGen_Click(object sender, EventArgs e)
        {
            Log.Info("开始获取排行");
            BiliParse.SortType sort = (BiliParse.SortType)Enum.Parse(typeof(BiliParse.SortType), comboBoxListSort.SelectedItem.ToString(), false);
            int needpage            = Convert.ToInt32(comboBoxListNum.Text) / 20;

            if ((Convert.ToInt32(comboBoxListNum.Text) % 20) != 0)
            {
                needpage += 1;
            }

            List <string> ss = new List <string>();

            string czone = comboBoxListZone.Text;
            string tzone = Regex.Match(czone, @"\d+").Value;

            //czone.Split('(')[0].Split(')')[1];
            //http://stackoverflow.com/questions/4734116/find-and-extract-a-number-from-a-string
            //string.Join("", phone.ToCharArray().Where(Char.IsDigit));
            //resultString = Regex.Match(subjectString, @"\d+").Value;

            for (int i = 1; i <= needpage; i++)
            {
                List <string> sts = BiliParse.GetListOld(sort, int.Parse(tzone), i, dateTimePickerFrom.Value, dateTimePickerTo.Value);
                if (sts != null)
                {
                    ss.AddRange(sts);
                }
                else
                {
                    break;
                }
            }

            textBoxAV.Text = "";

            for (int i = 0; i < Convert.ToInt32(comboBoxListNum.Text); i++)
            {
                try
                {
                    textBoxAV.Text += ss[i] + "\r\n";
                }
                catch
                {
                    Log.Warn("选定区间内视频数量不满" + comboBoxListNum.Text + "个!仅有" + i.ToString() + "个。");
                    break;
                }
            }
            Log.Info("获取排行完成");
        }
Пример #2
0
        private void buttonGenOld_Click(object sender, RoutedEventArgs e)
        {
            log.Info("开始获取排行");

            BiliParse.SortType sort = (BiliParse.SortType)Enum.Parse(typeof(BiliParse.SortType), comboBoxListSort.SelectedItem.ToString(), false);
            int needpage            = Convert.ToInt32(comboBoxListNum.Text) / 20;

            if ((Convert.ToInt32(comboBoxListNum.Text) % 20) != 0)
            {
                needpage += 1;
            }

            List <string> ss = new List <string>();

            string czone = comboBoxListZone.Text;
            string tzone = Regex.Match(czone, @"\d+").Value;

            for (int i = 1; i <= needpage; i++)
            {
                List <string> sts = BiliParse.GetListOld(sort, int.Parse(tzone), i, datePickerFrom.SelectedDate.Value, datePickerTo.SelectedDate.Value);
                if (sts != null)
                {
                    ss.AddRange(sts);
                }
                else
                {
                    break;
                }
            }

            SharedData.AVs = "";

            for (int i = 0; i < Convert.ToInt32(comboBoxListNum.Text); i++)
            {
                try
                {
                    SharedData.AVs += ss[i] + "\r\n";
                }
                catch
                {
                    log.Warn("选定区间内视频数量不满" + comboBoxListNum.Text + "个!仅有" + i.ToString() + "个。");
                    break;
                }
            }
        }