1
by Sebastian Dröge
Import upstream version 0.9 |
1 |
// <file>
|
2 |
// <copyright see="prj:///doc/copyright.txt"/>
|
|
3 |
// <license see="prj:///doc/license.txt"/>
|
|
4 |
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
|
5 |
// <version value="$version"/>
|
|
6 |
// </file>
|
|
7 |
||
8 |
using System; |
|
9 |
using System.Xml; |
|
10 |
using System.IO; |
|
11 |
using System.Collections; |
|
12 |
using System.Reflection; |
|
13 |
using System.Diagnostics; |
|
14 |
using System.CodeDom.Compiler; |
|
15 |
||
16 |
using MonoDevelop.Projects; |
|
17 |
using MonoDevelop.Projects.Serialization; |
|
18 |
||
19 |
using MonoDevelop.Core.Properties; |
|
20 |
||
21 |
namespace MonoDevelop.Projects |
|
22 |
{
|
|
23 |
public class CombineConfiguration : AbstractConfiguration |
|
24 |
{
|
|
25 |
[ExpandedCollection]
|
|
26 |
[ItemProperty ("Entry", ValueType=typeof(CombineConfigurationEntry))]
|
|
27 |
ArrayList configurations = new ArrayList(); |
|
1.1.1
by Sebastian Dröge
Import upstream version 0.10 |
28 |
Combine combine; |
1
by Sebastian Dröge
Import upstream version 0.9 |
29 |
|
30 |
public CombineConfiguration () |
|
31 |
{
|
|
32 |
}
|
|
33 |
||
34 |
public CombineConfiguration (string name) |
|
35 |
{
|
|
36 |
this.Name = name; |
|
37 |
}
|
|
38 |
||
39 |
internal void SetCombine (Combine combine) |
|
40 |
{
|
|
1.1.1
by Sebastian Dröge
Import upstream version 0.10 |
41 |
this.combine = combine; |
1
by Sebastian Dröge
Import upstream version 0.9 |
42 |
foreach (CombineConfigurationEntry conf in configurations) { |
43 |
conf.SetCombine (combine); |
|
44 |
if (conf.ConfigurationName == null) |
|
45 |
conf.ConfigurationName = Name; |
|
46 |
}
|
|
1.1.1
by Sebastian Dröge
Import upstream version 0.10 |
47 |
if (combine != null) |
48 |
combine.UpdateActiveConfigurationTree (); |
|
1
by Sebastian Dröge
Import upstream version 0.9 |
49 |
}
|
50 |
||
51 |
public ICollection Entries { |
|
52 |
get { return configurations; } |
|
53 |
}
|
|
54 |
||
55 |
public CombineConfigurationEntry GetConfiguration(int number) |
|
56 |
{
|
|
57 |
if (number < configurations.Count) { |
|
58 |
return (CombineConfigurationEntry)configurations[number]; |
|
59 |
}
|
|
60 |
Debug.Assert(false, "Configuration number " + number + " not found.\n" + configurations.Count + " configurations avaiable."); |
|
61 |
return null; |
|
62 |
}
|
|
63 |
||
1.1.1
by Sebastian Dröge
Import upstream version 0.10 |
64 |
public CombineConfigurationEntry AddEntry (CombineEntry combineEntry) |
1
by Sebastian Dröge
Import upstream version 0.9 |
65 |
{
|
66 |
CombineConfigurationEntry conf = new CombineConfigurationEntry(); |
|
1.1.1
by Sebastian Dröge
Import upstream version 0.10 |
67 |
conf.SetCombine (combine); |
68 |
conf.Entry = combineEntry; |
|
69 |
conf.ConfigurationName = combineEntry.ActiveConfiguration != null ? combineEntry.ActiveConfiguration.Name : String.Empty; |
|
1
by Sebastian Dröge
Import upstream version 0.9 |
70 |
conf.Build = true; |
71 |
configurations.Add(conf); |
|
1.1.1
by Sebastian Dröge
Import upstream version 0.10 |
72 |
if (combine != null) |
73 |
combine.UpdateActiveConfigurationTree (); |
|
1
by Sebastian Dröge
Import upstream version 0.9 |
74 |
return conf; |
75 |
}
|
|
76 |
||
77 |
public void RemoveEntry (CombineEntry entry) |
|
78 |
{
|
|
79 |
CombineConfigurationEntry removeConfig = null; |
|
80 |
||
81 |
foreach (CombineConfigurationEntry config in configurations) { |
|
82 |
if (config.Entry == entry) { |
|
83 |
removeConfig = config; |
|
84 |
break; |
|
85 |
}
|
|
86 |
}
|
|
87 |
||
88 |
Debug.Assert(removeConfig != null); |
|
89 |
configurations.Remove(removeConfig); |
|
90 |
}
|
|
91 |
||
92 |
public override void CopyFrom (IConfiguration configuration) |
|
93 |
{
|
|
94 |
base.CopyFrom (configuration); |
|
95 |
CombineConfiguration conf = (CombineConfiguration) configuration; |
|
96 |
||
97 |
configurations.Clear (); |
|
98 |
foreach (CombineConfigurationEntry cce in conf.configurations) { |
|
99 |
CombineConfigurationEntry nc = new CombineConfigurationEntry (); |
|
1.1.1
by Sebastian Dröge
Import upstream version 0.10 |
100 |
nc.SetCombine (combine); |
1
by Sebastian Dröge
Import upstream version 0.9 |
101 |
nc.Entry = cce.Entry; |
102 |
nc.ConfigurationName = cce.ConfigurationName; |
|
103 |
nc.Build = cce.Build; |
|
104 |
configurations.Add (nc); |
|
105 |
}
|
|
1.1.1
by Sebastian Dröge
Import upstream version 0.10 |
106 |
if (combine != null) |
107 |
combine.UpdateActiveConfigurationTree (); |
|
1
by Sebastian Dröge
Import upstream version 0.9 |
108 |
}
|
109 |
}
|
|
110 |
||
111 |
public class CombineConfigurationEntry |
|
112 |
{
|
|
113 |
string entryName; |
|
1.1.1
by Sebastian Dröge
Import upstream version 0.10 |
114 |
string configName; |
115 |
Combine combine; |
|
1
by Sebastian Dröge
Import upstream version 0.9 |
116 |
|
117 |
[ItemProperty ("name")]
|
|
118 |
internal string EntryName { |
|
119 |
get { return Entry != null ? Entry.Name : entryName; } |
|
120 |
set { entryName = value; } |
|
121 |
}
|
|
122 |
||
123 |
public CombineEntry entry; |
|
124 |
|
|
125 |
[ItemProperty ("configuration")]
|
|
1.1.1
by Sebastian Dröge
Import upstream version 0.10 |
126 |
public string ConfigurationName { |
127 |
get { return configName; } |
|
128 |
set { |
|
129 |
configName = value; |
|
130 |
if (Entry != null && combine != null) |
|
131 |
combine.UpdateActiveConfigurationTree (); |
|
132 |
}
|
|
133 |
}
|
|
1
by Sebastian Dröge
Import upstream version 0.9 |
134 |
|
135 |
[ItemProperty ("build")]
|
|
136 |
public bool Build; |
|
137 |
||
138 |
public CombineEntry Entry { |
|
139 |
get { return entry; } |
|
140 |
set { entry = value; if (entry != null) entryName = entry.Name; } |
|
141 |
}
|
|
142 |
||
143 |
internal void SetCombine (Combine combine) |
|
144 |
{
|
|
1.1.1
by Sebastian Dröge
Import upstream version 0.10 |
145 |
this.combine = combine; |
146 |
if (entryName != null && combine != null) |
|
1
by Sebastian Dröge
Import upstream version 0.9 |
147 |
Entry = combine.Entries [entryName]; |
148 |
}
|
|
149 |
}
|
|
150 |
}
|