本文整理汇总了C#中IVirtualDirectory.GetDirectory方法的典型用法代码示例。如果您正苦于以下问题:C# IVirtualDirectory.GetDirectory方法的具体用法?C# IVirtualDirectory.GetDirectory怎么用?C# IVirtualDirectory.GetDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVirtualDirectory
的用法示例。
在下文中一共展示了IVirtualDirectory.GetDirectory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildVirtualFiles
public Dictionary<int, IVirtualFile> BuildVirtualFiles(IVirtualDirectory root, string name, int[] subRoots)
{
var subrootDir = root.GetDirectory(name);
subRoots = getCounts(subrootDir, subRoots);
XmlSerializer ser = new XmlSerializer(typeof(Group));
var dict = new Dictionary<int, IVirtualFile>();
foreach (var subroot in subRoots)
{
var fs = subrootDir.GetFile(subroot + ".xml").Open();
if (fs == null) continue;
var group = ser.Deserialize(fs) as Group;
if (group == null) continue;
foreach (var item in group.Source.Items)
{
dict.Add(item.ID, item);
}
}
return dict;
}
示例2: BuildVirtualFiles
public Dictionary<int, IVirtualFile> BuildVirtualFiles(IVirtualDirectory root, string name, int[] subRoots)
{
// read directory by name
// dir == artist
var dir = root.GetDirectory(name);
Dictionary<int, IVirtualFile> result = new Dictionary<int, IVirtualFile>();
// get alben
// iteriere erst über die dirs
// wähle die deren position in subroots enthalten ist
int pos = -1;
int arrayPos = 0;
foreach (var subdir in dir.GetDirectories())
{
pos++;
if (subRoots != null)
{
if (arrayPos < subRoots.Length)
{
if (pos == subRoots[arrayPos])
{
arrayPos++;
}
else
continue;
}
else
continue;
}
foreach (var virtualFile in subdir.GetFiles("*.mp3", SearchOption.AllDirectories, c => (pos + 1) * 1000 + c))
{
result.Add(virtualFile.ID, virtualFile);
}
}
return result;
}