2 // System.Web.Configuration.CompilerCollection
5 // Chris Toshok (toshok@ximian.com)
7 // (C) 2005 Novell, Inc (http://www.novell.com)
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 #if NET_2_0 && CONFIGURATION_DEP
32 extern alias PrebuiltSystem
;
33 using TypeDescriptor
= PrebuiltSystem
.System
.ComponentModel
.TypeDescriptor
;
36 using System
.Collections
.Generic
;
37 using System
.ComponentModel
;
38 using System
.Configuration
;
40 namespace System
.CodeDom
.Compiler
42 internal sealed class Compiler
: ConfigurationElement
44 static ConfigurationProperty compilerOptionsProp
;
45 static ConfigurationProperty extensionProp
;
46 static ConfigurationProperty languageProp
;
47 static ConfigurationProperty typeProp
;
48 static ConfigurationProperty warningLevelProp
;
49 static ConfigurationProperty providerOptionsProp
;
51 static ConfigurationPropertyCollection properties
;
55 compilerOptionsProp
= new ConfigurationProperty("compilerOptions", typeof (string), "");
56 extensionProp
= new ConfigurationProperty("extension", typeof (string), "");
57 languageProp
= new ConfigurationProperty("language", typeof (string), "", ConfigurationPropertyOptions
.IsRequired
| ConfigurationPropertyOptions
.IsKey
);
58 typeProp
= new ConfigurationProperty("type", typeof (string), "", ConfigurationPropertyOptions
.IsRequired
);
59 warningLevelProp
= new ConfigurationProperty("warningLevel", typeof (int), 0,
60 TypeDescriptor
.GetConverter (typeof (int)),
61 new IntegerValidator (0, 4),
62 ConfigurationPropertyOptions
.None
);
63 providerOptionsProp
= new ConfigurationProperty ("", typeof (CompilerProviderOptionsCollection
), null, null, null,
64 ConfigurationPropertyOptions
.IsDefaultCollection
);
66 properties
= new ConfigurationPropertyCollection ();
67 properties
.Add (compilerOptionsProp
);
68 properties
.Add (extensionProp
);
69 properties
.Add (languageProp
);
70 properties
.Add (typeProp
);
71 properties
.Add (warningLevelProp
);
72 properties
.Add (providerOptionsProp
);
79 public Compiler (string compilerOptions
, string extension
, string language
, string type
, int warningLevel
)
81 this.CompilerOptions
= compilerOptions
;
82 this.Extension
= extension
;
83 this.Language
= language
;
85 this.WarningLevel
= warningLevel
;
88 [ConfigurationProperty ("compilerOptions", DefaultValue
= "")]
89 public string CompilerOptions
{
90 get { return (string) base[compilerOptionsProp]; }
91 internal set { base[compilerOptionsProp] = value; }
94 [ConfigurationProperty ("extension", DefaultValue
= "")]
95 public string Extension
{
96 get { return (string) base[extensionProp]; }
97 internal set { base[extensionProp] = value; }
100 [ConfigurationProperty ("language", DefaultValue
= "", Options
= ConfigurationPropertyOptions
.IsRequired
| ConfigurationPropertyOptions
.IsKey
)]
101 public string Language
{
102 get { return (string) base[languageProp]; }
103 internal set { base[languageProp] = value; }
106 [ConfigurationProperty ("type", DefaultValue
= "", Options
= ConfigurationPropertyOptions
.IsRequired
)]
108 get { return (string) base[typeProp]; }
109 internal set { base[typeProp] = value; }
112 [IntegerValidator (MinValue
= 0, MaxValue
= 4)]
113 [ConfigurationProperty ("warningLevel", DefaultValue
= "0")]
114 public int WarningLevel
{
115 get { return (int) base[warningLevelProp]; }
116 internal set { base[warningLevelProp] = value; }
119 [ConfigurationProperty ("", Options
= ConfigurationPropertyOptions
.IsDefaultCollection
)]
120 public CompilerProviderOptionsCollection ProviderOptions
{
121 get { return (CompilerProviderOptionsCollection) base [providerOptionsProp]; }
122 internal set { base [providerOptionsProp] = value; }
125 public Dictionary
<string, string> ProviderOptionsDictionary
{
126 get { return ProviderOptions.ProviderOptions; }
129 protected override ConfigurationPropertyCollection Properties
{
130 get { return properties; }