/// <summary> /// Call the next item in the chain. Can optionally pass a different value to return /// if next is null. Defaults to true. /// </summary> /// <param name="path">The path to test.</param> /// <param name="physicalPath">The path fully expanded on the filesystem.</param> /// <param name="nullValue">The value to return if next is null. Defaults to true.</param> /// <returns>The value of next's AllowFile or nullValue if next is null.</returns> public bool Next(string path, String physicalPath, bool nullValue = true) { if (next != null) { return(next.AllowFile(path, physicalPath)); } else { return(nullValue); } }
public bool SendPageToDraft(String file, String physicalFile, IFileFinder fileFinder) { if (draftIdentfier.AllowFile(file, physicalFile) && File.Exists(physicalFile)) { using (var repo = new Repository(Repository.Discover(physicalFile))) { var latestCommit = repo.Commits.FirstOrDefault(); if (latestCommit != null) { GitDraftInfo publishInfo = LoadDraftInfo(physicalFile); publishInfo.Sha = latestCommit.Sha; using (var writer = new JsonTextWriter(new StreamWriter(fileFinder.WriteFile(GetDraftInfoFileName(file))))) { serializer.Serialize(writer, publishInfo); } } } return(true); } return(false); }