本文整理汇总了C#中DirectoryEntry.CreateDirectory方法的典型用法代码示例。如果您正苦于以下问题:C# DirectoryEntry.CreateDirectory方法的具体用法?C# DirectoryEntry.CreateDirectory怎么用?C# DirectoryEntry.CreateDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DirectoryEntry
的用法示例。
在下文中一共展示了DirectoryEntry.CreateDirectory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyNodeRecursively
/**
* Copies an Entry into a target POIFS directory, recursively
*/
public static void CopyNodeRecursively(Entry entry, DirectoryEntry target)
{
// System.err.println("copyNodeRecursively called with "+entry.GetName()+
// ","+tarGet.getName());
DirectoryEntry newTarget = null;
if (entry.IsDirectoryEntry)
{
newTarget = target.CreateDirectory(entry.Name);
IEnumerator entries = ((DirectoryEntry)entry).Entries;
while (entries.MoveNext())
{
CopyNodeRecursively((Entry)entries.Current, newTarget);
}
}
else
{
DocumentEntry dentry = (DocumentEntry)entry;
using (DocumentInputStream dstream = new DocumentInputStream(dentry))
{
target.CreateDocument(dentry.Name, dstream);
//now part of usings call to Dispose: dstream.Close();
}
}
}
示例2: CopyNodeRecursively
/**
* Copies an Entry into a target POIFS directory, recursively
*/
public static void CopyNodeRecursively(Entry entry, DirectoryEntry target)
{
// System.err.println("copyNodeRecursively called with "+entry.getName()+
// ","+target.getName());
DirectoryEntry newTarget = null;
if (entry.IsDirectoryEntry)
{
DirectoryEntry dirEntry = (DirectoryEntry)entry;
newTarget = target.CreateDirectory(entry.Name);
newTarget.StorageClsid=(dirEntry.StorageClsid);
IEnumerator<Entry> entries = dirEntry.Entries;
while (entries.MoveNext())
{
CopyNodeRecursively((Entry)entries.Current, newTarget);
}
}
else
{
DocumentEntry dentry = (DocumentEntry)entry;
DocumentInputStream dstream = new DocumentInputStream(dentry);
target.CreateDocument(dentry.Name, dstream);
dstream.Close();
}
}
示例3: setUp
protected void setUp()
{
fs = new POIFSFileSystem();
dirA = fs.CreateDirectory("DirA");
dirB = fs.CreateDirectory("DirB");
dirAA = dirA.CreateDirectory("DirAA");
eRoot = fs.Root.CreateDocument("Root", new ByteArrayInputStream(new byte[] { }));
eA = dirA.CreateDocument("NA", new ByteArrayInputStream(new byte[] { }));
eAA = dirAA.CreateDocument("NAA", new ByteArrayInputStream(new byte[] { }));
}
示例4: CopyNodeRecursively
/// <summary>
/// Copies an Entry into a target POIFS directory, recursively
/// </summary>
/// <param name="entry">The entry.</param>
/// <param name="target">The target.</param>
private void CopyNodeRecursively(Entry entry, DirectoryEntry target)
{
//System.err.println("copyNodeRecursively called with "+entry.Name+
// ","+target.Name);
DirectoryEntry newtarget = null;
if (entry.IsDirectoryEntry)
{
newtarget = target.CreateDirectory(entry.Name);
IEnumerator entries = ((DirectoryEntry)entry).Entries;
while (entries.MoveNext())
{
CopyNodeRecursively((Entry)entries.Current, newtarget);
}
}
else
{
DocumentEntry dentry = (DocumentEntry)entry;
POIFSDocumentReader dstream = new POIFSDocumentReader(dentry);
target.CreateDocument(dentry.Name, dstream);
dstream.Close();
}
}