Ejemplo n.º 1
0
        /// <summary>
        /// 获取日志缓存文件内容,如果不存在则生成之
        /// </summary>
        /// <param name="postid">日志Id</param>
        /// <returns></returns>
        public static string GetSpacePostTagsCacheFile(int postid)
        {
            if (postid > 0)
            {
                string filename = Utils.GetMapPath(SpaceTags.GetSpacePostTagCacheFilePath(postid));
                string tags     = string.Empty;
                if (!File.Exists(filename))
                {
                    SpaceTags.WriteSpacePostTagsCacheFile(postid);
                }

                if (File.Exists(filename))
                {
                    using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                    {
                        using (StreamReader sr = new StreamReader(fs, Encoding.UTF8))
                        {
                            tags = sr.ReadToEnd();
                        }
                    }
                }

                return(tags);
            }
            return(string.Empty);
        }
Ejemplo n.º 2
0
 public override void GetSpacePostTagsCacheFile(int postid)
 {
     SpaceTags.WriteSpacePostTagsCacheFile(postid);
 }