示例#1
0
        public static void ClassInit(XElement xe)
        {
            //__useUrlCache = xe.zXPathValueBool("UseUrlCache", false);
            __useUrlCache    = xe.zXPathValue("UseUrlCache").zTryParseAs(false);
            __cacheDirectory = xe.zXPathValue("CacheDirectory");

            //__useMongo = xe.zXPathValueBool("UseMongo", __useMongo);
            __useMongo              = xe.zXPathValue("UseMongo").zTryParseAs(__useMongo);
            __mongoServer           = xe.zXPathValue("MongoServer", __mongoServer);
            __mongoDatabase         = xe.zXPathValue("MongoDatabase");
            __mongoCollectionName   = xe.zXPathValue("MongoCollection");
            __mongoDocumentItemName = xe.zXPathValue("MongoDocumentItemName");

            if (__useMongo)
            {
                //__currentLoadPostDetail._documentStore = new MongoDocumentStore_new<int, Telechargementz_PostDetail>(__mongoServer, __mongoDatabase, __mongoCollectionName, __mongoDocumentItemName);
                MongoDocumentStore_v3 <int, IPost> mongoDocumentStore = new MongoDocumentStore_v3 <int, IPost>(__mongoServer, __mongoDatabase, __mongoCollectionName, __mongoDocumentItemName);
                mongoDocumentStore.DefaultSort         = "{ 'download.creationDate': -1 }";
                mongoDocumentStore.GetDataKey          = post => post.GetKey();
                mongoDocumentStore.Deserialize         = document => BsonSerializer.Deserialize <Telechargementz_PostDetail>(document);
                __currentLoadPostDetail._documentStore = mongoDocumentStore;
            }

            __loadPostDetailFromWebManager = new Telechargementz_LoadPostDetailFromWebManager(GetUrlCache());
            //__currentLoadPostDetail._loadWebDataManager = new LoadWebDataManager_new<int, Telechargementz_PostDetail>(new Telechargementz_LoadPostDetailFromWebManager(GetUrlCache()), __currentLoadPostDetail._documentStore);
            __currentLoadPostDetail._loadWebDataManager       = new LoadWebDataManager_v4 <int, IPost>(__loadPostDetailFromWebManager, __currentLoadPostDetail._documentStore);
            __currentLoadPostDetail._loadEnumDataPagesFromWeb = Telechargementz_LoadHeaderPagesManager.CurrentLoadHeaderPagesManager;
        }
示例#2
0
 protected override int GetKeyFromUrl(string url)
 {
     return(Telechargementz_LoadPostDetailFromWebManager.GetPostDetailKey(url));
 }
示例#3
0
        public static UrlCache_v1 GetUrlCache()
        {
            UrlCache_v1 urlCache = null;

            if (__useUrlCache)
            {
                urlCache = new UrlCache_v1(__cacheDirectory, __urlFileNameType, (url, requestParameters) => (Telechargementz_LoadPostDetailFromWebManager.GetPostDetailKey(url) / 1000 * 1000).ToString());
            }
            return(urlCache);
        }