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.ComponentModel;
37 using System.Configuration;
39 namespace System.CodeDom.Compiler
41 internal sealed class Compiler : ConfigurationElement
43 static ConfigurationProperty compilerOptionsProp;
44 static ConfigurationProperty extensionProp;
45 static ConfigurationProperty languageProp;
46 static ConfigurationProperty typeProp;
47 static ConfigurationProperty warningLevelProp;
49 static ConfigurationPropertyCollection properties;
53 compilerOptionsProp = new ConfigurationProperty("compilerOptions", typeof (string), "");
54 extensionProp = new ConfigurationProperty("extension", typeof (string), "");
55 languageProp = new ConfigurationProperty("language", typeof (string), "", ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
56 typeProp = new ConfigurationProperty("type", typeof (string), "", ConfigurationPropertyOptions.IsRequired);
57 warningLevelProp = new ConfigurationProperty("warningLevel", typeof (int), 0,
58 TypeDescriptor.GetConverter (typeof (int)),
59 new IntegerValidator (0, 4),
60 ConfigurationPropertyOptions.None);
62 properties = new ConfigurationPropertyCollection ();
63 properties.Add (compilerOptionsProp);
64 properties.Add (extensionProp);
65 properties.Add (languageProp);
66 properties.Add (typeProp);
67 properties.Add (warningLevelProp);
74 public Compiler (string compilerOptions, string extension, string language, string type, int warningLevel)
76 this.CompilerOptions = compilerOptions;
77 this.Extension = extension;
78 this.Language = language;
80 this.WarningLevel = warningLevel;
83 [ConfigurationProperty ("compilerOptions", DefaultValue = "")]
84 public string CompilerOptions {
85 get { return (string) base[compilerOptionsProp]; }
86 internal set { base[compilerOptionsProp] = value; }
89 [ConfigurationProperty ("extension", DefaultValue = "")]
90 public string Extension {
91 get { return (string) base[extensionProp]; }
92 internal set { base[extensionProp] = value; }
95 [ConfigurationProperty ("language", DefaultValue = "", Options = ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey)]
96 public string Language {
97 get { return (string) base[languageProp]; }
98 internal set { base[languageProp] = value; }
101 [ConfigurationProperty ("type", DefaultValue = "", Options = ConfigurationPropertyOptions.IsRequired)]
103 get { return (string) base[typeProp]; }
104 internal set { base[typeProp] = value; }
107 [IntegerValidator (MinValue = 0, MaxValue = 4)]
108 [ConfigurationProperty ("warningLevel", DefaultValue = "0")]
109 public int WarningLevel {
110 get { return (int) base[warningLevelProp]; }
111 internal set { base[warningLevelProp] = value; }
114 protected override ConfigurationPropertyCollection Properties {
115 get { return properties; }