本文整理汇总了C#中Folder.Items方法的典型用法代码示例。如果您正苦于以下问题:C# Folder.Items方法的具体用法?C# Folder.Items怎么用?C# Folder.Items使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Folder
的用法示例。
在下文中一共展示了Folder.Items方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckZip
static SizeComparison CheckZip(Folder zip, Folder folder)
{
SizeComparison size = new SizeComparison();
foreach (FolderItem sItem in zip.Items())
{
FolderItem dItem = null;
foreach (FolderItem item in folder.Items())
if (item.Name == sItem.Name)
{
dItem = item;
break;
}
if (dItem == null)
continue;
if (sItem.IsFolder)
{
if (!dItem.IsFolder)
continue;
Folder sFolder = sItem.GetFolder;
Folder dFolder = dItem.GetFolder;
SizeComparison fSize = CheckZip(sFolder, dFolder);
size.sSize += fSize.sSize;
size.dSize += fSize.dSize;
}
else
{
if (dItem.IsFolder)
continue;
size.sSize += (UInt64)sItem.Size;
size.dSize += (UInt64)dItem.Size;
}
}
return size;
}
示例2: WaitTillItemCountIsEqual
/// <summary>
/// Stop the current thread till the item counts
/// in both the folder objects are equal or a time out occurs.
///
/// This is basically a KLUDGE for lack of a better idea I could
/// think of.
/// </summary>
/// <param name="folderObjSource">The folder object whose item count is to remain constant, typically source folder</param>
/// <param name="folderObjDestination">The folder object whose item count is to change, typically destination folder</param>
/// <returns>True if item counts were finally equal, False otherwise</returns>
private static bool WaitTillItemCountIsEqual(Folder folderObjSource, Folder folderObjDestination)
{
try
{
_lastError = "";
if (folderObjSource == null || folderObjDestination == null)
{
_lastError = "ERROR: One or more Folder object(s) is/are null";
return false;
}
int sourceFolderItemCount = folderObjSource.Items().Count;
int maxIterations = (TIMEOUT_VALUE * 1000) / SLEEP_DURATION;
int numIterations = 0;
while (folderObjDestination.Items().Count < sourceFolderItemCount)
{
if (maxIterations <= numIterations++)
{
_lastError = "ERROR: Timeout occurred while processing archive";
return false;
}
System.Threading.Thread.Sleep(SLEEP_DURATION);
}
return true;
}
catch (Exception ex)
{
_lastError = "ERROR: Could not create archive. Exception: " + ex.Message;
return false;
}
}