-
Notifications
You must be signed in to change notification settings - Fork 4
/
ConfigurationProperties.cs
71 lines (63 loc) · 2.46 KB
/
ConfigurationProperties.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System.Xml.Linq;
namespace DSPtoVCXPROJ;
/// <summary>
/// The configuration properties of a project, the condition is usually a comparison against Configuration and Platform.
/// </summary>
class ConfigurationProperties
{
public string Condition { get; }
public ConfigurationProperties(string condition) => this.Condition = condition;
public bool? UseDebugLibraries { get; set; }
public string? UseOfMfc { get; set; }
public string? CharacterSet { get; set; }
public string? OutDir { get; set; }
public string? IntDir { get; set; }
public ClCompile ClCompile { get; } = new();
public Link Link { get; } = new();
public Lib Lib { get; } = new();
public ResourceCompile ResourceCompile { get; } = new();
public PreLinkEvent PreLinkEvent { get; } = new();
public PostBuildEvent PostBuildEvent { get; } = new();
public CustomBuildStep CustomBuildStep { get; } = new();
/// <summary>
/// Gets the PropertyGroup block for before the PropertySheets blocks.
/// </summary>
/// <returns>The PropertyGroup <see cref="XElement" /> block.</returns>
public XElement GetPrePropsBlock()
{
var block = Program.CreatePropertyGroupBlock(this.Condition, "Configuration");
block.AddIfNotBlank(Program.ConfigurationType);
block.AddIfNotNull(this.UseDebugLibraries);
block.AddIfNotBlank(this.UseOfMfc);
block.AddIfNotBlank(this.CharacterSet);
return block;
}
/// <summary>
/// Gets the PropertyGroup block for after the PropertySheets blocks.
/// </summary>
/// <returns>The PropertyGroup <see cref="XElement" /> block.</returns>
public XElement GetPostPropsBlock()
{
var block = Program.CreatePropertyGroupBlock(this.Condition, null);
block.AddIfNotBlank(this.OutDir);
block.AddIfNotBlank(this.IntDir);
return block;
}
/// <summary>
/// Gets the ItemDefinitionGroup block for after the post-PropertySheets PropertyGroup block.
/// </summary>
/// <returns>The PropertyGroup <see cref="XElement" /> block.</returns>
public XElement GetItemDefinitionBlock()
{
var block = Program.CreateElement("ItemDefinitionGroup");
block.AddAttributeIfNotBlank(this.Condition);
block.AddIfHasElements(this.ClCompile.GetBlock());
block.AddIfHasElements(this.Link.GetBlock());
block.AddIfHasElements(this.Lib.GetBlock());
block.AddIfHasElements(this.ResourceCompile.GetBlock());
block.AddIfHasElements(this.PreLinkEvent.GetBlock());
block.AddIfHasElements(this.PostBuildEvent.GetBlock());
block.AddIfHasElements(this.CustomBuildStep.GetBlock());
return block;
}
}