/// <summary> /// 获得预览信息 /// </summary> /// <param name="fileName">文件物理路径</param> /// <param name="attachment">附件对象</param> /// <returns>预览信息的HTML</returns> public string GetPreview(string fileName, ShowtopicPageAttachmentInfo attachment) { if (!PreviewHelper.IsFileExist(fileName)) return ""; string id = Guid.NewGuid().ToString(); EXIFextractor exif = new EXIFextractor(fileName, string.Empty, string.Empty); if (exif.Count < 1) { return string.Empty; } StringBuilder builder = new StringBuilder(); foreach (System.Web.UI.Pair s in exif) { if (s.Second.ToString().Trim() == "-" || s.Second.ToString().Trim() == string.Empty || s.Second.ToString().Trim() == "0") continue; builder.Append("<li>"); builder.Append(s.First.ToString().Trim() + " : " + s.Second.ToString().Replace("\0", string.Empty).Trim()); builder.Append("</li>"); } if (builder.Length == 0) { return string.Empty; } builder.Append("</ul></div>"); builder.Insert(0, string.Format("<span><a onclick=\"$('{0}').style.display=$('{0}').style.display=='none'?'':'none';\" style='cursor:pointer;' title='点击显示或隐藏'>EXIF信息</a></span><div class=\"preview{1}\"><ul id=\"{0}\" style='display: none;'>", id, "jpg")); return builder.ToString(); }
/// <summary> /// Copies the elements of the specified <see cref="ShowtopicPageAttachmentInfo">ShowtopicPageAttachmentInfo</see> array to the end of the collection. /// </summary> /// <param name="value">An array of type <see cref="ShowtopicPageAttachmentInfo">ShowtopicPageAttachmentInfo</see> containing the Components to add to the collection.</param> public void AddRange(ShowtopicPageAttachmentInfo[] value) { for (int i = 0; (i < value.Length); i = (i + 1)) { this.Add(value[i]); } }
/// <summary> /// Gets a value indicating whether the collection contains the specified <see cref="ShowtopicPageAttachmentInfoCollection">ShowtopicPageAttachmentInfoCollection</see>. /// </summary> /// <param name="value">The <see cref="ShowtopicPageAttachmentInfoCollection">ShowtopicPageAttachmentInfoCollection</see> to search for in the collection.</param> /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns> public bool Contains(ShowtopicPageAttachmentInfo value) { return this.List.Contains(value); }
public int Add(ShowtopicPageAttachmentInfo value) { return this.List.Add(value); }
/// <summary> /// Initializes a new instance of the <see cref="ShowtopicPageAttachmentInfoCollection">ShowtopicPageAttachmentInfoCollection</see> class containing the specified array of <see cref="ShowtopicPageAttachmentInfo">ShowtopicPageAttachmentInfo</see> Components. /// </summary> /// <param name="value">An array of <see cref="ShowtopicPageAttachmentInfo">ShowtopicPageAttachmentInfo</see> Components with which to initialize the collection. </param> public ShowtopicPageAttachmentInfoCollection(ShowtopicPageAttachmentInfo[] value) { this.AddRange(value); }
public void Remove(ShowtopicPageAttachmentInfo value) { List.Remove(value); }
public void Insert(int index, ShowtopicPageAttachmentInfo value) { List.Insert(index, value); }
/// <summary> /// Gets the index in the collection of the specified <see cref="ShowtopicPageAttachmentInfoCollection">ShowtopicPageAttachmentInfoCollection</see>, if it exists in the collection. /// </summary> /// <param name="value">The <see cref="ShowtopicPageAttachmentInfoCollection">ShowtopicPageAttachmentInfoCollection</see> to locate in the collection.</param> /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns> public int IndexOf(ShowtopicPageAttachmentInfo value) { return this.List.IndexOf(value); }
/// <summary> /// Copies the collection Components to a one-dimensional <see cref="T:System.Array">Array</see> instance beginning at the specified index. /// </summary> /// <param name="array">The one-dimensional <see cref="T:System.Array">Array</see> that is the destination of the values copied from the collection.</param> /// <param name="index">The index of the array at which to begin inserting.</param> public void CopyTo(ShowtopicPageAttachmentInfo[] array, int index) { this.List.CopyTo(array, index); }
/// <summary> /// 加载单个附件实体对象 /// </summary> /// <param name="reader"></param> /// <returns></returns> public static ShowtopicPageAttachmentInfo LoadSingleAttachmentInfo(IDataReader reader) { ShowtopicPageAttachmentInfo attInfo = new ShowtopicPageAttachmentInfo(); attInfo.Aid = TypeConverter.ObjectToInt(reader["aid"]); attInfo.Pid = TypeConverter.ObjectToInt(reader["pid"]); attInfo.Postdatetime = reader["postdatetime"].ToString(); attInfo.Filename = reader["filename"].ToString(); attInfo.Description = reader["description"].ToString(); attInfo.Filetype = reader["filetype"].ToString(); attInfo.Filesize = TypeConverter.ObjectToInt(reader["filesize"]); attInfo.Attachment = reader["attachment"].ToString(); attInfo.Downloads = TypeConverter.ObjectToInt(reader["downloads"]); return attInfo; }