public void UseAssetIfExists(params string[] names) { names.Each(name => { if (_fileGraph.Find(name) != null) { Require(name); } }); }
// TODO -- would be nice if we could log the provenance of the file dependency. // i.e. -- which file had the wrong stuff public void VerifyFileDependency(string name) { var file = _fileGraph.Find(name); if (file == null) { // Guard clause to allow automated tests with faked up data work if (AssetDeclarationVerificationActivator.Latched) { return; } _log.MarkFailure(GetErrorMessage(name, _assetLogs)); } }
public IEnumerable <IAssetTagSubject> FindSubjects(IEnumerable <string> names) { foreach (var name in names) { var file = _fileGraph.Find(name); if (file != null) { yield return(file); } else { yield return(new MissingAssetTagSubject(name)); } } }
private IEnumerable <AssetFile> writeBinary(AssetPath asset, Action <IEnumerable <AssetFile> > writeHeaders) { var file = _fileGraph.Find(asset); if (file == null) { return(Enumerable.Empty <AssetFile>()); } var files = new AssetFile[] { file }; writeHeaders(files); _writer.WriteFile(file.MimeType, file.FullPath, null); return(files); }
public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log) { _graph.PolicyTypes.Each(type => { if (type.CanBeCastTo <ICombinationPolicy>() && type.IsConcreteWithDefaultCtor()) { log.Trace("Registering {0} as an ICombinationPolicy", type.FullName); var policy = Activator.CreateInstance(type).As <ICombinationPolicy>(); _combinations.Add(policy); } }); _graph.ForCombinations((name, assetNames) => { var mimeType = MimeType.MimeTypeByFileName(assetNames.First()); _cache.AddFilesToCandidate(mimeType, name, assetNames.Select(x => _fileGraph.Find(x))); }); }
public IEnumerable <AssetFile> FindFiles(string name) { var combination = _combinations.FindCombination(name); if (combination != null) { return(combination.Files); } var assetFile = _fileGraph.Find(name); if (assetFile == null) { return(Enumerable.Empty <AssetFile>()); } return(new[] { assetFile }); }