예제 #1
0
        private void FinishScenario()
        {
            var measurement = new Measurement(DateTime.UtcNow.Ticks, _stopwatch.ElapsedMilliseconds);

            switch (_scenario)
            {
            case -1:
                // Don't record the first measurement; it's always very high
                _scenario++;
                break;

            case 0:
                BeginGetResponse.Add(measurement);
                _scenario++;
                break;

            case 1:
                BeginGetCompressedResponse.Add(measurement);
                _scenario++;
                break;

            case 2:
                WebClient.Add(measurement);
                _scenario++;
                break;

            case 3:
                GzipWebClient.Add(measurement);
#if SHARPGIS
                _scenario++;
                break;

            case 4:
                SharpGIS.Add(measurement);
#endif
                _scenario = 0;
                break;

            default:
                Debug.Assert(false);
                break;
            }

            StartNextScenario();
        }
예제 #2
0
        public static ResultData GetDataSinglePages(IEnumerable <string> list)
        {
            ReportStock rs = new ReportStock();
            WebClient   wc = new WebClient()
            {
                AddUserAgent = true
            };

            rs.Add(wc);
            var rawler = wc.Add(new Data()).Add(new RawlerAutoSingelPage()
            {
                SampleUrls = list.ToList()
            }).GetRoot();

            rawler.Run();
            var xaml = rawler.ToXAML();

            return(new ResultData()
            {
                Data = rawler.GetDescendantRawler().OfType <Data>(), Reports = rs.ReportList
            });
        }
예제 #3
0
        /// <summary>
        /// urlとHtmlを入力として、結果を返す。
        /// </summary>
        /// <param name="url"></param>
        /// <param name="html"></param>
        /// <param name="EnableGetSubUrlLink"></param>
        /// <param name="takeNum"></param>
        /// <returns></returns>
        public static ResultData GetDataListByHtml(string url, string html, bool EnableGetSubUrlLink, int takeNum)
        {
            ReportStock rs = new ReportStock();
            WebClient   wc = new WebClient()
            {
                AddUserAgent = true
            };

            rs.Add(wc);
            var rawler = wc.Add(Page.CreatePage(url, html).AddRange(
                                    new RawlerAutoListDataWrite()
            {
                TakeNum = takeNum, EnableGetSubUrlLink = EnableGetSubUrlLink
            },
                                    new RawlerAutoTable()).GetRoot());

            rawler.Run();
            return(new ResultData()
            {
                Data = rawler.GetDescendantRawler().OfType <Data>().DataSort().ToArray(), Reports = rs.ReportList
            });
        }