//private static WebDataManager<int, Ebookdz_PostDetail> CreateWebDataManager(XElement xe) private static WebDataManager <Ebookdz_PostDetail_v2> CreateWebDataManager(XElement xe) { //WebDataManager<int, Ebookdz_PostDetail> detailWebDataManager = new WebDataManager<int, Ebookdz_PostDetail>(); WebDataManager <Ebookdz_PostDetail_v2> detailWebDataManager = new WebDataManager <Ebookdz_PostDetail_v2>(); //detailWebDataManager.WebLoadDataManager = new WebLoadDataManager<Ebookdz_PostDetail>(); detailWebDataManager.WebLoadDataManager = new WebLoadDataManager <Ebookdz_PostDetail_v2>(); UrlCache urlCache = UrlCache.Create(xe); if (urlCache != null) { urlCache.GetUrlSubDirectoryFunction = httpRequest => (_GetPostDetailKey(httpRequest) / 1000 * 1000).ToString(); detailWebDataManager.WebLoadDataManager.UrlCache = urlCache; } detailWebDataManager.WebLoadDataManager.InitLoadFromWeb = EbookdzLogin_v2.InitLoadFromWeb; detailWebDataManager.WebLoadDataManager.GetHttpRequestParameters = EbookdzLogin_v2.GetHttpRequestParameters; detailWebDataManager.WebLoadDataManager.GetData = GetData; detailWebDataManager.GetKeyFromHttpRequest = GetPostDetailKey; //detailWebDataManager.LoadImages = DownloadPrint.LoadImages; // IPost detailWebDataManager.LoadImages = data => { data.LoadImages(); }; //detailWebDataManager.DocumentStore = MongoDocumentStore<int, Ebookdz_PostDetail>.Create(xe); detailWebDataManager.DocumentStore = MongoDocumentStore <Ebookdz_PostDetail_v2> .Create(xe); return(detailWebDataManager); }
public static void Init(bool test = false) { XElement xe; if (!test) xe = XmlConfig.CurrentConfig.GetElement("Vosbooks"); else { pb.Trace.WriteLine("Vosbooks init for test"); xe = XmlConfig.CurrentConfig.GetElement("Vosbooks_Test"); } WebManagerCreator<Vosbooks_PostDetail> webManagerCreator = new WebManagerCreator<Vosbooks_PostDetail>(); //webManagerCreator.InitLoadFromWeb webManagerCreator.GetHttpRequestParameters = Vosbooks_v2.GetHttpRequestParameters; webManagerCreator.GetHeaderPageData = GetHeaderPageData; webManagerCreator.HeaderPageNominalType = typeof(PostHeaderDataPage_v1); webManagerCreator.GetHttpRequestPage = GetHttpRequestPage; __headerWebDataPageManager = webManagerCreator.CreateHeaderWebDataPageManager(xe.zXPathElement("Header")); webManagerCreator.DetailCacheGetUrlSubDirectory = httpRequest => (_GetPostDetailKey(httpRequest) / 1000 * 1000).ToString(); webManagerCreator.GetDetailData = GetDetailData; webManagerCreator.GetDetailKeyFromHttpRequest = GetPostDetailKey; webManagerCreator.LoadDetailImages = data => { data.LoadImages(); }; __detailWebDataManager = webManagerCreator.CreateDetailWebDataManager(xe.zXPathElement("Detail")); //__webHeaderDetailManager = new WebHeaderDetailManager_v2<Vosbooks_PostDetail_v3>(); //__webHeaderDetailManager.HeaderDataPageManager = __headerWebDataPageManager; //__webHeaderDetailManager.DetailDataManager = __detailWebDataManager; __webHeaderDetailManager = webManagerCreator.CreateWebHeaderDetailManager(); //ServerManagers_v2.Add("Vosbooks", CreateServerManager()); }
//TDetailData Vosbooks_PostDetail_v2 public WebDataManager <TDetailData> CreateDetailWebDataManager(XElement xe) { WebDataManager <TDetailData> detailWebDataManager = new WebDataManager <TDetailData>(); detailWebDataManager.WebLoadDataManager = new WebLoadDataManager <TDetailData>(); UrlCache urlCache = UrlCache.Create(xe); if (urlCache != null) { urlCache.GetUrlSubDirectoryFunction = _detailCacheGetUrlSubDirectory; detailWebDataManager.WebLoadDataManager.UrlCache = urlCache; } detailWebDataManager.WebLoadDataManager.InitLoadFromWeb = _initLoadFromWeb; detailWebDataManager.WebLoadDataManager.GetHttpRequestParameters = _getHttpRequestParameters; detailWebDataManager.WebLoadDataManager.GetData = _getDetailData; detailWebDataManager.GetKeyFromHttpRequest = _getDetailKeyFromHttpRequest; detailWebDataManager.LoadImages = _loadDetailImages; detailWebDataManager.DocumentStore = MongoDocumentStore <TDetailData> .Create(xe); _detailWebDataManager = detailWebDataManager; return(detailWebDataManager); }
public static void Init(XElement xe) { //__detailWebDataManager = CreateWebDataManager(XmlConfig.CurrentConfig.GetElement("Vosbooks/Detail")); __detailWebDataManager = CreateWebDataManager(xe.zXPathElement("Detail")); __webHeaderDetailManager = new WebHeaderDetailManager_v2 <Vosbooks_PostDetail_v2>(); __webHeaderDetailManager.HeaderDataPageManager = Vosbooks_HeaderManager_v2.HeaderWebDataPageManager; __webHeaderDetailManager.DetailDataManager = __detailWebDataManager; }
static MagazinesGratuits_DetailManager_v1() { __detailWebDataManager = CreateWebDataManager(XmlConfig.CurrentConfig.GetElement("MagazinesGratuits/Detail")); __webHeaderDetailManager = new WebHeaderDetailManager <int, MagazinesGratuits_HeaderPage, MagazinesGratuits_PostHeader, string, MagazinesGratuits_PostDetail_v1>(); __webHeaderDetailManager.HeaderDataPageManager = MagazinesGratuits_HeaderManager.HeaderWebDataPageManager; __webHeaderDetailManager.DetailDataManager = __detailWebDataManager; }
protected virtual void CreateDetailWebDataManager(XElement xe) { _detailDataManager = new WebDataManager <TDetailData>(); _detailDataManager.Version = xe.zXPathValue("Version").zTryParseAs(1); UrlCache urlCache = UrlCache.Create(xe); if (urlCache != null) { urlCache.GetUrlSubDirectory = GetDetailCacheUrlSubDirectory; } //if (_detailDataManager.Version <= 3) //{ _detailDataManager.WebLoadDataManager = new WebLoadDataManager <TDetailData>(); _detailDataManager.WebLoadDataManager.UrlCache = urlCache; _detailDataManager.WebLoadDataManager.InitLoadFromWeb = InitLoadFromWeb; _detailDataManager.WebLoadDataManager.GetHttpRequestParameters = GetHttpRequestParameters; _detailDataManager.WebLoadDataManager.GetData = GetDetailData; //} //else //{ // _detailDataManager.WebLoadDataManager_v2 = new WebLoadDataManager_v2<TDetailData>(); // _detailDataManager.WebLoadDataManager_v2.TraceException = true; // _detailDataManager.WebLoadDataManager_v2.UrlCache = urlCache; // _detailDataManager.WebLoadDataManager_v2.InitLoadFromWeb = InitLoadFromWeb; // _detailDataManager.WebLoadDataManager_v2.GetData = GetDetailData_v2; // SetHttpRequestParameters(_detailDataManager.WebLoadDataManager_v2.RequestParameters); //} _detailDataManager.GetKeyFromHttpRequest = GetDetailKey; //_detailDataManager.LoadImages = LoadDetailImages; //if (_detailDataManager.Version < 3) //{ _detailDataManager.DocumentStore = MongoDocumentStore <TDetailData> .Create(xe); //} //else //{ // _detailDataManager.DataStore = MongoDataStore.Create(xe); // MongoDataSerializer<TDetailData> dataSerializer = new MongoDataSerializer<TDetailData>(); // dataSerializer.ItemName = xe.zXPathValue("MongoDocumentItemName"); // _detailDataManager.DataSerializer = dataSerializer; //} //UrlCache imageUrlCache = UrlCache.Create(xe.zXPathElement("Image")); //if (imageUrlCache != null) //{ // //imageUrlCache.GetUrlSubDirectory = GetDetailImageCacheUrlSubDirectory; // //_detailDataManager.WebImageCacheManager = new WebImageCacheManager_v2(imageUrlCache); // _detailDataManager.WebImageCacheManager = new WebImageCacheManager_v3(imageUrlCache); // _detailDataManager.WebImageCacheManager.TraceException = true; // _detailDataManager.GetImageSubDirectory = GetDetailImageCacheUrlSubDirectory; //} }
public static void Init(XElement xe) { //__detailWebDataManager = CreateWebDataManager(XmlConfig.CurrentConfig.GetElement("Ebookdz/Detail")); __detailWebDataManager = CreateWebDataManager(xe.zXPathElement("Detail")); //__webHeaderDetailManager = new WebHeaderDetailManager<int, Ebookdz_HeaderPage, Ebookdz_PostHeader, int, Ebookdz_PostDetail>(); //__webHeaderDetailManager.HeaderDataPageManager = Ebookdz_HeaderManager.HeaderWebDataPageManager; __webHeaderDetailManager = new WebHeaderDetailManager_v2 <Ebookdz_PostDetail_v2>(); __webHeaderDetailManager.HeaderDataPageManager = Ebookdz_HeaderManager_v2.HeaderWebDataPageManager; __webHeaderDetailManager.DetailDataManager = __detailWebDataManager; //__webForumHeaderDetailManager = new WebHeaderDetailManager<int, Ebookdz_HeaderPage, Ebookdz_PostHeader, int, Ebookdz_PostDetail>(); //__webForumHeaderDetailManager.HeaderDataPageManager = Ebookdz_ForumHeaderManager.CurrentForumHeaderManager; __webForumHeaderDetailManager = new WebHeaderDetailManager_v2 <Ebookdz_PostDetail_v2>(); __webForumHeaderDetailManager.HeaderDataPageManager = Ebookdz_ForumHeaderManager_v2.HeaderWebDataPageManager; __webForumHeaderDetailManager.DetailDataManager = __detailWebDataManager; }
private static WebDataManager <MagazinesGratuits_PostDetail_v2> CreateWebDataManager(XElement xe) { WebDataManager <MagazinesGratuits_PostDetail_v2> detailWebDataManager = new WebDataManager <MagazinesGratuits_PostDetail_v2>(); detailWebDataManager.WebLoadDataManager = new WebLoadDataManager <MagazinesGratuits_PostDetail_v2>(); //if (xe.zXPathValue("UseUrlCache").zTryParseAs(false)) //{ // UrlCache urlCache = new UrlCache(xe.zXPathValue("CacheDirectory")); // urlCache.UrlFileNameType = zurl.GetUrlFileNameType(xe.zXPathValue("CacheUrlFileNameType")); // urlCache.GetUrlSubDirectoryFunction = httpRequest => (GetPostDetailKey(httpRequest) / 1000 * 1000).ToString(); // detailWebDataManager.WebLoadDataManager.UrlCache = urlCache; //} UrlCache urlCache = UrlCache.Create(xe); if (urlCache != null) { urlCache.GetUrlSubDirectoryFunction = GetSubDirectoryKey; detailWebDataManager.WebLoadDataManager.UrlCache = urlCache; } //detailWebDataManager.WebLoadDataManager.InitLoadFromWeb = EbookdzLogin.InitLoadFromWeb; detailWebDataManager.WebLoadDataManager.GetHttpRequestParameters = MagazinesGratuits_v2.GetHttpRequestParameters; detailWebDataManager.WebLoadDataManager.GetData = GetData; detailWebDataManager.GetKeyFromHttpRequest = GetPostDetailKey; //detailWebDataManager.LoadImages = DownloadPrint.LoadImages; detailWebDataManager.LoadImages = data => { data.LoadImages(); }; //if (xe.zXPathValue("UseMongo").zTryParseAs(false)) //{ // MongoDocumentStore<int, Vosbooks_PostDetail> documentStore = new MongoDocumentStore<int, Vosbooks_PostDetail>(xe.zXPathValue("MongoServer"), xe.zXPathValue("MongoDatabase"), xe.zXPathValue("MongoCollection"), xe.zXPathValue("MongoDocumentItemName")); // documentStore.DefaultSort = xe.zXPathValue("MongoDefaultSort"); // detailWebDataManager.DocumentStore = documentStore; //} //documentStore.GetDataKey = headerPage => headerPage.GetKey(); //documentStore.Deserialize = document => (IEnumDataPages_new<int, IHeaderData_new>)BsonSerializer.Deserialize<Vosbooks_HeaderPage>(document); //detailWebDataManager.DocumentStore = MongoDocumentStore<int, Vosbooks_PostDetail>.Create(xe); detailWebDataManager.DocumentStore = MongoDocumentStore <MagazinesGratuits_PostDetail_v2> .Create(xe); return(detailWebDataManager); }
public static void ViewDocuments <TKey, TData>(WebDataManager <TKey, TData> webDataManager, string query = null, string sort = null, int limit = 10, bool loadImage = false) { //RunSource.CurrentRunSource.View(webDataManager.FindDocuments(query, sort: sort, limit: limit, loadImage: loadImage).Select( // data => // { // IPost post = data as IPost; // return new // { // id = post.GetKey(), // loadFromWebDate = post.GetLoadFromWebDate(), // creationDate = post.GetPostCreationDate(), // printType = post.GetPrintType().ToString(), // //category = post.category, // title = post.GetTitle(), // url = post.GetDataHttpRequest().Url, // images = (from image in post.GetImages() select image.Image).ToArray(), // downloadLinks = post.GetDownloadLinks() // }; // } // )); //webDataManager.FindDocuments(query, sort: sort, limit: limit, loadImage: loadImage).Select( // data => // { // IPost post = data as IPost; // return new // { // id = post.GetKey(), // loadFromWebDate = post.GetLoadFromWebDate(), // creationDate = post.GetPostCreationDate(), // printType = post.GetPrintType().ToString(), // //category = post.category, // title = post.GetTitle(), // url = post.GetDataHttpRequest().Url, // images = (from image in post.GetImages() select image.Image).ToArray(), // downloadLinks = post.GetDownloadLinks() // }; // } // ).zView(); webDataManager.FindDocuments(query, sort: sort, limit: limit, loadImage: loadImage).Select(data => CompactPost.Create(data as IPost)).zView(); }
protected virtual void CreateDetailWebDataManager(XElement xe) { _detailWebDataManager = new WebDataManager <TDetailData>(); _detailWebDataManager.WebLoadDataManager = new WebLoadDataManager <TDetailData>(); UrlCache urlCache = UrlCache.Create(xe); if (urlCache != null) { urlCache.GetUrlSubDirectoryFunction = GetDetailCacheUrlSubDirectory; _detailWebDataManager.WebLoadDataManager.UrlCache = urlCache; } _detailWebDataManager.WebLoadDataManager.InitLoadFromWeb = InitLoadFromWeb; _detailWebDataManager.WebLoadDataManager.GetHttpRequestParameters = GetHttpRequestParameters; _detailWebDataManager.WebLoadDataManager.GetData = GetDetailData; _detailWebDataManager.GetKeyFromHttpRequest = GetDetailKey; _detailWebDataManager.LoadImages = LoadDetailImages; _detailWebDataManager.DocumentStore = MongoDocumentStore <TDetailData> .Create(xe); }
public static void Init(bool test = false) { XElement xe; if (!test) { xe = XmlConfig.CurrentConfig.GetElement("Vosbooks"); } else { pb.Trace.WriteLine("Vosbooks init for test"); xe = XmlConfig.CurrentConfig.GetElement("Vosbooks_Test"); } WebManagerCreator <Vosbooks_PostDetail> webManagerCreator = new WebManagerCreator <Vosbooks_PostDetail>(); //webManagerCreator.InitLoadFromWeb webManagerCreator.GetHttpRequestParameters = Vosbooks_v2.GetHttpRequestParameters; webManagerCreator.GetHeaderPageData = GetHeaderPageData; webManagerCreator.HeaderPageNominalType = typeof(PostHeaderDataPage_v1); webManagerCreator.GetHttpRequestPage = GetHttpRequestPage; __headerWebDataPageManager = webManagerCreator.CreateHeaderWebDataPageManager(xe.zXPathElement("Header")); webManagerCreator.DetailCacheGetUrlSubDirectory = httpRequest => (_GetPostDetailKey(httpRequest) / 1000 * 1000).ToString(); webManagerCreator.GetDetailData = GetDetailData; webManagerCreator.GetDetailKeyFromHttpRequest = GetPostDetailKey; webManagerCreator.LoadDetailImages = data => { data.LoadImages(); }; __detailWebDataManager = webManagerCreator.CreateDetailWebDataManager(xe.zXPathElement("Detail")); //__webHeaderDetailManager = new WebHeaderDetailManager_v2<Vosbooks_PostDetail_v3>(); //__webHeaderDetailManager.HeaderDataPageManager = __headerWebDataPageManager; //__webHeaderDetailManager.DetailDataManager = __detailWebDataManager; __webHeaderDetailManager = webManagerCreator.CreateWebHeaderDetailManager(); //ServerManagers_v2.Add("Vosbooks", CreateServerManager()); }
public static void Init(XElement xe) { //__detailWebDataManager = CreateWebDataManager(XmlConfig.CurrentConfig.GetElement("Ebookdz/Detail")); __detailWebDataManager = CreateWebDataManager(xe.zXPathElement("Detail")); //__webHeaderDetailManager = new WebHeaderDetailManager<int, Ebookdz_HeaderPage, Ebookdz_PostHeader, int, Ebookdz_PostDetail>(); //__webHeaderDetailManager.HeaderDataPageManager = Ebookdz_HeaderManager.HeaderWebDataPageManager; __webHeaderDetailManager = new WebHeaderDetailManager_v2<Ebookdz_PostDetail_v2>(); __webHeaderDetailManager.HeaderDataPageManager = Ebookdz_HeaderManager_v2.HeaderWebDataPageManager; __webHeaderDetailManager.DetailDataManager = __detailWebDataManager; //__webForumHeaderDetailManager = new WebHeaderDetailManager<int, Ebookdz_HeaderPage, Ebookdz_PostHeader, int, Ebookdz_PostDetail>(); //__webForumHeaderDetailManager.HeaderDataPageManager = Ebookdz_ForumHeaderManager.CurrentForumHeaderManager; __webForumHeaderDetailManager = new WebHeaderDetailManager_v2<Ebookdz_PostDetail_v2>(); __webForumHeaderDetailManager.HeaderDataPageManager = Ebookdz_ForumHeaderManager_v2.HeaderWebDataPageManager; __webForumHeaderDetailManager.DetailDataManager = __detailWebDataManager; }
private static WebDataManager<MagazinesGratuits_PostDetail_v2> CreateWebDataManager(XElement xe) { WebDataManager<MagazinesGratuits_PostDetail_v2> detailWebDataManager = new WebDataManager<MagazinesGratuits_PostDetail_v2>(); detailWebDataManager.WebLoadDataManager = new WebLoadDataManager<MagazinesGratuits_PostDetail_v2>(); //if (xe.zXPathValue("UseUrlCache").zTryParseAs(false)) //{ // UrlCache urlCache = new UrlCache(xe.zXPathValue("CacheDirectory")); // urlCache.UrlFileNameType = zurl.GetUrlFileNameType(xe.zXPathValue("CacheUrlFileNameType")); // urlCache.GetUrlSubDirectoryFunction = httpRequest => (GetPostDetailKey(httpRequest) / 1000 * 1000).ToString(); // detailWebDataManager.WebLoadDataManager.UrlCache = urlCache; //} UrlCache urlCache = UrlCache.Create(xe); if (urlCache != null) { urlCache.GetUrlSubDirectoryFunction = GetSubDirectoryKey; detailWebDataManager.WebLoadDataManager.UrlCache = urlCache; } //detailWebDataManager.WebLoadDataManager.InitLoadFromWeb = EbookdzLogin.InitLoadFromWeb; detailWebDataManager.WebLoadDataManager.GetHttpRequestParameters = MagazinesGratuits_v2.GetHttpRequestParameters; detailWebDataManager.WebLoadDataManager.GetData = GetData; detailWebDataManager.GetKeyFromHttpRequest = GetPostDetailKey; //detailWebDataManager.LoadImages = DownloadPrint.LoadImages; detailWebDataManager.LoadImages = data => { data.LoadImages(); }; //if (xe.zXPathValue("UseMongo").zTryParseAs(false)) //{ // MongoDocumentStore<int, Vosbooks_PostDetail> documentStore = new MongoDocumentStore<int, Vosbooks_PostDetail>(xe.zXPathValue("MongoServer"), xe.zXPathValue("MongoDatabase"), xe.zXPathValue("MongoCollection"), xe.zXPathValue("MongoDocumentItemName")); // documentStore.DefaultSort = xe.zXPathValue("MongoDefaultSort"); // detailWebDataManager.DocumentStore = documentStore; //} //documentStore.GetDataKey = headerPage => headerPage.GetKey(); //documentStore.Deserialize = document => (IEnumDataPages_new<int, IHeaderData_new>)BsonSerializer.Deserialize<Vosbooks_HeaderPage>(document); //detailWebDataManager.DocumentStore = MongoDocumentStore<int, Vosbooks_PostDetail>.Create(xe); detailWebDataManager.DocumentStore = MongoDocumentStore<MagazinesGratuits_PostDetail_v2>.Create(xe); return detailWebDataManager; }
public static void Init(XElement xe) { __detailWebDataManager = CreateWebDataManager(xe.zXPathElement("Detail")); __webHeaderDetailManager = CreateWebHeaderDetailManager(); }
public static void Init(XElement xe) { //__detailWebDataManager = CreateWebDataManager(XmlConfig.CurrentConfig.GetElement("Vosbooks/Detail")); __detailWebDataManager = CreateWebDataManager(xe.zXPathElement("Detail")); __webHeaderDetailManager = new WebHeaderDetailManager_v2<Vosbooks_PostDetail_v2>(); __webHeaderDetailManager.HeaderDataPageManager = Vosbooks_HeaderManager_v2.HeaderWebDataPageManager; __webHeaderDetailManager.DetailDataManager = __detailWebDataManager; }
//private static WebDataManager<int, Ebookdz_PostDetail> CreateWebDataManager(XElement xe) private static WebDataManager<Ebookdz_PostDetail_v2> CreateWebDataManager(XElement xe) { //WebDataManager<int, Ebookdz_PostDetail> detailWebDataManager = new WebDataManager<int, Ebookdz_PostDetail>(); WebDataManager<Ebookdz_PostDetail_v2> detailWebDataManager = new WebDataManager<Ebookdz_PostDetail_v2>(); //detailWebDataManager.WebLoadDataManager = new WebLoadDataManager<Ebookdz_PostDetail>(); detailWebDataManager.WebLoadDataManager = new WebLoadDataManager<Ebookdz_PostDetail_v2>(); UrlCache urlCache = UrlCache.Create(xe); if (urlCache != null) { urlCache.GetUrlSubDirectoryFunction = httpRequest => (_GetPostDetailKey(httpRequest) / 1000 * 1000).ToString(); detailWebDataManager.WebLoadDataManager.UrlCache = urlCache; } detailWebDataManager.WebLoadDataManager.InitLoadFromWeb = EbookdzLogin_v2.InitLoadFromWeb; detailWebDataManager.WebLoadDataManager.GetHttpRequestParameters = EbookdzLogin_v2.GetHttpRequestParameters; detailWebDataManager.WebLoadDataManager.GetData = GetData; detailWebDataManager.GetKeyFromHttpRequest = GetPostDetailKey; //detailWebDataManager.LoadImages = DownloadPrint.LoadImages; // IPost detailWebDataManager.LoadImages = data => { data.LoadImages(); }; //detailWebDataManager.DocumentStore = MongoDocumentStore<int, Ebookdz_PostDetail>.Create(xe); detailWebDataManager.DocumentStore = MongoDocumentStore<Ebookdz_PostDetail_v2>.Create(xe); return detailWebDataManager; }