2025-11-24 15:51:08 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
|
|
namespace SlideCombine
|
|
|
|
|
|
{
|
|
|
|
|
|
public class DocumentMetadata
|
|
|
|
|
|
{
|
|
|
|
|
|
public string Title { get; set; }
|
|
|
|
|
|
public string OtherTitles { get; set; }
|
|
|
|
|
|
public string Volume { get; set; }
|
|
|
|
|
|
public string ISBN { get; set; }
|
|
|
|
|
|
public string Creator { get; set; }
|
|
|
|
|
|
public string Contributor { get; set; }
|
|
|
|
|
|
public string IssuedDate { get; set; }
|
|
|
|
|
|
public string Publisher { get; set; }
|
|
|
|
|
|
public string Place { get; set; }
|
|
|
|
|
|
public string ClassificationNumber { get; set; }
|
|
|
|
|
|
public string Page { get; set; }
|
|
|
|
|
|
public List<BookmarkItem> TableOfContents { get; set; }
|
|
|
|
|
|
public string Subject { get; set; }
|
|
|
|
|
|
public string Date { get; set; }
|
|
|
|
|
|
public string Spatial { get; set; }
|
|
|
|
|
|
public string OtherISBN { get; set; }
|
|
|
|
|
|
public string OtherTime { get; set; }
|
|
|
|
|
|
public string Url { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public DocumentMetadata()
|
|
|
|
|
|
{
|
|
|
|
|
|
TableOfContents = new List<BookmarkItem>();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string ToFormattedString()
|
|
|
|
|
|
{
|
|
|
|
|
|
var result = new System.Text.StringBuilder();
|
|
|
|
|
|
|
|
|
|
|
|
// Title行
|
|
|
|
|
|
result.AppendLine($"title:{Title}");
|
|
|
|
|
|
|
|
|
|
|
|
// Other titles行(如果有)
|
|
|
|
|
|
if (!string.IsNullOrEmpty(OtherTitles))
|
|
|
|
|
|
{
|
|
|
|
|
|
result.AppendLine($"Other titles:{OtherTitles}");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Volume行
|
|
|
|
|
|
result.AppendLine($"Volume:{Volume}");
|
|
|
|
|
|
|
2025-11-24 15:54:05 +08:00
|
|
|
|
// ISBN行 - 即使为空也要输出
|
|
|
|
|
|
result.AppendLine($"ISBN:{ISBN}");
|
2025-11-24 15:51:08 +08:00
|
|
|
|
|
2025-11-24 15:54:05 +08:00
|
|
|
|
// Creator行 - 即使为空也要输出
|
|
|
|
|
|
result.AppendLine($"creator:{Creator}");
|
2025-11-24 15:51:08 +08:00
|
|
|
|
|
2025-11-24 15:54:05 +08:00
|
|
|
|
// Contributor行 - 即使为空也要输出
|
|
|
|
|
|
result.AppendLine($"contributor:{Contributor}");
|
2025-11-24 15:51:08 +08:00
|
|
|
|
|
|
|
|
|
|
// IssuedDate行
|
|
|
|
|
|
result.AppendLine($"issuedDate:{IssuedDate}");
|
|
|
|
|
|
|
|
|
|
|
|
// Publisher行
|
|
|
|
|
|
result.AppendLine($"publisher:{Publisher}");
|
|
|
|
|
|
|
|
|
|
|
|
// Place行
|
|
|
|
|
|
result.AppendLine($"place:{Place}");
|
|
|
|
|
|
|
|
|
|
|
|
// Classification number行
|
|
|
|
|
|
result.AppendLine($"Classification number:{ClassificationNumber}");
|
|
|
|
|
|
|
|
|
|
|
|
// Page行
|
|
|
|
|
|
result.AppendLine($"page:{Page}");
|
|
|
|
|
|
|
|
|
|
|
|
// Table of contents
|
|
|
|
|
|
result.AppendLine("tableOfContents:");
|
|
|
|
|
|
foreach (var bookmark in TableOfContents)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!string.IsNullOrEmpty(bookmark.Title))
|
|
|
|
|
|
{
|
|
|
|
|
|
result.Append(bookmark.Title.Trim());
|
|
|
|
|
|
if (!string.IsNullOrEmpty(bookmark.Page))
|
|
|
|
|
|
{
|
|
|
|
|
|
// 注意:使用14个短横线,与需求示例一致
|
|
|
|
|
|
result.Append("---------------");
|
|
|
|
|
|
result.Append(bookmark.Page);
|
|
|
|
|
|
}
|
|
|
|
|
|
result.AppendLine("<br/>");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Subject行
|
|
|
|
|
|
result.AppendLine($"subject:{Subject}");
|
|
|
|
|
|
|
|
|
|
|
|
// Date行
|
|
|
|
|
|
if (!string.IsNullOrEmpty(Date))
|
|
|
|
|
|
{
|
|
|
|
|
|
result.AppendLine($"date:{Date}");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-24 15:54:05 +08:00
|
|
|
|
// Spatial行 - 即使为空也要输出
|
|
|
|
|
|
result.AppendLine($"spatial:{Spatial}");
|
2025-11-24 15:51:08 +08:00
|
|
|
|
|
2025-11-24 15:54:05 +08:00
|
|
|
|
// Other ISBN行 - 即使为空也要输出
|
|
|
|
|
|
result.AppendLine($"Other ISBN:{OtherISBN}");
|
2025-11-24 15:51:08 +08:00
|
|
|
|
|
|
|
|
|
|
// Other time行
|
|
|
|
|
|
if (!string.IsNullOrEmpty(OtherTime))
|
|
|
|
|
|
{
|
|
|
|
|
|
result.AppendLine($"Other time:{OtherTime}");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// URL行
|
|
|
|
|
|
if (!string.IsNullOrEmpty(Url))
|
|
|
|
|
|
{
|
|
|
|
|
|
result.AppendLine($"url:{Url}");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result.ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|