7a4a5508bf72760b8c839165b9888fdf1077d2c5
[mono.git] / mcs / class / corlib / System / AppDomainSetup.cs
1 //
2 // System/AppDomainSetup.cs
3 //
4 // Author:
5 //   Dietmar Maurer (dietmar@ximian.com)
6 //
7 // (C) 2001 Ximian, Inc.  http://www.ximian.com
8 //
9
10 using System;
11 using System.IO;
12 using System.Runtime.CompilerServices;
13 using System.Runtime.InteropServices;
14
15 namespace System {
16
17
18         [Serializable]
19         [ClassInterface(ClassInterfaceType.None)]
20         public sealed class AppDomainSetup : IAppDomainSetup {
21                 string application_base;
22                 string application_name;
23                 string cache_path;
24                 string configuration_file;
25                 string dynamic_base;
26                 string license_file;
27                 string private_bin_path;
28                 string private_bin_path_probe;
29                 string shadow_copy_directories;
30                 string shadow_copy_files;
31                 bool publisher_policy;
32                 private bool path_changed;
33                 private LoaderOptimization loader_optimization;
34                 bool disallow_binding_redirects;
35                 bool disallow_code_downloads;
36                 
37                 [MethodImplAttribute(MethodImplOptions.InternalCall)]
38                 private static extern AppDomainSetup InitAppDomainSetup (AppDomainSetup setup);
39
40                 public AppDomainSetup ()
41                 {
42                         InitAppDomainSetup (this);
43                 }
44                 
45                 
46                 static string GetAppBase (string appBase)
47                 {
48                         int len = appBase.Length;
49                         if (len >= 8 && appBase.ToLower ().StartsWith ("file://")) {
50                                 appBase = appBase.Substring (7);
51                                 if (Path.DirectorySeparatorChar != '/')
52                                         appBase = appBase.Replace ('/', Path.DirectorySeparatorChar);
53
54                         } else if (appBase.IndexOf (':') == -1) {
55                                 appBase = Path.GetFullPath (appBase);
56                         }
57
58                         return appBase;
59                 }
60                 
61                 public string ApplicationBase {
62
63                         get {
64                                 return GetAppBase (application_base);
65                         }
66
67                         set {
68                                 application_base = value;
69                         }
70                 }
71
72                 public string ApplicationName {
73
74                         get {
75                                 return application_name;
76                         }
77
78                         set {
79                                 application_name = value;
80                         }
81                 }
82
83                 public string CachePath {
84
85                         get {
86                                 return cache_path;
87                         }
88
89                         set {
90                                 cache_path = value;
91                         }
92                 }
93
94                 public string ConfigurationFile {
95
96                         get {
97                                 return configuration_file;
98                         }
99
100                         set {
101                                 configuration_file = value;
102                         }
103                 }
104
105                 public bool DisallowPublisherPolicy {
106                         get {
107                                 return publisher_policy;
108                         }
109
110                         set {
111                                 publisher_policy = value;
112                         }
113                 }
114                 
115                 public string DynamicBase {
116
117                         get {
118                                 return dynamic_base;
119                         }
120
121                         set {
122                                 dynamic_base = value;
123                         }
124                 }
125
126                 public string LicenseFile {
127
128                         get {
129                                 return license_file;
130                         }
131
132                         set {
133                                 license_file = value;
134                         }
135                 }
136
137                 [MonoTODO("--share-code")]
138                 public LoaderOptimization LoaderOptimization
139                 {
140                         get {
141                                 return loader_optimization;
142                         }
143
144                         set { 
145                                 loader_optimization = value;
146                         }
147                 }
148
149                 public string PrivateBinPath {
150
151                         get {
152                                 return private_bin_path;
153                         }
154
155                         set {
156                                 private_bin_path = value;
157                                 path_changed = true;
158                         }
159                 }
160
161                 public string PrivateBinPathProbe {
162
163                         get {
164                                 return private_bin_path_probe;
165                         }
166
167                         set {
168                                 private_bin_path_probe = value;
169                                 path_changed = true;
170                         }
171                 }
172
173                 public string ShadowCopyDirectories {
174
175                         get {
176                                 return shadow_copy_directories;
177                         }
178
179                         set {
180                                 shadow_copy_directories = value;
181                         }
182                 }
183
184                 public string ShadowCopyFiles {
185
186                         get {
187                                 return shadow_copy_files;
188                         }
189
190                         set {
191                                 shadow_copy_files = value;
192                         }
193                 }
194
195 #if NET_1_1
196                 public bool DisallowBindingRedirects {
197                         get {
198                                 return disallow_binding_redirects;
199                         }
200
201                         set {
202                                 disallow_binding_redirects = value;
203                         }
204                 }
205
206                 public bool DisallowCodeDownload {
207                         get {
208                                 return disallow_code_downloads;
209                         }
210
211                         set {
212                                 disallow_code_downloads = value;
213                         }
214                 }
215 #endif
216         }
217 }