post.cs
GetBodySummary方法在中文环境下的一点小bug,可能会导致搜索页无法显示。
if (postBody.Length > size) {
int whitespace = 0;
// Clip the body
postBody = postBody.Substring(0, size);
// Find the last occurence of a space
// 因为英文怕截断字符单词不完整,所以寻找最后一个空格位置,但是有可能整个帖子没空格,那就会出错!
whitespace = postBody.LastIndexOf(" ");
// Rebuild postBody string
postBody = postBody.Substring(0, whitespace) + " ...";
}
修改成
if (postBody.Length > size) {
// Rebuild postBody string
// 直接这样就好了,中文不用担心单词会被截断
postBody = postBody.Substring(0, size) + " ...";
}
-----------------------------
头像上传很不清晰!
这是因为默认图片保存格式是ImageFormat.Gif 如果是jpg的图像就会失真
在Resources.cs中的ResizeImage (Stream stream, int height, int width, ImageFormat format)方法
增加两行
if (bitmapOriginal.RawFormat != format)
format = ImageFormat.Jpeg;
bitmapResize.Save(returnStream, format);
或者你可以直接改成bitmapResize.Save(returnStream, bitmapOriginal.RawFormat );