C#.NET
private System.IO.Stream GetMailStream(System.IO.Stream[] MailDatas)
{
System.IO.MemoryStream ms = new System.IO.MemoryStream();
foreach(System.IO.Stream stream in MailDatas)
{
TKMP.Reader.MailReader reader = new TKMP.Reader.MailReader(stream , false);
byte[] data = reader.MainData;
ms.Write(data, 0 , data.Length);
}
ms.Position = 0;
return ms ;
}
VB.NET
Private Function GetMailStream(ByVal MailDatas() As System.IO.Stream) As System.IO.Stream
Dim ms As New System.IO.MemoryStream
Dim stream As System.IO.Stream
For Each stream In MailDatas
Dim reader As New TKMP.Reader.MailReader(stream, False)
Dim data As Byte() = reader.MainData
ms.Write(data, 0, data.Length)
Next stream
ms.Position = 0
Return ms
End Function
C#.NET
private System.IO.Stream GetMailStream2(System.IO.Stream[] MailDatas)
{
TKMP.Reader.MailReader[] readers = new TKMP.Reader.MailReader[ MailDatas.Length ];
foreach(System.IO.Stream stream in MailDatas)
{
TKMP.Reader.MailReader reader1 = new TKMP.Reader.MailReader(stream , false);
readers[reader1.ContentType.PartialNumber - 1] = reader1;
}
System.IO.MemoryStream ms = new System.IO.MemoryStream();
foreach(TKMP.Reader.MailReader reader2 in readers)
{
byte[] data = reader2.MainData;
ms.Write(data, 0 , data.Length);
}
ms.Position = 0;
return ms ;
}
VB.NET
Private Function GetMailStream2(ByVal MailDatas() As System.IO.Stream) As System.IO.Stream
Dim readers(MailDatas.Length - 1) As TKMP.Reader.MailReader
Dim stream As System.IO.Stream
For Each stream In MailDatas
Dim reader1 As New TKMP.Reader.MailReader(stream, False)
readers(reader1.ContentType.PartialNumber - 1) = reader1
Next stream
Dim ms As New System.IO.MemoryStream
Dim reader2 As TKMP.Reader.MailReader
For Each reader2 In readers
Dim data As Byte() = reader2.MainData
ms.Write(data, 0, data.Length)
Next reader2
ms.Position = 0
Return ms
End Function
VB.NETのコードはC#.NETを元に「
C#.NET to VB.NET Translator」によって作成したものです
この場合は断片の場所2(number),分割総数3(total),識別子xxxxxyyyyzzzz(id)となります。 処理方法は同一の識別子(id)を集めて、断片の場所(number)で整列します。
このとき注意する点は分割総数(total)は最後の断片以外付ける必要がないことです。