public IBookCapture CreateBookCaptureService(int rule) { IBookCapture bookCapture; switch (rule) { case 1: bookCapture = new BiqugeCapture(); break; case 2: bookCapture = new LiteratureForeignCapture(); break; default: throw new UserFriendlyException("指定的[rule]没有对应的实现!"); } return(bookCapture); }
/// <summary> /// 获取书本抓取服务实例 /// </summary> /// <param name="rule"></param> /// <returns></returns> private IBookCapture GetBookCaptureService(int rule) { WebSiteSearch webSiteSearchEnum = (WebSiteSearch)rule; IBookCapture bookCapture; switch (webSiteSearchEnum) { case WebSiteSearch.笔趣阁: bookCapture = new BiqugeCapture(); break; case WebSiteSearch.外国文学: bookCapture = new LiteratureForeignCapture(); break; case WebSiteSearch.占个坑: default: bookCapture = new BiqugeCapture(); break; } return(bookCapture); }