Пример #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.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, ExtremeDown_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 <ExtremeDown_PostDetail>(document);
                __currentLoadPostDetail._documentStore = mongoDocumentStore;
            }

            //ExtremeDown_LoadPostDetailFromWebManager.GetLinksExtremeProtect = xe.zXPathValueBool("GetLinksExtremeProtect", ExtremeDown_LoadPostDetailFromWebManager.GetLinksExtremeProtect);
            ExtremeDown_LoadPostDetailFromWebManager.GetLinksExtremeProtect = xe.zXPathValue("GetLinksExtremeProtect").zTryParseAs(ExtremeDown_LoadPostDetailFromWebManager.GetLinksExtremeProtect);
            __loadPostDetailFromWebManager = new ExtremeDown_LoadPostDetailFromWebManager(GetUrlCache());
            //__currentLoadPostDetail._loadWebDataManager = new LoadWebDataManager_new<int, ExtremeDown_PostDetail>(__loadPostDetailFromWebManager, __currentLoadPostDetail._documentStore);
            __currentLoadPostDetail._loadWebDataManager       = new LoadWebDataManager_v4 <int, IPost>(__loadPostDetailFromWebManager, __currentLoadPostDetail._documentStore);
            __currentLoadPostDetail._loadEnumDataPagesFromWeb = ExtremeDown_LoadHeaderPagesManager.CurrentLoadHeaderPagesManager;
        }
Пример #2
0
 protected override int GetKeyFromUrl(string url)
 {
     return(ExtremeDown_LoadPostDetailFromWebManager.GetPostDetailKey(url));
 }
Пример #3
0
        public static UrlCache_v1 GetUrlCache()
        {
            UrlCache_v1 urlCache = null;

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