コード例 #1
0
 public string ToXml(Attachment[] attachments)
 {
     var builder = new StringBuilder();
     builder.Append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
     builder.Append("<attachments>\n");
     foreach (var attachment in attachments)
     {
         builder.Append(ToAttachmentXml(attachment));
     }
     builder.Append("</attachments>\n");
     return builder.ToString();
 }
コード例 #2
0
 private static string ToAttachmentXml(Attachment attachment)
 {
     var builder = new StringBuilder();
     builder.Append("<attachment>\n");
     builder.Append("<title>").Append(attachment.Title).Append("</title>\n");
     builder.Append("<path>").Append(attachment.Path).Append("</path>\n");
     builder.Append("<mimeType>").Append(attachment.MimeType).Append("</mimeType>\n");
     builder.Append("<size>").Append(attachment.Size).Append("</size>\n");
     builder.Append("<hashValue>").Append(attachment.HashValue).Append("</hashValue>\n");
     if (attachment.Optional)
     {
         builder.Append("<optional/>\n");
     }
     builder.Append("</attachment>\n");
     return builder.ToString();
 }
コード例 #3
0
 public string ToXml(Attachment attachments)
 {
     return ToXml(new[] {attachments});
 }