本文整理汇总了C#中System.IO.DirectoryInfo.SubDir方法的典型用法代码示例。如果您正苦于以下问题:C# DirectoryInfo.SubDir方法的具体用法?C# DirectoryInfo.SubDir怎么用?C# DirectoryInfo.SubDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.DirectoryInfo
的用法示例。
在下文中一共展示了DirectoryInfo.SubDir方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FetchOneFileWithNoBackupOverNetwork
public void FetchOneFileWithNoBackupOverNetwork()
{
// This is a real run (so it is slow), and it will fetch data over the network.
var d = new DirectoryInfo("FetchOneFileWithNoBackupOverNetwork");
if (d.Exists)
{
d.Delete(true);
}
d.Create();
var c = GenerateLocalConfigWithWorkingRemote(d);
Locator.DisableAllLocators(true);
var l = LocalMachine.GetLocation(c);
var r = l.GetDSInfo("user.gwatts:user.gwatts.301295.EVNT.1");
Assert.AreEqual(1, l.GetDS(r, rep => Console.WriteLine(rep), fslist => fslist.Take(1).ToArray(), null, 0).Length);
var dsdir = d.SubDir("user.gwatts.301295.EVNT.1");
Assert.IsTrue(dsdir.Exists);
Assert.AreEqual(1, dsdir.EnumerateFiles("*.root.*", SearchOption.AllDirectories).Count());
// Next, make sure that there are no files left over up on the remote machine.
var username = c["LinuxUserName"];
var machine = c["LinuxHost"];
using (var s = new SSHConnection(machine, username))
{
bool stillThere = false;
s.ExecuteCommand(string.Format("ls {0}", c["LinuxTempLocation"]),
outLine =>
{
Console.WriteLine("output of ls: " + outLine);
stillThere |= !outLine.Contains("cannot access");
}
);
Assert.IsFalse(stillThere);
}
}
示例2: DownloadToLinuxDirectoryThatIsAWindowsDirectoryAndAreadyCreated
public void DownloadToLinuxDirectoryThatIsAWindowsDirectoryAndAreadyCreated()
{
// Seen in the wild. A crash (or other interruption) means the dataset directory has
// been created, but is empty (for whatever reason). In that particular case, we should
// treat it as not there.
var dsinfo = MakeDSInfo("ds1.1.1");
var d = new DirectoryInfo("DownloadToLinuxDirectoryThatIsAWindowsDirectory");
if (d.Exists)
{
d.Delete(true);
}
d.Create();
var dsdir = d.SubDir(dsinfo.Name);
dsdir.Create();
var ld = new LinuxMirrorDownloaderPretend(d, dsinfo.Name);
var gf = new GRIDFetchToLinuxVisibleOnWindows(d, ld, "/bogus/files/store");
var r = gf.GetDS(dsinfo);
Assert.IsNotNull(r);
Assert.AreEqual(5, r.Length);
Assert.AreEqual("/bogus/files/store/ds1.1.1", ld.LinuxDest);
}
示例3: LoadNewFilesToLocalWhenEmptyDirectory
public void LoadNewFilesToLocalWhenEmptyDirectory()
{
// Seen in the wild. Local directory is actually there for the dataset, but
// empty due to an earlier crash. Make sure the copy still occurs.
AtlasWorkFlows.Utils.IPLocationTests.SetIpName("pc.cern.ch");
var dsname = "ds1.1.1";
var d1 = utils.BuildSampleDirectoryBeforeBuild("LoadNewFilesToLocalWhenMissingRemote", dsname);
var d2 = new DirectoryInfo("LoadNewFilesToLocalWhenMissingLocal");
if (d2.Exists)
{
d2.Delete(true);
}
d2.Create();
d2.Refresh();
d2.SubDir("ds1.1.1").Create();
Locator._getLocations = () => utils.GetLocal(d1, d2);
var locator = new Locator();
var l = locator.FindLocation("MyTestLocalLocation");
var r = l.GetDSInfo("ds1.1.1");
Assert.IsFalse(r.IsLocal(null));
var files = l.GetDS(r, null, null, null, 0);
Assert.AreEqual(5, files.Length);
Assert.IsTrue(files[0].LocalPath.Contains("LoadNewFilesToLocalWhenMissingLocal"));
Assert.AreEqual("ds1.1.1", d2.EnumerateDirectories().First().Name);
}