Improve loading and saving of VisualStudio Projects and Solutions

This commit is contained in:
Michael Becker 2014-06-10 14:09:59 -04:00
parent 8987573310
commit 29f7f7cab8
2 changed files with 24 additions and 5 deletions

View File

@ -7,6 +7,7 @@ using UniversalEditor.ObjectModels.Markup;
using UniversalEditor.DataFormats.Markup.XML;
using UniversalEditor.ObjectModels.Solution;
using UniversalEditor.ObjectModels.PropertyList;
namespace UniversalEditor.DataFormats.Solution.Microsoft.VisualStudio
{
@ -131,10 +132,20 @@ namespace UniversalEditor.DataFormats.Solution.Microsoft.VisualStudio
tagItemGroup.FullName = "ItemGroup";
tagItemGroup.Attributes.Add("Condition", " '$(Configuration)' == 'Debug' ");
MarkupTagElement tagCompile = new MarkupTagElement();
tagCompile.FullName = "Compile";
tagCompile.Attributes.Add("Include", "filename.txt");
tagItemGroup.Elements.Add(tagCompile);
foreach (ProjectFile file in proj.FileSystem.Files)
{
MarkupTagElement tagCompile = new MarkupTagElement();
tagCompile.FullName = "Compile";
tagCompile.Attributes.Add("Include", file.DestinationFileName);
foreach (Property p in file.Configuration.Properties)
{
MarkupTagElement tagProperty = new MarkupTagElement();
tagProperty.Name = p.Name;
tagProperty.Value = p.Value.ToString();
tagCompile.Elements.Add(tagProperty);
}
tagItemGroup.Elements.Add(tagCompile);
}
tagProject.Elements.Add(tagItemGroup);
}

View File

@ -71,7 +71,12 @@ namespace UniversalEditor.DataFormats.Solution.Microsoft.VisualStudio
Guid projectTypeID = new Guid(strProjectTypeID);
string restOfDeclaration = line.Substring(line.IndexOf('=') + 1).Trim();
string[] paramz = restOfDeclaration.Split(new string[] { "," }, "\"");
lastProject.Title = paramz[0].Trim();
lastProject.RelativeFileName = paramz[1].Trim();
lastProject.ID = new Guid(paramz[2].Trim());
sol.Projects.Add(lastProject);
}
else if (line == "EndProject")
{
@ -112,6 +117,9 @@ namespace UniversalEditor.DataFormats.Solution.Microsoft.VisualStudio
foreach (Project project in sol.Projects)
{
string projdir = soldir + "/" + project.Title;
project.RelativeFileName = project.Title + "\\" + project.Title + ".ueproj";
/*
if (project is SolutionFolder)
{
@ -132,11 +140,11 @@ namespace UniversalEditor.DataFormats.Solution.Microsoft.VisualStudio
SolutionObjectModel solproj = new SolutionObjectModel();
solproj.Projects.Add(project);
string projdir = soldir + "/" + project.Title;
if (!System.IO.Directory.Exists(projdir))
{
System.IO.Directory.CreateDirectory(projdir);
}
Document.Save(solproj, new VisualStudioProjectDataFormat(), new FileAccessor(projdir + "/" + project.Title + ".ueproj", true, true), true);
}