Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > .NET для новичков > как использовать ICollection


Автор: Cobalt 28.1.2012, 23:56
Доброго времени суток.

дело вот в чем, есть такая сдк
http://gearmage.com/SDK/MAD/MailAttachmentDownloaderSDK.zip 
 вот справка 
http://gearmage.com/SDK/MAD/doc/Index.html 

пытаюсь освоить тестовый пример, надо заставить качать только определенные типы вложений, а там для меня в этих коллекциях и перечислениях - темный лес
поясню
Код

public void DownloadAttachments() 
        { 
            try 
            { 
                // Get the search settings. 
                // By default, it will download all new attachments. 
                IMailSearchSettings searchSettings = (IMailSearchSettings)m_procMail.GetSearchSettings(); 

                /// These statements are commented to show what's possible. 
                // Download documents 
                                
                searchSettings.DownloadFilesOfType = DownloadFileType.Other; 
                  
                

                // Save files in the current directory. 
                // searchSettings.SaveAttachmentsInDirectory = Directory.GetCurrentDirectory(); 

                // Search all mail instead of new mail only. 
                // searchSettings.SearchAllSetting = true; 

                // Set the max connections to 1, by default it may use upto 8. 
                // If there's more than 1 they will be executed on multiple 
                // threads in parallel, each of which may fire status events. 
                // Since this is a command line program and the UI could get 
                // confusing with more than 1, setting this to 1. 
                searchSettings.MaxConnections = 1; 

                // Download the attachments based on search settings set above. 
                m_procMail.StartDownloadingAttachments(); 
            } 
            catch (Exception e) 
            { 
                Console.WriteLine(e.Message); 
            } 
        }


в справке
Код

Other - Other extension types, set using DownloadFilesOfTypeOtherList.


Код

IMailSearchSettings..::..DownloadFilesOfTypeOtherList Property 


 A collection of extension (strings) of the format ".ext" where ext is the extension that can contain any number 
of characters in it. Add as many as you want to
 include in the download. It can also include wildcards, if need be. Clear the list to unset it. 
 Namespace: MailAttachmentDownloaderApi 
 Assembly: MailAttachmentDownloaderApi (in MailAttachmentDownloaderApi.dll) Version: 1.0.0.0 (1.0.0.0) 

 Syntax 
 C# 
 ICollection<string> DownloadFilesOfTypeOtherList { get; set; }


из определения

Код

using System;
using System.Collections.Generic;

namespace MailAttachmentDownloaderApi
{
    public interface IMailSearchSettings
    {
        bool CreateFolderForFrom { get; set; }
        bool CreateFolderForMailbox { get; set; }
        DownloadFileType DownloadFilesOfType { get; set; }
        ICollection<string> DownloadFilesOfTypeOtherList { get; set; }
        ICollection<Fields> FilenameOrdering { get; set; }
        string[] MailSearchHeaderSettings { get; set; }
        int MaxConnections { get; set; }
        string MoveToFolderOnSuccessfulDownload { get; set; }
        IFolder RootFolder { get; }
        string SampleName { get; }
        string SaveAttachmentsInDirectory { get; set; }
        bool SearchAllSetting { get; set; }
        int SizeGreaterThan { get; set; }
    }
}


как использовать DownloadFilesOfTypeOtherList? smile 

Автор: Cobalt 29.1.2012, 01:14
searchSettings.DownloadFilesOfTypeOtherList.Add(".tiff"); 
 весь вечер убил на такую ерунду 

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)