Exemple #1
0
        private static Ebookdz_SubForumManager_v1 CreateSubForumManager(XElement xe)
        {
            //WebDataPageManager<int, Ebookdz_ForumPage, Ebookdz_Forum> forumWebDataPageManager = new WebDataPageManager<int, Ebookdz_ForumPage, Ebookdz_Forum>();
            Ebookdz_SubForumManager_v1 subForumManager = new Ebookdz_SubForumManager_v1();

            subForumManager.WebLoadDataManager = new WebLoadDataManager <Ebookdz_ForumPage_v1>();
            //if (xe.zXPathValueBool("UseUrlCache", false))
            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();
                subForumManager.WebLoadDataManager.UrlCache = urlCache;
            }
            subForumManager.WebLoadDataManager.InitLoadFromWeb          = EbookdzLogin_v1.InitLoadFromWeb;
            subForumManager.WebLoadDataManager.GetHttpRequestParameters = EbookdzLogin_v1.GetHttpRequestParameters;
            subForumManager.WebLoadDataManager.GetData = GetData;
            //detailWebDataManager.GetKeyFromHttpRequest = GetPostDetailKey;
            //detailWebDataManager.LoadImages = DownloadPrint.LoadImages; // IPost

            //if (xe.zXPathValueBool("UseMongo", false))
            if (xe.zXPathValue("UseMongo").zTryParseAs(false))
            {
                MongoDocumentStore_v4 <int, Ebookdz_ForumPage_v1> documentStore = new MongoDocumentStore_v4 <int, Ebookdz_ForumPage_v1>(xe.zXPathValue("MongoServer"), xe.zXPathValue("MongoDatabase"), xe.zXPathValue("MongoCollection"), xe.zXPathValue("MongoDocumentItemName"));
                //documentStore.DefaultSort = "{ 'download.id': 1 }";
                documentStore.DefaultSort = xe.zXPathValue("MongoDefaultSort");
                //documentStore.GetDataKey = headerPage => headerPage.GetKey();
                //documentStore.Deserialize = document => (IEnumDataPages_new<int, IHeaderData_new>)BsonSerializer.Deserialize<Ebookdz_HeaderPage>(document);
                subForumManager.DocumentStore = documentStore;
            }
            //subForumManager.GetHttpRequestPage = _GetHttpRequestPage;
            return(subForumManager);
        }
Exemple #2
0
 static Ebookdz_SubForumManager_v1()
 {
     __currentSubForumManager = CreateSubForumManager(XmlConfig.CurrentConfig.GetElement("Ebookdz/Forum"));
 }