public static FileEntry GetChild(this DirectoryEntry self, string fileName, bool sanitize = true) { fileName.ThrowErrorIfNullOrEmpty("fileName"); if (sanitize) { fileName = Sanitize.SanitizeToFileName(fileName); } AssertV2.AreEqual(fileName, Sanitize.SanitizeToFileName(fileName)); return(ResolveFilePath(self, fileName)); }
public static FileInfo GetChild(this DirectoryInfo self, string fileName, bool assertThatChildMustExist = false, bool sanitize = true) { fileName.ThrowErrorIfNullOrEmpty("fileName"); if (sanitize) { fileName = Sanitize.SanitizeToFileName(fileName); } AssertV2.AreEqual(fileName, Sanitize.SanitizeToFileName(fileName)); var c = new FileInfo(self.FullPath() + fileName); if (assertThatChildMustExist) { AssertV2.IsTrue(c.IsNotNullAndExists(), "childFile '" + fileName + "' doesnt exist! Path=" + c.FullPath()); } return(c); }