private static void CheckDirectorySecurity(string projectFolder, string path) { if (!LDirectoryHelper.IsSubDirectoryOf(projectFolder, path)) { throw new SecurityException("Can not get a resource file out of the project folder!"); } }
public async Task <DocumentResource> GetResource(Project project, string resourceName, string version) { var projectFolder = project.GetFileSystemPath(); var path = Path.Combine(projectFolder, resourceName); if (!LDirectoryHelper.IsSubDirectoryOf(projectFolder, path)) { throw new SecurityException("Can not get a resource file out of the project folder!"); } return(new DocumentResource(await LFileHelper.ReadAllBytesAsync(path))); }