public static bool IsAssemblyFolderReference(string hintPath, string path, Bamboo.CSharp.Compilers.Compiler compiler) { string referencePath = GetReferencePath(path, hintPath, compiler); if (referencePath == null) { return(false); } if (referencePath.Length == 0) { return(false); } string[] assemblyFolders = Bamboo.CSharp.FrameworkDetector.GetAssemblyFolders(); foreach (string assemblyFolder in assemblyFolders) { if (referencePath.ToLower().StartsWith(assemblyFolder.ToLower())) { return(true); } } return(false); }
public CSharpLatestCompiler() { if (Bamboo.CSharp.FrameworkDetector.IsInstalled("2.0")) { this._compiler = new Bamboo.CSharp.Compilers.CSharp20.CSharp20Compiler(); } else if (Bamboo.CSharp.FrameworkDetector.IsInstalled("1.1")) { this._compiler = new Bamboo.CSharp.Compilers.CSharp11.CSharp11Compiler(); } else { throw new System.Exception("No supported .NET version installed."); } }
public static bool IsFrameworkReference(string hintPath, string path, Bamboo.CSharp.Compilers.Compiler compiler) { string referencePath = GetReferencePath(path, hintPath, compiler); if (referencePath == null) { return(false); } if (referencePath.Length == 0) { return(false); } string installRoot = Bamboo.CSharp.FrameworkDetector.GetInstallRoot(); if (referencePath.ToLower().StartsWith(installRoot.ToLower())) { return(true); } return(false); }
public ProjectBuilder(Bamboo.CSharp.Compilers.Compiler compiler) { this._compiler = compiler; }
//TODO resolve this in project reader. public static string GetReferencePath(string projectPath, string hintPath, Bamboo.CSharp.Compilers.Compiler compiler) { string referencePath = System.IO.Path.Combine(projectPath, hintPath); System.IO.FileInfo fileInfo = new System.IO.FileInfo(referencePath); string name = fileInfo.Name; if (fileInfo.Exists) { return(fileInfo.FullName); } string tempHintPath = hintPath; int index = tempHintPath.IndexOf(@".." + System.IO.Path.DirectorySeparatorChar); while (index != -1) { tempHintPath = tempHintPath.Substring(index + 3); referencePath = System.IO.Path.Combine(projectPath, tempHintPath); fileInfo = new System.IO.FileInfo(referencePath); if (fileInfo.Exists) { return(fileInfo.FullName); } index = tempHintPath.IndexOf(".."); } tempHintPath = hintPath; for (int i = 0; i < 10; i++) { tempHintPath = @".." + System.IO.Path.DirectorySeparatorChar + tempHintPath; referencePath = System.IO.Path.Combine(projectPath, tempHintPath); fileInfo = new System.IO.FileInfo(referencePath); if (fileInfo.Exists) { return(fileInfo.FullName); } } // // Check in the framework. // string frameworkPath = compiler.GetFrameworkPath(); if (System.IO.File.Exists(frameworkPath + name)) { return(frameworkPath + name); } // // Check in the assembly folders. // string[] assemblyFolders = Bamboo.CSharp.FrameworkDetector.GetAssemblyFolders(); foreach (string assemblyFolder in assemblyFolders) { string sep = ""; if (!assemblyFolder.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString())) { sep = System.IO.Path.DirectorySeparatorChar.ToString(); } if (System.IO.File.Exists(assemblyFolder + sep + name)) { return(assemblyFolder + sep + name); } } return(null); }
public static string GetFrameworkReferencePath(string projectPath, string hintPath, Bamboo.CSharp.Compilers.Compiler compiler) { string frameworkPath = compiler.GetFrameworkPath(); int index = hintPath.LastIndexOf("\\"); string name = hintPath.Substring(index); return(frameworkPath + name); }