-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathProjectConfiguration.cs
35 lines (31 loc) · 1.06 KB
/
ProjectConfiguration.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System.Xml.Linq;
namespace DSPtoVCXPROJ;
/// <summary>
/// The <see cref="ProjectConfiguration" /> block contains a project configuration and platform, as it cannot be assumed that a project
/// only targets Win32 and only had Debug and Release configurations.
/// </summary>
class ProjectConfiguration
{
public string Configuration { get; }
public string Platform { get; }
public ConfigurationProperties Properties { get; }
public ProjectConfiguration(string configuration, string platform)
{
this.Configuration = configuration;
this.Platform = platform;
this.Properties = new($"'$(Configuration)|$(Platform)'=='{configuration}|{platform}'");
}
/// <summary>
/// Gets the block as an <see cref="XElement" />.
/// </summary>
/// <returns>The block as an <see cref="XElement" />.</returns>
public XElement GetBlock()
{
var block = Program.CreateElement(nameof(ProjectConfiguration),
new XAttribute("Include", $"{this.Configuration}|{this.Platform}")
);
block.AddIfNotBlank(this.Configuration);
block.AddIfNotBlank(this.Platform);
return block;
}
}