示例#1
0
        public static List <UrlStoreModel> GetHaveContentUrls(string rootUrl)
        {
            if (string.IsNullOrEmpty(rootUrl))
            {
                return(null);
            }

            List <UrlStoreModel> urls = new List <UrlStoreModel>();

            RedisUtil.Exec(c =>
            {
                HashEntry[] items         = c.HashGetAll(GetBeforeUrlKey(rootUrl));
                UrlStoreModel model       = null;
                Tuple <int, string> value = null;
                foreach (HashEntry item in items)
                {
                    value = ParseHashValue(item.Value.ToString());
                    model = new UrlStoreModel()
                    {
                        Url           = item.Name.ToString(),
                        Level         = value.Item1,
                        localFileName = value.Item2
                    };

                    if (model.IsLocalization())
                    {
                        urls.Add(model);
                    }
                }
            }, db);

            return(urls);
        }
示例#2
0
        private string GetLocalContent(UrlStoreModel firstUrl)
        {
            if (firstUrl == null)
            {
                return(null);
            }

            string htmlContent = null;

            if (firstUrl.IsLocalization())
            {
                _fileOperate.Read(this._ruleConfig.Url, firstUrl.localFileName);
                if (_fileOperate.IsExists())
                {
                    htmlContent = _fileOperate.GetHtml();
                }
            }

            return(htmlContent);
        }