// if (ParentProject != null) // ParentProject.Compile (); // CSharpCodeProvider cp = new CSharpCodeProvider (); // CompilerParameters parameters = new CompilerParameters (); // foreach (ProjectReference pr in flattenNodes.OfType<ProjectReference> ()) { // Project p = solution.Projects.FirstOrDefault (pp => pp.ProjectGuid == pr.ProjectGUID); // if (p == null) // throw new Exception ("referenced project not found"); // parameters.ReferencedAssemblies.Add (p.Compile ()); // } // string outputDir = getDirectoryWithTokens (this.OutputPath); // string objDir = getDirectoryWithTokens (this.IntermediateOutputPath); // Directory.CreateDirectory (outputDir); // Directory.CreateDirectory (objDir); // parameters.OutputAssembly = System.IO.Path.Combine (outputDir, this.AssemblyName); // // True - exe file generation, false - dll file generation // if (this.OutputType == "Library") { // parameters.GenerateExecutable = false; // parameters.CompilerOptions += " /target:library"; // parameters.OutputAssembly += ".dll"; // } else { // parameters.GenerateExecutable = true; // parameters.CompilerOptions += " /target:exe"; // parameters.OutputAssembly += ".exe"; // parameters.MainClass = this.StartupObject; // } // parameters.GenerateInMemory = false; // parameters.IncludeDebugInformation = this.DebugSymbols; // parameters.TreatWarningsAsErrors = this.TreatWarningsAsErrors; // parameters.WarningLevel = this.WarningLevel; // parameters.CompilerOptions += " /noconfig"; // if (this.AllowUnsafeBlocks) // parameters.CompilerOptions += " /unsafe"; // parameters.CompilerOptions += " /delaysign+"; // parameters.CompilerOptions += " /debug:full /debug+"; // parameters.CompilerOptions += " /optimize-"; // parameters.CompilerOptions += " /define:\"DEBUG;TRACE\""; // parameters.CompilerOptions += " /nostdlib"; // foreach (ProjectItem pi in flattenNodes.Where (p => p.Type == ItemType.Reference)) { // if (string.IsNullOrEmpty (pi.HintPath)) { // parameters.CompilerOptions += " /reference:/usr/lib/mono/4.5/" + pi.Path + ".dll"; // continue; // } // parameters.ReferencedAssemblies.Add (pi.Path); // string fullHintPath = System.IO.Path.GetFullPath (System.IO.Path.Combine (RootDir, pi.HintPath.Replace ('\\', '/'))); // if (File.Exists (fullHintPath)) { // string outPath = System.IO.Path.Combine (outputDir, System.IO.Path.GetFileName (fullHintPath)); // if (!File.Exists (outPath)) // File.Copy (fullHintPath, outPath); // } // } // parameters.CompilerOptions += " /reference:/usr/lib/mono/4.5/System.Core.dll"; // parameters.CompilerOptions += " /reference:/usr/lib/mono/4.5/mscorlib.dll"; // //parameters.ReferencedAssemblies.Add ("System.Core"); // //parameters.ReferencedAssemblies.Add ("mscorlib.dll"); // IEnumerable<ProjectFile> pfs = flattenNodes.OfType<ProjectFile> (); // foreach (ProjectFile pi in pfs.Where (p => p.Type == ItemType.EmbeddedResource)) { // string absPath = pi.AbsolutePath; // string logicName = pi.LogicalName; // if (string.IsNullOrEmpty (logicName)) // parameters.CompilerOptions += string.Format (" /resource:{0},{1}", absPath, this.Name + "." + pi.Path.Replace ('/', '.')); // else // parameters.CompilerOptions += string.Format (" /resource:{0},{1}", absPath, logicName); // } // foreach (ProjectFile pi in pfs.Where (p => p.Type == ItemType.None)) { // if (pi.CopyToOutputDirectory == CopyToOutputState.Never) // continue; // string source = pi.AbsolutePath; // string target = System.IO.Path.Combine (outputDir, pi.Path); // Directory.CreateDirectory (System.IO.Path.GetDirectoryName (target)); // if (File.Exists (target)) { // if (pi.CopyToOutputDirectory == CopyToOutputState.PreserveNewest) { // if (DateTime.Compare ( // System.IO.File.GetLastWriteTime (source), // System.IO.File.GetLastWriteTime (target)) < 0) // continue; // } // File.Delete (target); // } // System.Diagnostics.Debug.WriteLine ("copy " + source + " to " + target); // File.Copy (source, target); // } // string[] files = pfs.Where (p => p.Type == ItemType.Compile).Select (p => p.AbsolutePath).ToArray (); // System.Diagnostics.Debug.WriteLine ("---- start compilation of :" + parameters.OutputAssembly); // System.Diagnostics.Debug.WriteLine (parameters.CompilerOptions); // CompilationResults = cp.CompileAssemblyFromFile (parameters, files); // solution.UpdateErrorList (); // return parameters.OutputAssembly; //} public bool TryGetProjectFileFromPath(string path, out ProjectFileNode pi) { if (path.StartsWith("#", StringComparison.Ordinal)) { pi = Flatten.OfType <ProjectFileNode> ().FirstOrDefault (f => f.Type == ItemType.EmbeddedResource && f.LogicalName == path.Substring(1)); } else { pi = Flatten.OfType <ProjectFileNode> ().FirstOrDefault(pp => pp.FullPath == path); } if (pi != null) { return(true); } foreach (ProjectItemNode pr in Flatten.OfType <ProjectItemNode> ().Where(pn => pn.Type == ItemType.ProjectReference)) { ProjectView p = solution.Projects.FirstOrDefault(pp => pp.FullPath == pr.FullPath); if (p == null) { continue; } if (p.TryGetProjectFileFromPath(path, out pi)) { return(true); } } return(false); }
public void GetStyling() { try { foreach (ProjectFileNode pi in Flatten.OfType <ProjectFileNode> ().Where(pp => pp.Type == ItemType.EmbeddedResource && pp.Extension == ".style")) { using (Stream s = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(pi.Source))) { new StyleReader(solution.Styling, s, pi.LogicalName); } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } foreach (ProjectItemNode pr in Flatten.OfType <ProjectItemNode> ().Where(pn => pn.Type == ItemType.ProjectReference)) { ProjectView p = solution.Projects.FirstOrDefault(pp => pp.FullPath == pr.FullPath); if (p != null) { //throw new Exception ("referenced project not found"); p.GetStyling(); } } //TODO:get styling from referenced assemblies }
public ProjectNode(ProjectView project) { Project = project; }
public ProjectNode(ProjectView project, ItemType _type, string _name) : this(project){ type = _type; name = _name; }
public ProjectItemNode(ProjectView project, ProjectItem item) : base(project) { Item = item; }