本文整理汇总了C#中MailKit.Net.Imap.ImapEngine.QueueCommand方法的典型用法代码示例。如果您正苦于以下问题:C# ImapEngine.QueueCommand方法的具体用法?C# ImapEngine.QueueCommand怎么用?C# ImapEngine.QueueCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MailKit.Net.Imap.ImapEngine
的用法示例。
在下文中一共展示了ImapEngine.QueueCommand方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LookupParentFolders
/// <summary>
/// Looks up and sets the <see cref="ImapFolder.ParentFolder"/> property of each of the folders.
/// </summary>
/// <param name="engine">The IMAP engine.</param>
/// <param name="folders">The IMAP folders.</param>
/// <param name="cancellationToken">The cancellation token.</param>
public static void LookupParentFolders(ImapEngine engine, IEnumerable<ImapFolder> folders, CancellationToken cancellationToken)
{
int index;
foreach (var folder in folders) {
if (folder.ParentFolder != null)
continue;
if ((index = folder.FullName.LastIndexOf (folder.DirectorySeparator)) == -1)
continue;
if (index == 0)
continue;
var parentName = folder.FullName.Substring (0, index);
var encodedName = ImapEncoding.Encode (parentName);
ImapFolder parent;
if (engine.FolderCache.TryGetValue (encodedName, out parent)) {
folder.SetParentFolder (parent);
continue;
}
var ic = engine.QueueCommand (cancellationToken, null, "LIST \"\" %S\r\n", encodedName);
ic.RegisterUntaggedHandler ("LIST", ImapUtils.HandleUntaggedListResponse);
ic.UserData = new List<ImapFolder> ();
engine.Wait (ic);
if (!engine.FolderCache.TryGetValue (encodedName, out parent)) {
parent = new ImapFolder (engine, encodedName, FolderAttributes.NonExistent, folder.DirectorySeparator);
engine.FolderCache.Add (encodedName, parent);
}
folder.SetParentFolder (parent);
}
}