2011-08-24 51 views
0

首先,對不起我的英文。在c中加載不帶附件的附件文件名#

我想在郵箱上顯示附件名稱文件列表。然後,從這個列表中的用戶將可以選擇他們想要下載硬盤上的哪些附件 - 例如,如在此程序: http://www.mailresender.com.ar/Read.html

我已經寫了這個在Koolwired.Imap:

for (int i = 0; i < mbStructure.BodyParts.Count; i++) // i = number of parts of body 
{ 
    if (mbStructure.BodyParts[i].Attachment) 
    { 
     mbStructure = command.FetchBodyPart(mbStructure, i); 
     System.Console.WriteLine(mbStructure.BodyParts[i].Disposition); // Disposition contains file name 
     //System.Console.WriteLine(mbStructure.BodyParts[i].Data); // Data contains entire file 
     } 
} 

但問題是,不僅文件的名稱被加載到內存還具有數據的二進制(整個附件文件被FetchBodyPart方法加載) - 所以,如果在附件文件具有長尺寸(例如20 MB)所有這20次MB的也有被加載到內存中,因此顯示文件名列表將持續很長時間。

有沒有辦法只加載沒有文件的附件文件名? c#中的哪個庫可以支持這個?

回答