private static XElement AddNodeForHome(XNamespace xmlns, Uri file, DirectoryInfo rootFolder)
      {
        var rootfile = new FileInfo(Path.Combine(rootFolder.FullName, "index.html"));

        var xElement = new XElement(xmlns + "li", new XAttribute("class", "file"), new XAttribute("id", "root"));

        string nodeText = "Home";

        bool fileIsActuallyTheRoot = DetermineWhetherFileIsTheRootFile(file, rootfile);
        if (fileIsActuallyTheRoot)
        {
          xElement.Add(new XElement(xmlns + "span", new XAttribute("class", "current"), nodeText));
        }
        else
        {
          xElement.Add(new XElement(xmlns + "a", new XAttribute("href", file.GetUriForTargetRelativeToMe(rootfile, ".html")), nodeText));
        }

        return xElement;
      }
Example #2
0
 public string GetRelativeUriTo(Uri other, string newExtension)
 {
     return other.GetUriForTargetRelativeToMe(this.OriginalLocation, newExtension);
 }