private static void UpdateSource(string parent, string source) { string url = PathConverter.ConvertPathToUrl(source, baseUrl, workspace); string nodeType = GetNodeType(url); if (nodeType == "file") { UpdateToReference(url); string r = PathConverter.ConvertUrlToPath(url, baseUrl, workspace); AddToGatheredRefsList(parent, r); FileInfo fi = new FileInfo(r); if (fi.Extension.EndsWith("proj")) { List <string> refList = ProjFileOps.GetReferences(fi, fi.DirectoryName); foreach (string f in refList) { UpdateSource(fi.FullName, f); } } } else { string r = PathConverter.ConvertUrlToPath(url, baseUrl, workspace); gatheredRefs.Add(r, parent); UpdateToReference(url); } }
private static void GatherSourceCode() { Console.ForegroundColor = infoColor; Echo("Gathering all source code..."); Echo(); Console.ForegroundColor = oColor; string projFile = ""; foreach (string f in Directory.GetFiles(".", "*.*proj", SearchOption.AllDirectories)) { projFile = f; break; } //Testing //projFile = ""; //Testing if (string.IsNullOrEmpty(projFile)) { Console.ForegroundColor = lowLevelInfoColor; Echo("No project file found. Using reference list provided."); Console.ForegroundColor = oColor; Echo(); foreach (string p in referenceList.Keys) { UpdateSource("Reference File", p); } } else { Console.ForegroundColor = lowLevelInfoColor; Echo("Project file found - " + projFile); Console.ForegroundColor = oColor; Echo(); if (File.Exists(projFile)) { gatheredRefs.Add(new FileInfo(projFile).FullName, ""); FileInfo fi = new FileInfo(projFile); List <string> refList = ProjFileOps.GetReferences(fi, fi.DirectoryName); foreach (string f in refList) { UpdateSource(fi.FullName, f); } } } Console.ForegroundColor = successColor; Echo(); Echo("All source code has been gathered"); Echo(); Console.ForegroundColor = oColor; }