Merge branch 'bugfix-main-thread-root'
[mono.git] / mcs / class / System.Web / System.Web.Compilation / BuildProviderGroup.cs
1 //
2 // System.Web.Compilation.BuildManagerDirectoryBuilder
3 //
4 // Authors:
5 //      Marek Habersack (mhabersack@novell.com)
6 //
7 // (C) 2008-2009 Novell, Inc (http://www.novell.com)
8 //
9
10 //
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:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
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.
29 //
30
31 using System;
32 using System.Collections.Generic;
33
34 namespace System.Web.Compilation
35 {
36         class BuildProviderGroup : List <BuildProvider>
37         {
38                 // Prefix for the assembly to be generated
39                 public string NamePrefix {
40                         get;
41                         private set;
42                 }
43
44                 // Can the group accept only one build provider
45                 public bool Standalone {
46                         get; set;
47                 }
48
49                 // Is the group for global.asax
50                 public bool Application 
51                 {
52                         get;
53                         private set;
54                 }
55
56                 // Does the group contain the originally requested virtual path
57                 public bool Master {
58                         get; set;
59                 }
60
61                 // Compiler type for this group
62                 public CompilerType CompilerType {
63                         get;
64                         private set;
65                 }
66                 
67                 public BuildProviderGroup ()
68                 {
69                 }
70
71                 public void AddProvider (BuildProvider bp) 
72                 {
73                         if (Count == 0) {
74                                 // We need to set the name prefix
75                                 if (bp is ApplicationFileBuildProvider) {
76                                         NamePrefix = "App_global.asax";
77                                         Application = true;
78                                 } else if (bp is ThemeDirectoryBuildProvider) {
79                                         NamePrefix = "App_Theme";
80                                         Master = true;
81                                 } else
82                                         NamePrefix = "App_Web";
83
84                                 CompilerType ct = BuildManager.GetDefaultCompilerTypeForLanguage (bp.LanguageName, null);
85                                 if (ct != null)
86                                         CompilerType = ct;
87                         }
88
89                         Add (bp);
90                 }
91         }
92 }