// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.Collections.Generic;
using System.Text;
}
}
}
-#endif
+
using System.Threading;
using System.Collections;
-using System.Security.Permissions;
-#if NET_2_0
using System.Collections.Generic;
-#endif
+using System.Security.Permissions;
using System.Web.Configuration;
namespace System.Web.Caching
{
public static readonly DateTime NoAbsoluteExpiration = DateTime.MaxValue;
public static readonly TimeSpan NoSlidingExpiration = TimeSpan.Zero;
-
-#if NET_2_0 && SYSTEMCORE_DEP
ReaderWriterLockSlim cacheLock;
-#else
- ReaderWriterLock cacheLock;
-#endif
-
-#if NET_2_0
Dictionary <string, CacheItem> cache;
-#else
- Hashtable cache;
-#endif
CacheItemPriorityQueue timedItems;
Timer expirationTimer;
long expirationTimerPeriod = 0;
Cache dependencyCache;
-#if NET_2_0
bool? disableExpiration;
long privateBytesLimit = -1;
long percentagePhysicalMemoryLimit = -1;
return percentagePhysicalMemoryLimit;
}
}
-#else
- bool DisableExpiration {
- get { return false; }
- }
-#endif
public Cache ()
{
-#if NET_2_0 && SYSTEMCORE_DEP
cacheLock = new ReaderWriterLockSlim ();
-#else
- cacheLock = new ReaderWriterLock ();
-#endif
-
-#if NET_2_0
cache = new Dictionary <string, CacheItem> (StringComparer.Ordinal);
-#else
- cache = new Hashtable ();
-#endif
}
public int Count {
return null;
CacheItem ret;
-#if NET_2_0
if (cache.TryGetValue (key, out ret))
return ret;
-#else
- ret = cache [key] as CacheItem;
- if (ret != null)
- return ret;
-#endif
return null;
}
return null;
CacheItem ret = null;
-#if NET_2_0
if (!cache.TryGetValue (key, out ret))
return null;
-#else
- ret = cache [key] as CacheItem;
- if (ret == null)
- return null;
-#endif
ret.Disabled = true;
cache.Remove (key);
bool locked = false;
try {
-#if NET_2_0 && SYSTEMCORE_DEP
cacheLock.EnterWriteLock ();
-#else
- cacheLock.AcquireWriterLock (-1);
-#endif
locked = true;
CacheItem it = GetCacheItem (key);
return it.Value;
Insert (key, value, dependencies, absoluteExpiration, slidingExpiration, priority, onRemoveCallback, false);
} finally {
- if (locked) {
-#if NET_2_0 && SYSTEMCORE_DEP
+ if (locked)
cacheLock.ExitWriteLock ();
-#else
- cacheLock.ReleaseWriterLock ();
-#endif
- }
}
return null;
{
bool locked = false;
try {
-#if NET_2_0 && SYSTEMCORE_DEP
cacheLock.EnterUpgradeableReadLock ();
-#else
- cacheLock.AcquireReaderLock (-1);
-#endif
locked = true;
CacheItem it = GetCacheItem (key);
if (it == null)
return null;
if (it.Dependency != null && it.Dependency.HasChanged) {
-#if !NET_2_0
- LockCookie lc = default (LockCookie);
-#endif
try {
-#if NET_2_0
cacheLock.EnterWriteLock ();
-#else
- lc = cacheLock.UpgradeToWriterLock (-1);
-#endif
Remove (it.Key, CacheItemRemovedReason.DependencyChanged, false);
} finally {
-#if NET_2_0
cacheLock.ExitWriteLock ();
-#else
- cacheLock.DowngradeFromWriterLock (ref lc);
-#endif
}
return null;
}
} else if (DateTime.Now >= it.AbsoluteExpiration) {
-#if !NET_2_0
- LockCookie lc = default (LockCookie);
-#endif
try {
-#if NET_2_0
cacheLock.EnterWriteLock ();
-#else
- lc = cacheLock.UpgradeToWriterLock (-1);
-#endif
Remove (key, CacheItemRemovedReason.Expired, false);
} finally {
-#if NET_2_0
cacheLock.ExitWriteLock ();
-#else
- cacheLock.DowngradeFromWriterLock (ref lc);
-#endif
}
return null;
return it.Value;
} finally {
if (locked) {
-#if NET_2_0 && SYSTEMCORE_DEP
cacheLock.ExitUpgradeableReadLock ();
-#else
- cacheLock.ReleaseReaderLock ();
-#endif
}
}
}
try {
if (doLock) {
-#if NET_2_0 && SYSTEMCORE_DEP
cacheLock.EnterWriteLock ();
-#else
- cacheLock.AcquireWriterLock (-1);
-#endif
locked = true;
}
SetItemTimeout (ci, absoluteExpiration, slidingExpiration, ci.OnRemoveCallback, null, false);
} finally {
if (locked) {
-#if NET_2_0 && SYSTEMCORE_DEP
cacheLock.ExitWriteLock ();
-#else
- cacheLock.ReleaseWriterLock ();
-#endif
}
}
}
bool locked = false;
try {
if (doLock) {
-#if NET_2_0 && SYSTEMCORE_DEP
cacheLock.EnterWriteLock ();
-#else
- cacheLock.AcquireWriterLock (-1);
-#endif
locked = true;
}
EnqueueTimedItem (ci);
} finally {
if (locked) {
-#if NET_2_0 && SYSTEMCORE_DEP
cacheLock.ExitWriteLock ();
-#else
- cacheLock.ReleaseWriterLock ();
-#endif
}
}
}
bool locked = false;
try {
if (doLock) {
-#if NET_2_0 && SYSTEMCORE_DEP
cacheLock.EnterWriteLock ();
-#else
- cacheLock.AcquireWriterLock (-1);
-#endif
locked = true;
}
it = RemoveCacheItem (key);
} finally {
if (locked) {
-#if NET_2_0 && SYSTEMCORE_DEP
cacheLock.ExitWriteLock ();
-#else
- cacheLock.ReleaseWriterLock ();
-#endif
}
}
t.Dispose ();
if (it.Dependency != null) {
-#if NET_2_0
it.Dependency.SetCache (null);
-#endif
it.Dependency.DependencyChanged -= new EventHandler (OnDependencyChanged);
it.Dependency.Dispose ();
}
CacheItemRemovedReason reason = CacheItemRemovedReason.Removed;
bool locked = false;
try {
-#if NET_2_0 && SYSTEMCORE_DEP
cacheLock.EnterReadLock ();
-#else
- cacheLock.AcquireReaderLock (-1);
-#endif
locked = true;
foreach (string key in cache.Keys) {
CacheItem item = GetCacheItem (key);
}
} finally {
if (locked) {
-#if NET_2_0 && SYSTEMCORE_DEP
cacheLock.ExitReadLock ();
-#else
- cacheLock.ReleaseReaderLock ();
-#endif
}
}
}
ArrayList list = new ArrayList ();
bool locked = false;
try {
-#if NET_2_0 && SYSTEMCORE_DEP
cacheLock.EnterReadLock ();
-#else
- cacheLock.AcquireReaderLock (-1);
-#endif
locked = true;
-#if NET_2_0
foreach (CacheItem it in cache.Values)
list.Add (it);
-#else
- list.AddRange (cache.Values);
-#endif
} finally {
if (locked) {
-#if NET_2_0 && SYSTEMCORE_DEP
cacheLock.ExitReadLock ();
-#else
- cacheLock.ReleaseReaderLock ();
-#endif
}
}
IList list;
bool locked = false;
try {
-#if NET_2_0 && SYSTEMCORE_DEP
cacheLock.EnterWriteLock ();
-#else
- cacheLock.AcquireWriterLock (-1);
-#endif
locked = true;
-#if NET_2_0
list = new List <CacheItem> ();
foreach (CacheItem it in cache.Values)
list.Add (it);
-#else
- list = new ArrayList ();
- ((ArrayList)list).AddRange (cache.Values);
-#endif
foreach (CacheItem it in list) {
if (it.Dependency != null && it.Dependency.HasChanged)
}
} finally {
if (locked) {
-#if NET_2_0 && SYSTEMCORE_DEP
cacheLock.ExitWriteLock ();
-#else
- cacheLock.ReleaseWriterLock ();
-#endif
}
}
}
{
bool locked = false;
try {
-#if NET_2_0 && SYSTEMCORE_DEP
cacheLock.EnterReadLock ();
-#else
- cacheLock.AcquireReaderLock (-1);
-#endif
locked = true;
CacheItem it = GetCacheItem (key);
return it.LastChange;
} finally {
if (locked) {
-#if NET_2_0 && SYSTEMCORE_DEP
cacheLock.ExitReadLock ();
-#else
- cacheLock.ReleaseReaderLock ();
-#endif
}
}
}
using System.ComponentModel;
using System.IO;
using System.Security.Permissions;
-#if NET_2_0
using System.Text;
-#endif
namespace System.Web.Caching
{
-#if NET_2_0
// CAS
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- public class CacheDependency: IDisposable {
-#else
- // CAS - no InheritanceDemand here as the class is sealed
- [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- public sealed class CacheDependency: IDisposable {
-#endif
+ public class CacheDependency: IDisposable
+ {
static readonly object dependencyChangedEvent = new object ();
string[] cachekeys;
CacheDependency dependency;
Cache cache;
FileSystemWatcher[] watchers;
bool hasChanged;
-#if NET_2_0
bool used;
DateTime utcLastModified;
-#endif
object locker = new object ();
EventHandlerList events = new EventHandlerList ();
remove { events.RemoveHandler (dependencyChangedEvent, value); }
}
-#if NET_2_0
public CacheDependency (): this (null, null, null, DateTime.Now)
{
}
-#endif
public CacheDependency (string filename): this (new string[] { filename }, null, null, DateTime.Now)
{
dependency.DependencyChanged += new EventHandler (OnChildDependencyChanged);
this.start = start;
-#if NET_2_0
FinishInit ();
-#endif
}
-#if NET_2_0
public virtual string GetUniqueID ()
{
StringBuilder sb = new StringBuilder ();
sb.AppendFormat ("_{0}", key);
return sb.ToString ();
}
-#endif
void OnChanged (object sender, FileSystemEventArgs args)
{
if (DateTime.Now < start)
return false;
hasChanged = true;
-#if NET_2_0
utcLastModified = DateTime.UtcNow;
-#endif
DisposeWatchers ();
if (cache != null)
DependencyDispose ();
}
-#if NET_2_0
internal virtual void DependencyDisposeInternal ()
{
}
-#endif
-#if NET_2_0
- protected virtual
-#endif
- void DependencyDispose ()
+ protected virtual void DependencyDispose ()
{
-#if NET_2_0
DependencyDisposeInternal ();
-#endif
DisposeWatchers ();
if (dependency != null) {
dependency.DependencyChanged -= new EventHandler (OnChildDependencyChanged);
internal void SetCache (Cache c)
{
cache = c;
-#if NET_2_0
used = c != null;
-#endif
}
-#if NET_2_0
protected internal void FinishInit ()
{
utcLastModified = DateTime.UtcNow;
{
this.utcLastModified = utcLastModified;
}
-#endif
public bool HasChanged {
get {
EventHandler eh = events [dependencyChangedEvent] as EventHandler;
if (eh != null)
eh (sender, e);
- }
-
-#if NET_2_0
- protected
-#else
- internal
-#endif
- void NotifyDependencyChanged (object sender, EventArgs e)
+ }
+
+ protected void NotifyDependencyChanged (object sender, EventArgs e)
{
OnDependencyChanged (sender, e);
}
using System.IO;
using System.Text;
-#if NET_2_0
using System.Collections.Generic;
-#endif
namespace System.Web.Caching
{
{
public readonly byte[] Buffer;
public readonly long Length;
-#if NET_2_0
public readonly HttpResponseSubstitutionCallback Callback;
-#endif
public DataItem (byte[] buffer, long length)
{
Length = length;
}
-#if NET_2_0
public DataItem (HttpResponseSubstitutionCallback callback) : this (null, 0)
{
Callback = callback;
}
-#endif
}
HttpCachePolicy policy;
string status_desc;
int content_length;
NameValueCollection headers;
-#if NET_2_0
List <DataItem> data;
-#else
- ArrayList data;
-#endif
IList Data {
get {
- if (data == null) {
-#if NET_2_0
+ if (data == null)
data = new List <DataItem> ();
-#else
- data = new ArrayList ();
-#endif
- }
return data;
}
Data.Add (new DataItem (ms.GetBuffer (), ms.Length));
}
-#if NET_2_0
public void SetData (HttpResponseSubstitutionCallback callback)
{
if (callback == null)
Data.Add (new DataItem (callback));
}
-#endif
public IList GetData ()
{
//
using System.Collections;
+using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Web;
using System.Web.Util;
using System.Web.Compilation;
-#if NET_2_0
-using System.Collections.Generic;
-#endif
-
-namespace System.Web.Caching {
-
- internal sealed class OutputCacheModule : IHttpModule
+namespace System.Web.Caching
+{
+ sealed class OutputCacheModule : IHttpModule
{
CacheItemRemovedCallback response_removed;
-
-#if NET_2_0
static object keysCacheLock = new object ();
Dictionary <string, string> keysCache;
Dictionary <string, string> entriesToInvalidate;
-#endif
public OutputCacheModule ()
{
response_removed = new CacheItemRemovedCallback (OnRawResponseRemoved);
}
-#if NET_2_0
void OnBuildManagerRemoveEntry (BuildManagerRemoveEntryEventArgs args)
{
string entry = args.EntryName;
if (!String.IsNullOrEmpty (cacheValue))
context.InternalCache.Remove (cacheValue);
}
-#endif
void OnResolveRequestCache (object o, EventArgs args)
{
if (c == null)
return;
-#if NET_2_0
lock (keysCacheLock) {
string invValue;
if (entriesToInvalidate != null && entriesToInvalidate.TryGetValue (vary_key, out invValue) && String.Compare (invValue, key, StringComparison.Ordinal) == 0) {
return;
}
}
-#endif
ArrayList callbacks = c.Policy.ValidationCallbacks;
if (callbacks != null && callbacks.Count > 0) {
continue;
}
-#if NET_2_0
if (d.Callback == null)
continue;
byte[] bytes = outEnc.GetBytes (s);
response.BinaryWrite (bytes, 0, bytes.Length);
-#endif
}
}
CachedVaryBy varyby = context.Cache [vary_key] as CachedVaryBy;
CachedRawResponse prev = null;
bool lookup = true;
-#if NET_2_0
string cacheKey = null, cacheValue = null;
-#endif
if (varyby == null) {
string path = context.Request.MapPath (vary_key);
Cache.NoSlidingExpiration,
CacheItemPriority.Normal, null);
lookup = false;
-#if NET_2_0
cacheKey = vary_key;
-#endif
}
key = varyby.CreateKey (vary_key, context);
CacheItemPriority.Normal, response_removed);
c.VaryBy = varyby;
varyby.ItemList.Add (key);
-#if NET_2_0
cacheValue = key;
-#endif
}
}
-#if NET_2_0
if (cacheKey != null) {
lock (keysCacheLock) {
if (keysCache == null) {
keysCache.Add (cacheKey, cacheValue);
}
}
-#endif
}
static void OnRawResponseRemoved (string key, object value, CacheItemRemovedReason reason)
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.ComponentModel;
using System.Security.Permissions;
}
}
}
-#endif
\ No newline at end of file
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
}
}
}
-#endif
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System.IO;
namespace System.Web.Compilation
{
- internal class AppResourceFileInfo
+ class AppResourceFileInfo
{
public readonly bool Embeddable;
public readonly bool Compilable;
}
};
};
-#endif
\ No newline at end of file
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.Collections.Generic;
using System.Globalization;
}
};
};
-#endif
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
}
}
}
-#endif
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
}
};
};
-#endif
+
// Authors:
// Chris Toshok (toshok@ximian.com)
//
-// (C) 2006 Novell, Inc (http://www.novell.com)
+// (C) 2006-2009 Novell, Inc (http://www.novell.com)
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System;
using System.CodeDom;
using System.Web.UI;
using System.Reflection;
-namespace System.Web.Compilation {
-
+namespace System.Web.Compilation
+{
[ExpressionEditor("System.Web.UI.Design.AppSettingsExpressionEditor, " + Consts.AssemblySystem_Design)]
[ExpressionPrefix("AppSettings")]
- public class AppSettingsExpressionBuilder : ExpressionBuilder {
-
+ public class AppSettingsExpressionBuilder : ExpressionBuilder
+ {
public override object EvaluateExpression (object target, BoundPropertyEntry entry, object parsedData, ExpressionBuilderContext context)
{
return GetAppSetting (entry.Expression.Trim ());
}
}
-
public override CodeExpression GetCodeExpression (BoundPropertyEntry entry, object parsedData, ExpressionBuilderContext context)
{
Type type = entry.DeclaringType;
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0 && WEBSERVICES_DEP
+#if WEBSERVICES_DEP
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
-// (C) 2008 Novell, Inc
+// (C) 2008-2009 Novell, Inc
//
//
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
}
}
}
-#endif
+
//
using System;
using System.Collections;
+using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Reflection;
-using System.Web.Util;
-
-#if NET_2_0
-using System.Collections.Generic;
using System.Web;
using System.Web.Configuration;
using System.Web.UI;
-#endif
+using System.Web.Util;
namespace System.Web.Compilation
{
- internal class AspComponentFoundry
+ class AspComponentFoundry
{
Hashtable foundries;
-#if NET_2_0
Dictionary <string, AspComponent> components;
-#else
- Hashtable components;
-#endif
-
-#if NET_2_0
Dictionary <string, AspComponent> Components {
get {
if (components == null)
return components;
}
}
-#else
- Hashtable Components {
- get {
- if (components == null)
- components = new Hashtable (CaseInsensitiveHashCodeProvider.DefaultInvariant, CaseInsensitiveComparer.DefaultInvariant);
- return components;
- }
- }
-#endif
public AspComponentFoundry ()
{
-#if NET_2_0
foundries = new Hashtable (StringComparer.InvariantCultureIgnoreCase);
-#else
- foundries = new Hashtable (CaseInsensitiveHashCodeProvider.DefaultInvariant,
- CaseInsensitiveComparer.DefaultInvariant);
-#endif
-
Assembly sw = typeof (AspComponentFoundry).Assembly;
RegisterFoundry ("asp", sw, "System.Web.UI.WebControls");
RegisterFoundry ("", "object", typeof (System.Web.UI.ObjectTag));
-
-#if NET_2_0
RegisterConfigControls ();
-#endif
}
public AspComponent GetComponent (string tagName)
return null;
if (components != null) {
-#if NET_2_0
AspComponent ret;
if (components.TryGetValue (tagName, out ret))
return ret;
-#else
- if (components.Contains (tagName))
- return components [tagName] as AspComponent;
-#endif
}
string foundryName, tag;
return null;
AspComponent ret = new AspComponent (type, ns, prefix, source, foundry.FromConfig);
-#if NET_2_0
Dictionary <string, AspComponent> components = Components;
-#else
- Hashtable components = Components;
-#endif
components.Add (tagName, ret);
return ret;
}
InternalRegister (foundryName, foundry, fromConfig);
}
-#if NET_2_0
public void RegisterFoundry (string foundryName, string tagName, string source)
{
RegisterFoundry (foundryName, tagName, source, false);
true);
}
}
-#endif
void InternalRegister (string foundryName, Foundry foundry, bool fromConfig)
{
{
string tagName;
Type type;
-
-#if NET_2_0
string source;
public bool FromWebConfig {
this.tagName = tagName;
this.source = source;
}
-#endif
public TagNameFoundry (string tagName, Type type)
{
if (0 != String.Compare (componentName, tagName, true, Helpers.InvariantCulture))
return null;
-#if NET_2_0
source = this.source;
-#endif
return LoadType ();
}
Type LoadType ()
{
-#if NET_2_0
if (type != null)
return type;
BuildManager.AddToReferencedAssemblies (type.Assembly);
}
return type;
-#else
- return type;
-#endif
}
public string TagName {
{
string nameSpace;
Assembly assembly;
-#if NET_2_0
string assemblyName;
Dictionary <string, Assembly> assemblyCache;
-#endif
public AssemblyFoundry (Assembly assembly, string nameSpace)
{
this.assembly = assembly;
this.nameSpace = nameSpace;
-#if NET_2_0
+
if (assembly != null)
this.assemblyName = assembly.FullName;
else
this.assemblyName = null;
-#endif
}
-#if NET_2_0
public AssemblyFoundry (string assemblyName, string nameSpace)
{
this.assembly = null;
this.nameSpace = nameSpace;
this.assemblyName = assemblyName;
}
-#endif
public override Type GetType (string componentName, out string source, out string ns)
{
source = null;
ns = nameSpace;
-
-#if NET_2_0
+
if (assembly == null && assemblyName != null)
assembly = GetAssemblyByName (assemblyName, true);
-#endif
+
string typeName = String.Concat (nameSpace, ".", componentName);
if (assembly != null)
return assembly.GetType (typeName, false, true);
-#if NET_2_0
IList tla = BuildManager.TopLevelAssemblies;
if (tla != null && tla.Count > 0) {
Type ret = null;
return ret;
}
}
-#endif
+
return null;
}
-#if NET_2_0
Assembly GetAssemblyByName (string name, bool throwOnMissing)
{
if (assemblyCache == null)
assemblyCache.Add (name, assembly);
return assembly;
}
-#endif
}
class CompoundFoundry : Foundry
public CompoundFoundry (string tagPrefix)
{
this.tagPrefix = tagPrefix;
-#if NET_2_0
tagnames = new Hashtable (StringComparer.InvariantCultureIgnoreCase);
-#else
- tagnames = new Hashtable (CaseInsensitiveHashCodeProvider.DefaultInvariant,
- CaseInsensitiveComparer.DefaultInvariant);
-#endif
}
public void Add (Foundry foundry)
TagNameFoundry tn = (TagNameFoundry) foundry;
string tagName = tn.TagName;
if (tagnames.Contains (tagName)) {
-#if NET_2_0
if (tn.FromWebConfig)
return;
-#endif
+
string msg = String.Format ("{0}:{1} already registered.", tagPrefix, tagName);
throw new ApplicationException (msg);
}
//
using System;
using System.Collections;
+using System.Collections.Generic;
using System.CodeDom.Compiler;
using System.Globalization;
using System.IO;
using System.Web.UI.HtmlControls;
using System.Web.Util;
-#if NET_2_0
-using System.Collections.Generic;
-#endif
-
namespace System.Web.Compilation
{
class BuilderLocation
class AspGenerator
{
-#if NET_2_0
const int READ_BUFFER_SIZE = 8192;
internal static Regex DirectiveRegex = new Regex (@"<%\s*@(\s*(?<attrname>\w[\w:]*(?=\W))(\s*(?<equal>=)\s*""(?<attrval>[^""]*)""|\s*(?<equal>=)\s*'(?<attrval>[^']*)'|\s*(?<equal>=)\s*(?<attrval>[^\s%>]*)|(?<equal>)(?<attrval>\s*?)))*\s*?%>", RegexOptions.Compiled | RegexOptions.IgnoreCase);
-#endif
+
static readonly Regex runatServer = new Regex (@"<[\w:\.]+.*?runat=[""']?server[""']?.*?/?>",
RegexOptions.Compiled | RegexOptions.Singleline |
RegexOptions.Multiline | RegexOptions.IgnoreCase |
bool inForm;
bool useOtherTags;
TagType lastTag;
-#if NET_2_0
AspComponentFoundry componentFoundry;
Stream inputStream;
{
this.componentFoundry = componentFoundry;
}
-#endif
public AspGenerator (TemplateParser tparser)
{
this.tparser = tparser;
text = new StringBuilder ();
stack = new BuilderLocationStack ();
-
-#if !NET_2_0
- rootBuilder = new RootBuilder (tparser);
- tparser.RootBuilder = rootBuilder;
- stack.Push (rootBuilder, null);
-#endif
pstack = new ParserStack ();
}
get { return pstack.Filename; }
}
-#if NET_2_0
PageParserFilter PageParserFilter {
get {
if (tparser == null)
stack.Push (rootBuilder, null);
tparser.RootBuilder = rootBuilder;
}
-#endif
BaseCompiler GetCompilerFromType ()
{
if (type == typeof (UserControlParser))
return new UserControlCompiler ((UserControlParser) tparser);
-#if NET_2_0
+
if (type == typeof(MasterPageParser))
return new MasterPageCompiler ((MasterPageParser) tparser);
-#endif
throw new Exception ("Got type: " + type);
}
parser.Error += new ParseErrorHandler (ParseError);
parser.TagParsed += new TagParsedHandler (TagParsed);
parser.TextParsed += new TextParsedHandler (TextParsed);
-#if NET_2_0
parser.ParsingComplete += new ParsingCompleteHandler (ParsingCompleted);
tparser.AspGenerator = this;
CreateRootBuilder (inputStream, filename);
-#endif
+
if (!pstack.Push (parser))
throw new ParseException (Location, "Infinite recursion detected including file: " + filename);
}
}
-#if NET_2_0
void InitParser (string filename)
{
StreamReader reader = new StreamReader (filename, WebEncoding.FileEncoding);
InitParser (reader, filename);
}
-#endif
void CheckForDuplicateIds (ControlBuilder root, Stack scopes)
{
return;
if (scopes == null)
- scopes = new Stack ();
-
-#if NET_2_0
+ scopes = new Stack ();
+
Dictionary <string, bool> ids;
-#else
- Hashtable ids;
-#endif
if (scopes.Count == 0 || root.IsNamingContainer) {
-#if NET_2_0
ids = new Dictionary <string, bool> (StringComparer.Ordinal);
-#else
- ids = new Hashtable ();
-#endif
scopes.Push (ids);
} else {
-#if NET_2_0
ids = scopes.Peek () as Dictionary <string, bool>;
-#else
- ids = scopes.Peek () as Hashtable;
-#endif
}
if (ids == null)
public void Parse (string file)
{
-#if ONLY_1_1
- Parse (file, true);
-#else
Parse (file, false);
-#endif
}
public void Parse (TextReader reader, string filename, bool doInitParser)
if (text.Length > 0)
FlushText ();
-#if NET_2_0
tparser.MD5Checksum = pstack.Parser.MD5Checksum;
-#endif
pstack.Pop ();
#if DEBUG
public void Parse (Stream stream, string filename, bool doInitParser)
{
-#if NET_2_0
inputStream = stream;
-#endif
Parse (new StreamReader (stream, WebEncoding.FileEncoding), filename, doInitParser);
}
public void Parse ()
{
-#if NET_2_0
string inputFile = tparser.InputFile;
TextReader inputReader = tparser.Reader;
if (inputReader != null)
inputReader.Close ();
}
-#else
- Parse (Path.GetFullPath (tparser.InputFile));
-#endif
}
internal static void AddTypeToCache (ArrayList dependencies, string inputFile, Type type)
return type;
}
-#if NET_2_0
Parse ();
-#else
- try {
- Parse ();
- } catch (ParseException ex) {
- throw new HttpException ("Compilation failed.", ex);
- }
-#endif
BaseCompiler compiler = GetCompilerFromType ();
type = compiler.GetCompiledType ();
FlushText ();
}
-#if NET_2_0
void ParsingCompleted ()
{
PageParserFilter pfilter = PageParserFilter;
pfilter.ParseComplete (RootBuilder);
}
-#endif
void CheckIfIncludeFileIsSecure (string filePath)
{
if (isvirtual) {
bool parsed = false;
-#if NET_2_0
VirtualPathProvider vpp = HostingEnvironment.VirtualPathProvider;
if (vpp.FileExists (file)) {
parsed = true;
}
}
-#endif
if (!parsed)
Parse (tparser.MapPath (file), true);
return !text.EndsWith ("/>");
}
-#if NET_2_0
- List <TextBlock>
-#else
- ArrayList
-#endif
- FindRegexBlocks (Regex rxStart, Regex rxEnd, CheckBlockEnd checkEnd, IList blocks, TextBlockType typeForMatches, bool discardBlocks)
+ List <TextBlock> FindRegexBlocks (Regex rxStart, Regex rxEnd, CheckBlockEnd checkEnd, IList blocks, TextBlockType typeForMatches, bool discardBlocks)
{
-#if NET_2_0
var ret = new List <TextBlock> ();
-#else
- ArrayList ret = new ArrayList ();
-#endif
-
foreach (TextBlock block in blocks) {
if (block.Type != TextBlockType.Verbatim) {
ret.Add (block);
IList SplitTextIntoBlocks (string text)
{
-#if NET_2_0
var ret = new List <TextBlock> ();
-#else
- ArrayList ret = new ArrayList ();
-#endif
ret.Add (new TextBlock (TextBlockType.Verbatim, text));
ret = FindRegexBlocks (clientCommentRegex, null, null, ret, TextBlockType.Comment, false);
return;
if (inScript) {
-#if NET_2_0
PageParserFilter pfilter = PageParserFilter;
if (pfilter != null && !pfilter.ProcessCodeConstruct (CodeConstructType.ScriptTag, t))
return;
-#endif
+
tparser.Scripts.Add (new ServerSideScript (t, new System.Web.Compilation.Location (tparser.Location)));
return;
}
}
}
-#if NET_2_0
bool BuilderHasOtherThan (Type type, ControlBuilder cb)
{
ArrayList al = cb.OtherTags;
return true;
}
-#endif
public void AddControl (Type type, IDictionary attributes)
{
string plainText = location.PlainText;
if (!runatServer && plainText.IndexOf ("<%$") == -1&& plainText.IndexOf ("<%") > -1)
return false;
-#if NET_2_0
+
PageParserFilter pfilter = PageParserFilter;
if (pfilter != null && !pfilter.AllowControl (builder.ControlType, builder))
throw new ParseException (Location, "Control type '" + builder.ControlType + "' not allowed.");
if (!OtherControlsAllowed (builder))
throw new ParseException (Location, "Only Content controls are allowed directly in a content page that contains Content controls.");
-#endif
builder.Location = location;
builder.ID = htable ["id"] as string;
return true;
}
-#if NET_2_0
CodeConstructType MapTagTypeToConstructType (TagType tagtype)
{
switch (tagtype) {
}
}
-#endif
bool ProcessCode (TagType tagtype, string code, ILocation location)
{
-#if NET_2_0
PageParserFilter pfilter = PageParserFilter;
// LAMESPEC:
//
//
if (pfilter != null && (!pfilter.AllowCode || pfilter.ProcessCodeConstruct (MapTagTypeToConstructType (tagtype), code)))
return true;
-#endif
+
ControlBuilder b = null;
if (tagtype == TagType.CodeRender)
b = new CodeRenderBuilder (code, false, location);
if (String.Compare (lang, tparser.Language, true, Helpers.InvariantCulture) == 0)
return;
-#if NET_2_0
CompilationSection section = (CompilationSection) WebConfigurationManager.GetWebApplicationSection ("system.web/compilation");
if (section.Compilers[tparser.Language] != section.Compilers[lang])
-#else
- CompilationConfiguration cfg = CompilationConfiguration.GetInstance (HttpContext.Current);
- if (!cfg.Compilers.CompareLanguages (tparser.Language, lang))
-#endif
throw new ParseException (Location,
String.Format ("Trying to mix language '{0}' and '{1}'.",
tparser.Language, lang));
delegate void ParseErrorHandler (ILocation location, string message);
delegate void TextParsedHandler (ILocation location, string text);
delegate void TagParsedHandler (ILocation location, TagType tagtype, string id, TagAttributes attributes);
-#if NET_2_0
delegate void ParsingCompleteHandler ();
-#endif
class AspParser : ILocation
{
static readonly object errorEvent = new object ();
static readonly object tagParsedEvent = new object ();
static readonly object textParsedEvent = new object ();
-#if NET_2_0
static readonly object parsingCompleteEvent = new object();
MD5 checksum;
-#endif
AspTokenizer tokenizer;
int beginLine, endLine;
int beginColumn, endColumn;
remove { events.RemoveHandler (textParsedEvent, value); }
}
-#if NET_2_0
public event ParsingCompleteHandler ParsingComplete {
add { events.AddHandler (parsingCompleteEvent, value); }
remove { events.RemoveHandler (parsingCompleteEvent, value); }
}
-#endif
public AspParser (string filename, TextReader input)
{
this.outer = outer;
}
-#if NET_2_0
public byte[] MD5Checksum {
get {
if (checksum == null)
return checksum.Hash;
}
}
-#endif
public int BeginLine {
get {
fileReader.Close ();
fileReader = null;
}
-#if NET_2_0
checksum = tokenizer.Checksum;
-#endif
tokenizer = null;
}
-#if NET_2_0
OnParsingComplete ();
-#endif
}
bool GetInclude (string str, out string pathType, out string filename)
eh (this, text);
}
-#if NET_2_0
void OnParsingComplete ()
{
ParsingCompleteHandler eh = events [parsingCompleteEvent] as ParsingCompleteHandler;
if (eh != null)
eh ();
}
-#endif
}
}
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Marek Habersack <mhabersack@novell.com>
//
// (C) 2002,2003 Ximian, Inc (http://www.ximian.com)
+// (C) 2003-2009 Novell, Inc (http://novell.com)
//
//
class AspTokenizer
{
-#if NET_2_0
const int CHECKSUM_BUF_SIZE = 8192;
-#endif
+
class PutBackItem
{
public readonly string Value;
int unget_value;
string val;
Stack putBackBuffer;
-#if NET_2_0
MD5 checksum;
char[] checksum_buf = new char [CHECKSUM_BUF_SIZE];
int checksum_buf_pos = -1;
public MD5 Checksum {
get { return checksum; }
}
-#endif
public AspTokenizer (TextReader reader)
{
col--;
}
-#if NET_2_0
void TransformNextBlock (int count, bool final)
{
byte[] input = Encoding.UTF8.GetBytes (checksum_buf, 0, count);
} else
TransformNextBlock (checksum_buf_pos + 1, true);
}
-#endif
+
int read_char ()
{
int c;
have_unget = false;
} else {
c = sr.Read ();
-#if NET_2_0
UpdateChecksum (c);
-#endif
}
if (c == '\r' && sr.Peek () == '\n') {
c = sr.Read ();
-#if NET_2_0
UpdateChecksum (c);
-#endif
position++;
}
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.CodeDom;
using System.Web.Util;
using System.Web.Hosting;
-namespace System.Web.Compilation {
+namespace System.Web.Compilation
+{
class CompileUnitPartialType
{
public readonly CodeCompileUnit Unit;
}
}
}
-#endif
+
abstract class BaseCompiler
{
const string DEFAULT_NAMESPACE = "ASP";
-
-#if NET_2_0
internal static Guid HashMD5 = new Guid(0x406ea660, 0x64cf, 0x4c82, 0xb6, 0xf0, 0x42, 0xd4, 0x81, 0x72, 0xa7, 0x99);
- static BindingFlags replaceableFlags = BindingFlags.Public | BindingFlags.NonPublic |
- BindingFlags.Instance;
-#endif
+ static BindingFlags replaceableFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
TemplateParser parser;
CodeDomProvider provider;
CodeCompileUnit unit;
CodeNamespace mainNS;
CompilerParameters compilerParameters;
-#if NET_2_0
bool isRebuilding = false;
protected Hashtable partialNameOverride = new Hashtable();
protected CodeTypeDeclaration partialClass;
protected CodeTypeReferenceExpression partialClassExpr;
-#endif
protected CodeTypeDeclaration mainClass;
protected CodeTypeReferenceExpression mainClassExpr;
protected static CodeThisReferenceExpression thisRef = new CodeThisReferenceExpression ();
-#if NET_2_0
VirtualPath inputVirtualPath;
public VirtualPath InputVirtualPath {
return inputVirtualPath;
}
}
-#endif
protected BaseCompiler (TemplateParser parser)
{
if (parser != null && !parser.LinePragmasOn)
return true;
- return String.Compare (fileName, "@@inner_string@@",
-#if NET_2_0
- StringComparison.OrdinalIgnoreCase
-#else
- true
-#endif
- ) == 0;
+ return String.Compare (fileName, "@@inner_string@@", StringComparison.OrdinalIgnoreCase) == 0;
}
internal CodeStatement AddLinePragma (CodeStatement statement, int line, string fileName)
internal void ConstructType ()
{
unit = new CodeCompileUnit ();
-
-#if NET_2_0
byte[] md5checksum = parser.MD5Checksum;
if (md5checksum != null) {
partialClass.TypeAttributes = TypeAttributes.Public;
partialNS.Types.Add (partialClass);
}
-#endif
string mainclasstype = parser.ClassName;
string mainns = DEFAULT_NAMESPACE;
-
-#if NET_2_0
int maindot = mainclasstype.LastIndexOf ('.');
if (maindot != -1) {
mainns = mainclasstype.Substring (0, maindot);
mainclasstype = mainclasstype.Substring (maindot + 1);
}
-#endif
mainNS = new CodeNamespace (mainns);
mainClass = new CodeTypeDeclaration (mainclasstype);
CodeTypeReference baseTypeRef;
-#if NET_2_0
if (partialClass != null) {
baseTypeRef = new CodeTypeReference (parser.PartialClassName);
baseTypeRef.Options |= CodeTypeReferenceOptions.GlobalReference;
if (parser.BaseTypeIsGlobal)
baseTypeRef.Options |= CodeTypeReferenceOptions.GlobalReference;
}
-#else
- baseTypeRef = new CodeTypeReference (parser.BaseType.FullName);
-#endif
mainClass.BaseTypes.Add (baseTypeRef);
mainClassExpr = new CodeTypeReferenceExpression (mainns + "." + mainclasstype);
}
}
-#if NET_2_0
ArrayList al = WebConfigurationManager.ExtraAssemblies;
if (al != null && al.Count > 0) {
foreach (object o in al) {
refAsm.Add (asmName);
}
}
-#endif
+
// Late-bound generators specifics (as for MonoBASIC/VB.NET)
unit.UserData["RequireVariableDeclaration"] = parser.ExplicitOn;
unit.UserData["AllowLateBound"] = !parser.StrictOn;
{
CodeTypeReference mainClassTypeRef;
mainClassTypeRef = new CodeTypeReference (mainNS.Name + "." + mainClass.Name);
-
-#if NET_2_0
mainClassTypeRef.Options |= CodeTypeReferenceOptions.GlobalReference;
-#endif
+
return new CodeFieldReferenceExpression (
new CodeTypeReferenceExpression (mainClassTypeRef), fieldName);
}
mainClass.Members.Add (fld);
}
-#if NET_2_0
void AssignAppRelativeVirtualPath (CodeConstructor ctor)
{
if (String.IsNullOrEmpty (parser.InputFile))
arvpAssign.Right = new CodePrimitiveExpression (VirtualPathUtility.RemoveTrailingSlash (InputVirtualPath.AppRelative));
ctor.Statements.Add (arvpAssign);
}
-#endif
protected virtual void CreateConstructor (CodeStatementCollection localVars,
CodeStatementCollection trueStmt)
if (localVars != null)
ctor.Statements.AddRange (localVars);
-#if NET_2_0
AssignAppRelativeVirtualPath (ctor);
-#endif
CodeFieldReferenceExpression initialized = GetMainClassFieldReferenceExpression ("__initialized");
{
}
-#if NET_2_0
void InternalCreatePageProperty (string retType, string name, string contextProperty)
{
CodeMemberProperty property = new CodeMemberProperty ();
retType = "System.Web.Profile.DefaultProfile";
InternalCreatePageProperty (retType, "Profile", "Profile");
}
-#endif
protected virtual void AddInterfaces ()
{
CodeDomProvider ret = null;
par = null;
-#if NET_2_0
CompilationSection config = (CompilationSection) WebConfigurationManager.GetWebApplicationSection ("system.web/compilation");
Compiler comp = config.Compilers[lang];
par.CompilerOptions = comp.CompilerOptions;
par.WarningLevel = comp.WarningLevel;
}
-#else
- CompilationConfiguration config;
-
- config = CompilationConfiguration.GetInstance (context);
- ret = config.GetProvider (lang);
-
- par = new CompilerParameters ();
- par.CompilerOptions = config.GetCompilerOptions (lang);
- par.WarningLevel = config.GetWarningLevel (lang);
-#endif
tempdir = config.TempDirectory;
return ret;
throw new HttpException ("Configuration error. Language not supported: " +
lang, 500);
-#if !NET_2_0
- compiler = provider.CreateCompiler ();
-#endif
-
CompilerParameters parameters = CompilerParameters;
parameters.IncludeDebugInformation = parser.Debug;
parameters.CompilerOptions = compilerOptions + " " + parser.CompilerOptions;
results.TempFiles.Delete ();
Type mainClassType = assembly.GetType (MainClassType, true);
-#if NET_2_0
if (parser.IsPartial) {
// With the partial classes, we need to make sure we
// don't have any methods that should have not been
return GetCompiledType ();
}
}
-#endif
return mainClassType;
}
}
}
-#if NET_2_0
internal bool IsRebuildingPartial
{
get { return isRebuilding; }
return rebuild;
}
-#endif
internal CodeDomProvider Provider {
get { return provider; }
get { return unit; }
}
-#if NET_2_0
internal CodeTypeDeclaration DerivedType {
get { return mainClass; }
}
return partialClass;
}
}
-#endif
internal TemplateParser Parser {
get { return parser; }
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.Collections;
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Web.Hosting;
using System.Web.Util;
-namespace System.Web.Compilation {
+namespace System.Web.Compilation
+{
public sealed class BuildManager
{
internal const string FAKE_VIRTUAL_PATH_PREFIX = "/@@MonoFakeVirtualPath@@";
}
}
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System;
using System.CodeDom.Compiler;
using System.Reflection;
}
if (BuiltAssembly != null) {
- sb.Append ((first ? "" : "; ") + "assembly: " + BuiltAssembly.ToString ());
+ sb.Append ((first ? String.Empty : "; ") + "assembly: " + BuiltAssembly.ToString ());
first = false;
}
if (!String.IsNullOrEmpty (VirtualPath)) {
- sb.Append ((first ? "" : "; ") + "virtualPath: " + VirtualPath);
+ sb.Append ((first ? String.Empty : "; ") + "virtualPath: " + VirtualPath);
first = false;
}
}
}
-#endif
\ No newline at end of file
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System;
using System.Collections.Generic;
using System.Reflection;
}
}
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.Web;
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
namespace System.Web.Compilation {
public delegate void BuildManagerHostUnloadEventHandler(object sender, BuildManagerHostUnloadEventArgs e);
}
-#endif
+
// Authors:
// Marek Habersack (mhabersack@novell.com)
//
-// (C) 2008 Novell, Inc (http://www.novell.com)
+// (C) 2008-2009 Novell, Inc (http://www.novell.com)
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System;
using System.Web;
{
internal delegate void BuildManagerRemoveEntryEventHandler (BuildManagerRemoveEntryEventArgs args);
- internal class BuildManagerRemoveEntryEventArgs : EventArgs
+ class BuildManagerRemoveEntryEventArgs : EventArgs
{
public string EntryName {
get;
}
}
}
-#endif
+
// Chris Toshok (toshok@ximian.com)
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
-// (C) 2006 Novell, Inc (http://www.novell.com)
+// (C) 2006-2009 Novell, Inc (http://www.novell.com)
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
}
}
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
-namespace System.Web.Compilation {
-
+namespace System.Web.Compilation
+{
[Flags]
public enum BuildProviderAppliesTo
{
}
}
-#endif
+
// Authors:
// Chris Toshok (toshok@ximian.com)
//
-// (C) 2006 Novell, Inc (http://www.novell.com)
+// (C) 2006-2009 Novell, Inc (http://www.novell.com)
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
-namespace System.Web.Compilation {
-
+namespace System.Web.Compilation
+{
[AttributeUsage (AttributeTargets.Class)]
public sealed class BuildProviderAppliesToAttribute : Attribute
{
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System;
using System.Collections.Generic;
}
}
}
-#endif
\ No newline at end of file
using System.Resources;
-#if NET_2_0
namespace System.Web.Compilation
{
ShutdownAppDomainOnChange = 1
}
}
-#endif
+
string key = cachePrefix + compiler.Parser.InputFile;
CompilerResults results = (CompilerResults) cache [key];
-#if NET_2_0
if (!compiler.IsRebuildingPartial)
-#endif
- if (results != null)
- return results;
+ if (results != null)
+ return results;
object ticket;
bool acquired = AcquireCompilationTicket (key, out ticket);
try {
Monitor.Enter (ticket);
results = (CompilerResults) cache [key];
-#if NET_2_0
if (!compiler.IsRebuildingPartial)
-#endif
- if (results != null)
- return results;
+ if (results != null)
+ return results;
-#if NET_2_0
CodeDomProvider comp = compiler.Provider;
-#else
- ICodeCompiler comp = compiler.Compiler;
-#endif
CompilerParameters options = compiler.CompilerParameters;
GetExtraAssemblies (options);
results = comp.CompileAssemblyFromDom (options, compiler.CompileUnit);
if (results != null)
return results;
-#if NET_2_0
CodeDomProvider comp = compiler.Provider;
-#else
- ICodeCompiler comp = compiler.Compiler;
-#endif
CompilerParameters options = compiler.CompilerParameters;
GetExtraAssemblies (options);
if (provider == null)
throw new HttpException ("Configuration error. Language not supported: " +
language, 500);
-#if !NET_2_0
- ICodeCompiler compiler = provider.CreateCompiler ();
-#else
CodeDomProvider compiler = provider;
-#endif
-
CompilerParameters options = GetOptions (assemblies);
options.IncludeDebugInformation = debug;
options.WarningLevel = warningLevel;
{
StringCollection refAsm = options.ReferencedAssemblies;
string asmLocation;
-
-#if NET_2_0
string asmName;
ArrayList al = WebConfigurationManager.ExtraAssemblies;
continue;
refAsm.Add (asmLocation);
}
-#else
- CompilationConfiguration cfg = CompilationConfiguration.GetInstance (HttpContext.Current);
- ArrayList asmcoll = cfg != null ? cfg.Assemblies : null;
-
- if (asmcoll == null)
- return;
-
- foreach (string asm in asmcoll) {
- asmLocation = GetAssemblyLocationFromName (asm);
-
- if (asmLocation == null || refAsm.Contains (asmLocation))
- continue;
- refAsm.Add (asmLocation);
- }
-#endif
}
static string GetAssemblyLocationFromName (string name)
// Chris Toshok (toshok@ximian.com)
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
-// (C) 2006 Novell, Inc (http://www.novell.com)
+// (C) 2006-2009 Novell, Inc (http://www.novell.com)
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Web.Hosting;
using System.Web.Util;
-namespace System.Web.Compilation {
- public sealed class ClientBuildManager : MarshalByRefObject, IDisposable {
+namespace System.Web.Compilation
+{
+ public sealed class ClientBuildManager : MarshalByRefObject, IDisposable
+ {
static readonly object appDomainShutdownEvent = new object ();
static readonly object appDomainStartedEvent = new object ();
static readonly object appDomainUnloadedEvent = new object ();
}
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.CodeDom.Compiler;
}
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.CodeDom.Compiler;
using System.Web;
}
}
-#endif
+
public override string ErrorMessage {
get {
if (errmsg == null && errors != null) {
-#if NET_2_0
CompilerError firstError = null;
foreach (CompilerError err in errors) {
int idx = errmsg.IndexOf (" : error ");
if (idx > -1)
errmsg = errmsg.Substring (idx + 9);
-#else
- StringBuilder sb = new StringBuilder ();
- foreach (CompilerError err in errors) {
- sb.Append (err);
- sb.Append ("\n");
- }
- errmsg = sb.ToString ();
-#endif
}
return errmsg;
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System;
using System.CodeDom.Compiler;
}
}
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System;
using System.CodeDom;
}
-#endif
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.Collections.Generic;
using System.Globalization;
}
}
}
-#endif
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.Resources;
using System.Web;
}
}
}
-#endif
\ No newline at end of file
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.CodeDom;
}
-#endif
+
"ClassName", "ClientTarget", "CodePage",
"CompilerOptions", "ContentType", "Culture", "Debug",
"Description",
-#if NET_2_0
"EnableEventValidation", "MaintainScrollPositionOnPostBack",
-#endif
"EnableSessionState", "EnableViewState",
"EnableViewStateMac", "ErrorPage", "Explicit",
"Inherits", "Language", "LCID", "ResponseEncoding",
static string [] application_atts = { "description", "inherits", "codebehind" };
-#if NET_2_0
static string [] mastertype_atts = { "virtualpath", "typename" };
static string [] previouspagetype_atts = { "virtualpath", "typename" };
-#endif
static Directive ()
{
static void InitHash ()
{
-#if NET_2_0
StringComparer comparer = StringComparer.InvariantCultureIgnoreCase;
directivesHash = new Hashtable (comparer);
-#else
- CaseInsensitiveHashCodeProvider provider = new CaseInsensitiveHashCodeProvider (Helpers.InvariantCulture);
- CaseInsensitiveComparer comparer = new CaseInsensitiveComparer (Helpers.InvariantCulture);
-
- directivesHash = new Hashtable (provider, comparer);
-#endif
// Use Hashtable 'cause is O(1) in Contains (ArrayList is O(n))
-#if NET_2_0
Hashtable valid_attributes = new Hashtable (comparer);
-#else
- Hashtable valid_attributes = new Hashtable (provider, comparer);
-#endif
foreach (string att in page_atts) valid_attributes.Add (att, null);
directivesHash.Add ("PAGE", valid_attributes);
-#if NET_2_0
valid_attributes = new Hashtable (comparer);
-#else
- valid_attributes = new Hashtable (provider, comparer);
-#endif
foreach (string att in control_atts) valid_attributes.Add (att, null);
directivesHash.Add ("CONTROL", valid_attributes);
-#if NET_2_0
valid_attributes = new Hashtable (comparer);
-#else
- valid_attributes = new Hashtable (provider, comparer);
-#endif
foreach (string att in import_atts) valid_attributes.Add (att, null);
directivesHash.Add ("IMPORT", valid_attributes);
-#if NET_2_0
valid_attributes = new Hashtable (comparer);
-#else
- valid_attributes = new Hashtable (provider, comparer);
-#endif
foreach (string att in implements_atts) valid_attributes.Add (att, null);
directivesHash.Add ("IMPLEMENTS", valid_attributes);
-#if NET_2_0
valid_attributes = new Hashtable (comparer);
-#else
- valid_attributes = new Hashtable (provider, comparer);
-#endif
foreach (string att in register_atts) valid_attributes.Add (att, null);
directivesHash.Add ("REGISTER", valid_attributes);
-#if NET_2_0
valid_attributes = new Hashtable (comparer);
-#else
- valid_attributes = new Hashtable (provider, comparer);
-#endif
foreach (string att in assembly_atts) valid_attributes.Add (att, null);
directivesHash.Add ("ASSEMBLY", valid_attributes);
-#if NET_2_0
valid_attributes = new Hashtable (comparer);
-#else
- valid_attributes = new Hashtable (provider, comparer);
-#endif
foreach (string att in outputcache_atts) valid_attributes.Add (att, null);
directivesHash.Add ("OUTPUTCACHE", valid_attributes);
-#if NET_2_0
valid_attributes = new Hashtable (comparer);
-#else
- valid_attributes = new Hashtable (provider, comparer);
-#endif
foreach (string att in reference_atts) valid_attributes.Add (att, null);
directivesHash.Add ("REFERENCE", valid_attributes);
-#if NET_2_0
valid_attributes = new Hashtable (comparer);
-#else
- valid_attributes = new Hashtable (provider, comparer);
-#endif
foreach (string att in webservice_atts) valid_attributes.Add (att, null);
directivesHash.Add ("WEBSERVICE", valid_attributes);
-#if NET_2_0
valid_attributes = new Hashtable (comparer);
-#else
- valid_attributes = new Hashtable (provider, comparer);
-#endif
// same attributes as webservice
foreach (string att in webservice_atts) valid_attributes.Add (att, null);
directivesHash.Add ("WEBHANDLER", valid_attributes);
-#if NET_2_0
valid_attributes = new Hashtable (comparer);
-#else
- valid_attributes = new Hashtable (provider, comparer);
-#endif
foreach (string att in application_atts) valid_attributes.Add (att, null);
directivesHash.Add ("APPLICATION", valid_attributes);
-#if NET_2_0
valid_attributes = new Hashtable (comparer);
foreach (string att in mastertype_atts) valid_attributes.Add (att, null);
directivesHash.Add ("MASTERTYPE", valid_attributes);
valid_attributes = new Hashtable (comparer);
foreach (string att in previouspagetype_atts) valid_attributes.Add (att, null);
directivesHash.Add ("PREVIOUSPAGETYPE", valid_attributes);
-#endif
}
Directive () { }
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System.CodeDom;
using System.Web.UI;
}
}
-#endif // NET_2_0
+
// Authors:
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
-// Copyright (c) 2005 Novell, Inc (http://www.novell.com)
+// Copyright (c) 2005-2009 Novell, Inc (http://www.novell.com)
//
//
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System.CodeDom;
using System.Web.UI;
}
}
-#endif // NET_2_0
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
namespace System.Web.Compilation {
}
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
namespace System.Web.Compilation {
}
}
-#endif
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
namespace System.Web.Compilation
{
}
}
-#endif
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
}
}
}
-#endif
\ No newline at end of file
protected internal override void CreateMethods ()
{
base.CreateMethods ();
-#if NET_2_0
CreateProfileProperty ();
-#endif
-
ProcessObjects (parser.RootBuilder);
}
// Authors:
// Chris Toshok (toshok@ximian.com)
//
-// (C) 2006 Novell, Inc (http://www.novell.com)
+// (C) 2006-2009 Novell, Inc (http://www.novell.com)
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
-namespace System.Web.Compilation {
-
+namespace System.Web.Compilation
+{
public interface IAssemblyPostProcessor : IDisposable
{
void PostProcessAssembly (string path);
}
}
-#endif
+
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
+
using System.Collections;
using System.Globalization;
ICollection GetImplicitResourceKeys (string keyPrefix);
}
}
-#endif
+
using System.Resources;
using System.Globalization;
-#if NET_2_0
namespace System.Web.Compilation
{
public interface IResourceProvider
IResourceReader ResourceReader { get; }
}
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
namespace System.Web.Compilation {
[BuildProviderAppliesTo (BuildProviderAppliesTo.All)]
}
-#endif
+
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
namespace System.Web.Compilation
{
public sealed class ImplicitResourceKey
}
}
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
-namespace System.Web.Compilation {
+namespace System.Web.Compilation
+{
[Serializable]
- public sealed class LinePragmaCodeInfo {
-
+ public sealed class LinePragmaCodeInfo
+ {
public LinePragmaCodeInfo ()
{
}
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System;
using System.CodeDom;
}
}
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.CodeDom;
using System.Web.UI;
}
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System;
using System.CodeDom;
}
}
}
-#endif
+
using System;
using System.CodeDom;
using System.Collections;
+using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
using System.Web.UI;
using System.Web.SessionState;
using System.Web.Util;
-#if NET_2_0
-using System.Collections.Generic;
using System.Web.Profile;
-#endif
namespace System.Web.Compilation
{
{
base.CreateStaticFields ();
- CodeMemberField fld = new CodeMemberField (
-#if NET_2_0
- typeof (object),
-#else
- typeof (ArrayList),
-#endif
- "__fileDependencies");
+ CodeMemberField fld = new CodeMemberField (typeof (object), "__fileDependencies");
fld.Attributes = MemberAttributes.Private | MemberAttributes.Static;
fld.InitExpression = new CodePrimitiveExpression (null);
mainClass.Members.Add (fld);
-#if NET_2_0
if (pageParser.OutputCache) {
fld = new CodeMemberField (typeof (OutputCacheParameters), "__outputCacheSettings");
fld.Attributes = MemberAttributes.Private | MemberAttributes.Static;
fld.InitExpression = new CodePrimitiveExpression (null);
mainClass.Members.Add (fld);
}
-#endif
}
protected override void CreateConstructor (CodeStatementCollection localVars,
CodeStatementCollection trueStmt)
{
-#if NET_2_0
if (!String.IsNullOrEmpty (pageParser.MasterPageFile))
// This is here just to trigger master page build, so that its type
// is available when compiling the page itself.
BuildManager.GetCompiledType (pageParser.MasterPageFile);
-#endif
+
if (pageParser.ClientTarget != null) {
CodeExpression prop;
prop = new CodePropertyReferenceExpression (thisRef, "ClientTarget");
trueStmt = new CodeStatementCollection ();
CodeAssignStatement assign;
-#if NET_2_0
localVars.Add (
new CodeVariableDeclarationStatement (
typeof (string[]),
new CodeExpression[] {dependencies}
);
assign = new CodeAssignStatement (GetMainClassFieldReferenceExpression ("__fileDependencies"), getDepsCall);
-#else
- localVars.Add (new CodeVariableDeclarationStatement (
- typeof (ArrayList),
- "dependencies")
- );
-
- CodeVariableReferenceExpression dependencies = new CodeVariableReferenceExpression ("dependencies");
- trueStmt.Add (
- new CodeAssignStatement (dependencies, new CodeObjectCreateExpression (typeof (ArrayList), new CodeExpression[] {new CodePrimitiveExpression (depsCount)}))
- );
-
- CodeMethodInvokeExpression invoke;
- for (int i = 0; i < depsCount; i++) {
- invoke = new CodeMethodInvokeExpression (dependencies, "Add", new CodeExpression[] {new CodePrimitiveExpression (deps [i])});
- trueStmt.Add (invoke);
- }
- assign = new CodeAssignStatement (GetMainClassFieldReferenceExpression ("__fileDependencies"), dependencies);
-#endif
trueStmt.Add (assign);
}
if (pageParser.EnableSessionState) {
cref = new CodeTypeReference (typeof (IRequiresSessionState));
-#if NET_2_0
if (partialClass != null)
partialClass.BaseTypes.Add (cref);
else
-#endif
mainClass.BaseTypes.Add (cref);
}
if (pageParser.ReadOnlySessionState) {
cref = new CodeTypeReference (typeof (IReadOnlySessionState));
-#if NET_2_0
if (partialClass != null)
partialClass.BaseTypes.Add (cref);
else
-#endif
mainClass.BaseTypes.Add (cref);
}
-#if NET_2_0
if (pageParser.Async)
mainClass.BaseTypes.Add (new CodeTypeReference (typeof (System.Web.IHttpAsyncHandler)));
mainClass.BaseTypes.Add (new CodeTypeReference (typeof (System.Web.IHttpHandler)));
-#endif
}
void CreateGetTypeHashCode ()
string contentType = pageParser.ContentType;
if (contentType != null)
method.Statements.Add (CreatePropertyAssign ("ContentType", contentType));
-
-#if !NET_2_0
- if (pageParser.OutputCache) {
- CodeMethodReferenceExpression init = new CodeMethodReferenceExpression (null,
- "InitOutputCache");
- CodeMethodInvokeExpression invoke = new CodeMethodInvokeExpression (init,
- OutputCacheParams ());
- method.Statements.Add (invoke);
-
- }
-#endif
int lcid = pageParser.LCID;
if (lcid != -1)
method.Statements.Add (stmt);
}
-#if NET_2_0
if (!pageParser.EnableEventValidation) {
CodeAssignStatement stmt = new CodeAssignStatement ();
CodePropertyReferenceExpression prop;
stmt.Right = new CodePrimitiveExpression (pageParser.MaintainScrollPositionOnPostBack);
method.Statements.Add (stmt);
}
-#endif
}
-#if NET_2_0
protected override void AddStatementsToConstructor (CodeConstructor ctor)
{
base.AddStatementsToConstructor (ctor);
if (pageParser.OutputCache)
OutputCacheParamsBlock (ctor);
}
-#endif
protected override void AddStatementsToInitMethod (CodeMemberMethod method)
{
-#if NET_2_0
AddStatementsFromDirective (method);
ILocation directiveLocation = pageParser.DirectiveLocation;
CodeMethodInvokeExpression expr = new CodeMethodInvokeExpression (thisRef, "InitializeCulture");
method.Statements.Add (AddLinePragma (new CodeExpressionStatement (expr), directiveLocation));
-#endif
}
protected override void PrependStatementsToFrameworkInitialize (CodeMemberMethod method)
{
base.PrependStatementsToFrameworkInitialize (method);
-#if NET_2_0
if (pageParser.StyleSheetTheme != null)
method.Statements.Add (CreatePropertyAssign ("StyleSheetTheme", pageParser.StyleSheetTheme));
-#endif
}
-
protected override void AppendStatementsToFrameworkInitialize (CodeMemberMethod method)
{
CodeFieldReferenceExpression fileDependencies = GetMainClassFieldReferenceExpression ("__fileDependencies");
method.Statements.Add (
-#if NET_2_0
new CodeMethodInvokeExpression (
thisRef,
"AddWrappedFileDependencies",
new CodeExpression[] {fileDependencies})
-#else
- new CodeAssignStatement (
- new CodeFieldReferenceExpression (thisRef, "FileDependencies"),
- fileDependencies
- )
-#endif
);
}
-#if NET_2_0
if (pageParser.OutputCache) {
CodeMethodReferenceExpression init = new CodeMethodReferenceExpression (thisRef, "InitOutputCache");
CodeMethodInvokeExpression invoke = new CodeMethodInvokeExpression (init, GetMainClassFieldReferenceExpression ("__outputCacheSettings"));
method.Statements.Add (invoke);
}
-#endif
-#if ONLY_1_1
- AddStatementsFromDirective (method);
-#endif
-
-#if NET_1_1
if (pageParser.ValidateRequest) {
CodeMethodInvokeExpression expr = new CodeMethodInvokeExpression ();
CodePropertyReferenceExpression prop;
expr.Method = new CodeMethodReferenceExpression (prop, "ValidateInput");
method.Statements.Add (expr);
}
-#endif
}
-#if NET_2_0
CodeAssignStatement AssignOutputCacheParameter (CodeVariableReferenceExpression variable, string propName, object value)
{
var ret = new CodeAssignStatement ();
method.Statements.Add (cond);
}
-#else
- CodeExpression[] OutputCacheParams ()
- {
- return new CodeExpression [] {
- new CodePrimitiveExpression (pageParser.OutputCacheDuration),
- new CodePrimitiveExpression (pageParser.OutputCacheVaryByHeader),
- new CodePrimitiveExpression (pageParser.OutputCacheVaryByCustom),
- new CodeSnippetExpression (typeof (OutputCacheLocation).ToString () +
- "." + pageParser.OutputCacheLocation.ToString ()),
- new CodePrimitiveExpression (pageParser.OutputCacheVaryByParam)
- };
- }
-#endif
-
-#if NET_2_0
+
void CreateStronglyTypedProperty (Type type, string name)
{
if (type == null)
AddReferencedAssembly (type.Assembly);
}
-#endif
protected internal override void CreateMethods ()
{
base.CreateMethods ();
-#if NET_2_0
CreateProfileProperty ();
CreateStronglyTypedProperty (pageParser.MasterType, "Master");
CreateStronglyTypedProperty (pageParser.PreviousPageType, "PreviousPage");
-#endif
-
CreateGetTypeHashCode ();
-#if NET_2_0
if (pageParser.Async)
CreateAsyncMethods ();
-#endif
}
-#if NET_2_0
void CreateAsyncMethods ()
{
CodeMemberMethod method = new CodeMemberMethod ();
method.Statements.Add (invoke);
mainClass.Members.Add (method);
}
-#endif
public static Type CompilePageType (PageParser pageParser)
{
}
}
}
-
-
// Authors:
// Chris Toshok (toshok@ximian.com)
//
-// (C) 2006 Novell, Inc (http://www.novell.com/)
+// (C) 2006-2009 Novell, Inc (http://www.novell.com/)
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System;
using System.CodeDom;
}
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
-namespace System.Web.Compilation {
+namespace System.Web.Compilation
+{
[Flags]
public enum PrecompilationFlags
{
}
-#endif
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.Collections.Generic;
using System.IO;
//
// http://msdn.microsoft.com/msdnmag/issues/07/01/cuttingedge/default.aspx?loc=&fig=true#fig3
//
- internal class PreservationFile
+ class PreservationFile
{
string _filePath;
string _assembly;
}
}
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System;
using System.CodeDom;
using System.Web;
using System.Web.UI;
-namespace System.Web.Compilation {
-
+namespace System.Web.Compilation
+{
[ExpressionEditor("System.Web.UI.Design.ResourceExpressionEditor, " + Consts.AssemblySystem_Design)]
[ExpressionPrefix("Resources")]
- public class ResourceExpressionBuilder : ExpressionBuilder {
-
+ public class ResourceExpressionBuilder : ExpressionBuilder
+ {
public ResourceExpressionBuilder ()
{
}
}
-#endif
+
// Authors:
// Chris Toshok (toshok@ximian.com)
//
-// (C) 2006 Novell, Inc (http://www.novell.com)
+// (C) 2006-2009 Novell, Inc (http://www.novell.com)
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
-namespace System.Web.Compilation {
-
- public sealed class ResourceExpressionFields {
-
+namespace System.Web.Compilation
+{
+ public sealed class ResourceExpressionFields
+ {
internal ResourceExpressionFields (string classKey, string resourceKey)
{
this.classKey = classKey;
}
-#endif
// Authors:
// Chris Toshok (toshok@ximian.com)
//
-// (C) 2006 Novell, Inc (http://www.novell.com)
+// (C) 2006-2009 Novell, Inc (http://www.novell.com)
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
-namespace System.Web.Compilation {
-
+namespace System.Web.Compilation
+{
public abstract class ResourceProviderFactory
{
protected ResourceProviderFactory() { }
}
-#endif
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
namespace System.Web.Compilation
{
- internal abstract class SimpleBuildProvider : GenericBuildProvider <SimpleWebHandlerParser>
+ abstract class SimpleBuildProvider : GenericBuildProvider <SimpleWebHandlerParser>
{
bool _parsed;
bool _needLoadFromBin;
}
}
}
-#endif
\ No newline at end of file
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// (C) 2003 Ximian, Inc (http://www.ximian.com)
+// (C) 2003-2009 Novell, Inc (http://novell.com/)
//
//
void MakeHash ()
{
-#if NET_2_0
atts_hash = new Hashtable (StringComparer.InvariantCultureIgnoreCase);
-#else
- atts_hash = new Hashtable (CaseInsensitiveHashCodeProvider.DefaultInvariant,
- CaseInsensitiveComparer.DefaultInvariant);
-#endif
for (int i = 0; i < keys.Count; i++) {
CheckServerKey (keys [i]);
atts_hash.Add (keys [i], values [i]);
return atts_hash;
if (tmp_hash == null)
-#if NET_2_0
tmp_hash = new Hashtable (StringComparer.InvariantCultureIgnoreCase);
-#else
- tmp_hash = new Hashtable (CaseInsensitiveHashCodeProvider.DefaultInvariant,
- CaseInsensitiveComparer.DefaultInvariant);
-#endif
tmp_hash.Clear ();
for (int i = keys.Count - 1; i >= 0; i--)
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
namespace System.Web.Compilation
{
- internal abstract class TemplateBuildProvider : GenericBuildProvider <TemplateParser>
+ abstract class TemplateBuildProvider : GenericBuildProvider <TemplateParser>
{
delegate void ExtractDirectiveDependencies (string baseDirectory, CaptureCollection names, CaptureCollection values, TemplateBuildProvider bp);
}
}
}
-#endif
\ No newline at end of file
using System.CodeDom;
using System.Collections;
using System.ComponentModel;
+using System.Configuration;
+using System.Collections.Specialized;
+using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.Reflection;
+using System.Resources;
using System.Text;
using System.Web;
+using System.Web.Configuration;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Util;
using System.ComponentModel.Design.Serialization;
using System.Text.RegularExpressions;
-#if NET_2_0
-using System.Configuration;
-using System.Collections.Specialized;
-using System.Collections.Generic;
-using System.Web.Configuration;
-using System.Resources;
-#endif
namespace System.Web.Compilation
{
internal static CodeVariableReferenceExpression ctrlVar = new CodeVariableReferenceExpression ("__ctrl");
-#if NET_2_0
List <string> masterPageContentPlaceHolders;
static Regex startsWithBindRegex = new Regex (@"^Bind\s*\(", RegexOptions.Compiled | RegexOptions.IgnoreCase);
// When modifying those, make sure to look at the SanitizeBindCall to make sure it
// picks up correct groups.
static Regex bindRegex = new Regex (@"Bind\s*\(\s*[""']+(.*?)[""']+((\s*,\s*[""']+(.*?)[""']+)?)\s*\)\s*%>", RegexOptions.Compiled | RegexOptions.IgnoreCase);
static Regex bindRegexInValue = new Regex (@"Bind\s*\(\s*[""']+(.*?)[""']+((\s*,\s*[""']+(.*?)[""']+)?)\s*\)\s*$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
-#endif
static Regex evalRegexInValue = new Regex (@"(.*)Eval\s*\(\s*[""']+(.*?)[""']+((\s*,\s*[""']+(.*?)[""']+)?)\s*\)(.*)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
-#if NET_2_0
List <string> MasterPageContentPlaceHolders {
get {
if (masterPageContentPlaceHolders == null)
return masterPageContentPlaceHolders;
}
}
-#endif
+
public TemplateControlCompiler (TemplateControlParser parser)
: base (parser)
{
{
if (builder == null || builder.ID == null || builder.ControlType == null)
return;
-#if NET_2_0
+
if (partialNameOverride [builder.ID] != null)
return;
-#endif
MemberAttributes ma = MemberAttributes.Family;
currentLocation = builder.Location;
CodeMemberField field;
field = new CodeMemberField (builder.ControlType.FullName, builder.ID);
field.Attributes = ma;
-#if NET_2_0
field.Type.Options |= CodeTypeReferenceOptions.GlobalReference;
if (partialClass != null)
partialClass.Members.Add (AddLinePragma (field, builder));
else
-#endif
mainClass.Members.Add (AddLinePragma (field, builder));
}
return false;
if (!other.IsAssignableFrom (type)) {
-#if NET_2_0
ma |= MemberAttributes.New;
return false;
-#else
- string msg = String.Format ("The base class includes the field '{0}', but its " +
- "type '{1}' is not compatible with {2}",
- id, other, type);
- throw new ParseException (currentLocation, msg);
-#endif
}
return true;
* method, allow subclasses to insert control
* specific code. */
if (builder is RootBuilder) {
-#if NET_2_0
SetCustomAttributes (method);
-#endif
AddStatementsToInitMethod (method);
}
method.Statements.Add (initAsControl);
}
-#if NET_2_0
if (builder.ParentTemplateBuilder is System.Web.UI.WebControls.ContentBuilderInternal) {
PropertyInfo pi;
applyStyleSheetSkin.Parameters.Add (new CodePropertyReferenceExpression (thisRef, "Page"));
method.Statements.Add (applyStyleSheetSkin);
}
-#endif
// Process template children before anything else
ProcessTemplateChildren (builder);
string ctl_id = builder.GetAttribute ("id");
if (ctl_id != null && ctl_id.Length != 0)
CreateAssignStatementFromAttribute (builder, "id");
-
-#if NET_2_0
if (typeof (ContentPlaceHolder).IsAssignableFrom (type)) {
List <string> placeHolderIds = MasterPageContentPlaceHolders;
string cphID = builder.ID;
// this is the bit that causes the following stuff to end up in the else { }
builder.MethodStatements = condStatement.FalseStatements;
}
-#endif
}
mainClass.Members.Add (method);
if (templates != null && templates.Count > 0) {
foreach (TemplateBuilder tb in templates) {
CreateControlTree (tb, true, false);
-#if NET_2_0
if (tb.BindingDirection == BindingDirection.TwoWay) {
string extractMethod = CreateExtractValuesMethod (tb);
AddBindableTemplateInvocation (builder, tb.TagName, tb.Method.Name, extractMethod);
} else
-#endif
AddTemplateInvocation (builder, tb.TagName, tb.Method.Name);
}
}
}
-#if NET_2_0
void SetCustomAttribute (CodeMemberMethod method, UnknownAttributeDescriptor uad)
{
CodeAssignStatement assign = new CodeAssignStatement ();
foreach (UnknownAttributeDescriptor uad in attrs)
SetCustomAttribute (method, uad);
}
-#endif
protected virtual void AddStatementsToInitMethod (CodeMemberMethod method)
{
{
Match match = regex.Match (value);
if (!match.Success) {
-#if NET_2_0
if (isBind)
throw new HttpParseException ("Bind invocation wasn't formatted properly.");
-#endif
return null;
}
CodeExpression valueExpression = null;
value = value.Trim ();
-#if NET_2_0
bool need_if = false;
if (startsWithBindRegex.Match (value).Success) {
valueExpression = CreateEvalInvokeExpression (bindRegexInValue, value, true);
if (valueExpression != null)
need_if = true;
} else
-#endif
if (StrUtils.StartsWith (value, "Eval", true))
valueExpression = CreateEvalInvokeExpression (evalRegexInValue, value, false);
expr = new CodeCastExpression (type, valueExpression);
CodeAssignStatement assign = new CodeAssignStatement (field, expr);
-#if NET_2_0
if (need_if) {
CodeExpression page = new CodePropertyReferenceExpression (thisRef, "Page");
CodeExpression left = new CodeMethodInvokeExpression (page, "GetDataItem");
CodeBinaryOperatorExpression ce = new CodeBinaryOperatorExpression (left, CodeBinaryOperatorType.IdentityInequality, new CodePrimitiveExpression (null));
CodeConditionStatement ccs = new CodeConditionStatement (ce, assign);
method.Statements.Add (ccs);
- }
- else
-#endif
+ } else
method.Statements.Add (assign);
mainClass.Members.Add (method);
string dbMethodName = DataBoundProperty (builder, type, var_name, att);
AddEventAssign (method, builder, "DataBinding", typeof (EventHandler), dbMethodName);
return;
- }
-#if NET_2_0
- else if (isExpression && isWritable) {
+ } else if (isExpression && isWritable) {
AddExpressionAssign (method, builder, member, type, var_name, att);
return;
}
-#endif
CodeAssignStatement assign = new CodeAssignStatement ();
assign.Left = new CodePropertyReferenceExpression (ctrlVar, var_name);
return IsDirective (value, '#');
}
-#if NET_2_0
bool IsExpression (string value)
{
return IsDirective (value, '$');
}
}
}
-#endif
/*
static bool InvariantCompare (string a, string b)
int hyphen = id.IndexOf ('-');
bool isPropertyInfo = (member is PropertyInfo);
bool isDataBound = IsDataBound (attValue);
-#if NET_2_0
bool isExpression = !isDataBound && IsExpression (attValue);
-#else
- bool isExpression = false;
-#endif
Type type;
if (isPropertyInfo) {
type = ((PropertyInfo) member).PropertyType;
}
if (InvariantCompareNoCase (member.Name, id)) {
-#if NET_2_0
if (isDataBound)
- RegisterBindingInfo (builder, member.Name, ref attValue);
-
-#endif
+ RegisterBindingInfo (builder, member.Name, ref attValue);
+
if (!IsWritablePropertyOrField (member))
return false;
string val = attValue;
if (attValue == null && is_bool)
val = "true"; // Font-Bold <=> Font-Bold="true"
-#if NET_2_0
+
if (isDataBound)
RegisterBindingInfo (builder, prefix + member.Name + "." + subprop.Name, ref attValue);
-#endif
+
AddCodeForPropertyOrField (builder, subprop.PropertyType,
prefix + member.Name + "." + subprop.Name,
val, subprop, isDataBound, isExpression);
return true;
}
-#if NET_2_0
CodeExpression CompileExpression (MemberInfo member, Type type, string value, bool useSetAttribute)
{
// First let's find the correct expression builder
AssignPropertiesFromResources (builder, controlType, attvalue);
}
-#endif
void AddEventAssign (CodeMemberMethod method, ControlBuilder builder, string name, Type type, string value)
{
}
-#if NET_2_0
if (String.Compare (id, "meta:resourcekey", StringComparison.OrdinalIgnoreCase) == 0) {
AssignPropertiesFromResources (builder, attvalue);
return;
}
-#endif
int hyphen = id.IndexOf ('-');
string alt_id = id;
CodeMemberMethod method = builder.Method;
bool isDatabound = IsDataBound (attvalue);
-#if NET_2_0
bool isExpression = !isDatabound && IsExpression (attvalue);
-#endif
if (isDatabound) {
string value = attvalue.Substring (3, attvalue.Length - 5).Trim ();
CodeExpression valueExpression = null;
-#if NET_2_0
if (startsWithBindRegex.Match (value).Success)
valueExpression = CreateEvalInvokeExpression (bindRegexInValue, value, true);
else
-#endif
- if (StrUtils.StartsWith (value, "Eval", true))
- valueExpression = CreateEvalInvokeExpression (evalRegexInValue, value, false);
+ if (StrUtils.StartsWith (value, "Eval", true))
+ valueExpression = CreateEvalInvokeExpression (evalRegexInValue, value, false);
if (valueExpression == null && value != null && value.Trim () != String.Empty)
valueExpression = new CodeSnippetExpression (value);
expr.Parameters.Add (new CodePrimitiveExpression (id));
CodeExpression valueExpr = null;
-#if NET_2_0
if (isExpression)
valueExpr = CompileExpression (null, typeof (string), attvalue, true);
if (valueExpr == null)
-#endif
valueExpr = new CodePrimitiveExpression (attvalue);
expr.Parameters.Add (valueExpr);
continue;
// ID is assigned in BuildControltree
if (InvariantCompareNoCase (id, "id"))
- continue;
-
-#if NET_2_0
+ continue;
+
/* we skip SkinID here as it's assigned in BuildControlTree */
if (InvariantCompareNoCase (id, "skinid"))
continue;
if (InvariantCompareNoCase (id, "meta:resourcekey"))
continue; // ignore, this one's processed at the very end of
// the method
-#endif
CreateAssignStatementFromAttribute (builder, id);
}
}
AddEventAssign (method, builder, "DataBinding", typeof (EventHandler), dbMethodName);
method = CreateDBMethod (builder, dbMethodName, GetContainerType (builder), builder.ControlType);
-#if NET_2_0
builder.DataBindingMethod = method;
-#endif
+
CodeCastExpression cast;
CodeMethodReferenceExpression methodExpr;
CodeMethodInvokeExpression expr;
builder.Method.Statements.Add (AddLinePragma (assign, builder));
}
-#if NET_2_0
void AddBindableTemplateInvocation (ControlBuilder builder, string name, string methodName, string extractMethodName)
{
CodePropertyReferenceExpression prop = new CodePropertyReferenceExpression (ctrlVar, name);
method.Statements.Add (AddLinePragma (invoke, cbuilder));
}
-#endif
void AddCodeRender (ControlBuilder parent, CodeRenderBuilder cr)
{
expr.Parameters.Add (new CodeSnippetExpression (cr.Code));
parent.RenderMethod.Statements.Add (AddLinePragma (expr, cr));
}
-
-#if !NET_2_0
- static PropertyInfo GetContainerProperty (Type type, string[] propNames)
- {
- PropertyInfo prop;
-
- foreach (string name in propNames) {
- prop = type.GetProperty (name, noCaseFlags & ~BindingFlags.NonPublic);
- if (prop != null)
- return prop;
- }
-
- return null;
- }
-
- static string[] containerPropNames = {"Items", "Rows"};
-#endif
static Type GetContainerType (ControlBuilder builder)
{
- Type type = builder.BindingContainerType;
-
-#if NET_2_0
- return type;
-#else
-
- PropertyInfo prop = GetContainerProperty (type, containerPropNames);
- if (prop == null)
- return type;
-
- Type ptype = prop.PropertyType;
- if (!typeof (ICollection).IsAssignableFrom (ptype))
- return type;
-
- prop = ptype.GetProperty ("Item", noCaseFlags & ~BindingFlags.NonPublic);
- if (prop == null)
- return type;
-
- return prop.PropertyType;
-#endif
+ return builder.BindingContainerType;
}
CodeMemberMethod CreateDBMethod (ControlBuilder builder, string name, Type container, Type target)
// Add the DataBind handler
method = CreateDBMethod (builder, dbMethodName, GetContainerType (builder), typeof (DataBoundLiteralControl));
-#if NET_2_0
builder.DataBindingMethod = method;
-#endif
+
CodeVariableReferenceExpression targetExpr = new CodeVariableReferenceExpression ("target");
CodeMethodInvokeExpression invoke = new CodeMethodInvokeExpression ();
invoke.Method = new CodeMethodReferenceExpression (targetExpr, "SetDataBoundString");
if (!isTemplate && !inTemplate) {
CreateField (builder, true);
} else if (!isTemplate) {
- bool doCheck = false;
-
-#if NET_2_0
+ bool doCheck = false;
bool singleInstance = false;
ControlBuilder pb = builder.ParentBuilder;
TemplateBuilder tpb;
}
if (!singleInstance)
-#endif
builder.ID = builder.GetNextID (null);
-#if NET_2_0
else
doCheck = true;
-#endif
+
CreateField (builder, doCheck);
}
assign.Right = new CodePrimitiveExpression (asb.ToString ());
method.Statements.Add (AddLinePragma (assign, builder));
}
- }
-#if NET_2_0
- else if (b is ContentBuilderInternal) {
+ } else if (b is ContentBuilderInternal) {
ContentBuilderInternal cb = (ContentBuilderInternal) b;
CreateControlTree (cb, false, true);
AddContentTemplateInvocation (cb, builder.Method, cb.Method.Name);
continue;
}
-#endif
+
// Ignore TemplateBuilders - they are processed in InitMethod
else if (b is TemplateBuilder) {
} else if (b is CodeRenderBuilder) {
} else
throw new Exception ("???");
-#if NET_2_0
ControlBuilder bldr = b as ControlBuilder;
bldr.ProcessGeneratedCode (CompileUnit, BaseType, DerivedType, bldr.Method, bldr.DataBindingMethod);
-#endif
}
FlushText (builder, sb);
builder.MethodStatements.Add (invoke);
}
-#if NET_2_0
if (builder is RootBuilder)
if (!String.IsNullOrEmpty (parser.MetaResourceKey))
AssignPropertiesFromResources (builder, parser.BaseType, parser.MetaResourceKey);
if ((!isTemplate || builder is RootBuilder) && !String.IsNullOrEmpty (builder.GetAttribute ("meta:resourcekey")))
CreateAssignStatementFromAttribute (builder, "meta:resourcekey");
-#endif
if (!childrenAsProperties && typeof (Control).IsAssignableFrom (builder.ControlType))
builder.Method.Statements.Add (new CodeMethodReturnStatement (ctrlVar));
-#if NET_2_0
builder.ProcessGeneratedCode (CompileUnit, BaseType, DerivedType, builder.Method, builder.DataBindingMethod);
-#endif
}
-#if NET_2_0
protected override void AddStatementsToConstructor (CodeConstructor ctor)
{
if (masterPageContentPlaceHolders == null || masterPageContentPlaceHolders.Count == 0)
statements.Add (mcall);
}
}
-#endif
protected internal override void CreateMethods ()
{
CreateFrameworkInitializeMethod ();
}
-#if NET_2_0
protected override void InitializeType ()
{
List <string> registeredTagNames = parser.RegisteredTagNames;
CodeMethodInvokeExpression invoke = new CodeMethodInvokeExpression (baseRef, "FrameworkInitialize");
method.Statements.Add (invoke);
}
-#endif
void CallSetStringResourcePointer (CodeMemberMethod method)
{
method.Name = "FrameworkInitialize";
method.Attributes = MemberAttributes.Family | MemberAttributes.Override;
PrependStatementsToFrameworkInitialize (method);
-#if NET_2_0
CallBaseFrameworkInitialize (method);
-#endif
CallSetStringResourcePointer (method);
AppendStatementsToFrameworkInitialize (method);
mainClass.Members.Add (method);
CodeCastExpression cast = new CodeCastExpression (appType.FullName, propRef);
prop.GetStatements.Add (new CodeMethodReturnStatement (cast));
-#if NET_2_0
if (partialClass != null)
partialClass.Members.Add (prop);
else
-#endif
- mainClass.Members.Add (prop);
+ mainClass.Members.Add (prop);
}
-#if NET_2_0
void CreateContentPlaceHolderTemplateProperty (string backingField, string name)
{
CodeMemberProperty prop = new CodeMemberProperty ();
mainClass.Members.Add (prop);
}
-#endif
void CreateAutoHandlers ()
{
prop.GetStatements.Add (ret);
prop.SetStatements.Add (new CodeAssignStatement (fldRef, new CodePropertySetValueReferenceExpression ()));
-#if NET_2_0
CodeAttributeDeclaration attr = new CodeAttributeDeclaration ("System.Obsolete");
- prop.CustomAttributes.Add (attr);
-#endif
-
+ prop.CustomAttributes.Add (attr);
mainClass.Members.Add (prop);
// Add the __autoHandlers field
mainClass.Members.Add (prop);
}
-#if NET_2_0
protected virtual string HandleUrlProperty (string str, MemberInfo member)
{
return str;
}
-#endif
TypeConverter GetConverterForMember (MemberInfo member)
{
TypeConverterAttribute tca = null;
object[] attrs;
-#if NET_2_0
attrs = member.GetCustomAttributes (typeof (TypeConverterAttribute), true);
if (attrs.Length > 0)
tca = attrs [0] as TypeConverterAttribute;
-#else
- attrs = member.GetCustomAttributes (true);
-
- foreach (object attr in attrs) {
- tca = attr as TypeConverterAttribute;
-
- if (tca != null)
- break;
- }
-#endif
if (tca == TypeConverterAttribute.Default)
tca = null;
CodeExpression CreateNullableExpression (Type type, CodeExpression inst, bool nullable)
{
-#if NET_2_0
if (!nullable)
return inst;
- return new CodeObjectCreateExpression (
- type,
- new CodeExpression[] {inst}
- );
-#else
- return inst;
-#endif
+ return new CodeObjectCreateExpression (type, new CodeExpression[] {inst});
}
bool SafeCanConvertFrom (Type type, TypeConverter cvt)
bool wasNullable = false;
Type originalType = type;
-#if NET_2_0
+
if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) {
Type[] types = type.GetGenericArguments();
originalType = type;
type = types[0]; // we're interested only in the first type here
wasNullable = true;
}
-#endif
+
if (type == typeof (string)) {
if (preConverted)
return CreateNullableExpression (originalType,
new CodePrimitiveExpression ((string) convertedFromAttr),
wasNullable);
-
-#if NET_2_0
+
object[] urlAttr = member.GetCustomAttributes (typeof (UrlPropertyAttribute), true);
if (urlAttr.Length != 0)
str = HandleUrlProperty (str, member);
-#endif
+
return CreateNullableExpression (originalType, new CodePrimitiveExpression (str), wasNullable);
} else if (type == typeof (bool)) {
if (preConverted)
return CreateNullableExpression (originalType, new CodePrimitiveExpression (true), wasNullable);
else if (InvariantCompareNoCase (str, "false"))
return CreateNullableExpression (originalType, new CodePrimitiveExpression (false), wasNullable);
-#if NET_2_0
else if (wasNullable && InvariantCompareNoCase(str, "null"))
return new CodePrimitiveExpression (null);
-#endif
else
throw new ParseException (currentLocation,
"Value '" + str + "' is not a valid boolean.");
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
}
}
}
-#endif
+
// Authors:
// Chris Toshok (toshok@ximian.com)
//
-// (C) 2006 Novell, Inc. (http://www.novell.com)
+// (C) 2006-2009 Novell, Inc. (http://www.novell.com)
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.Collections;
using System.IO;
namespace System.Web.UI
{
- internal sealed class ThemeDirectoryCompiler
+ sealed class ThemeDirectoryCompiler
{
public static Type GetCompiledType (string theme, HttpContext context)
{
}
}
-#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System;
using System.CodeDom;
}
}
}
-#endif
+
AddOutputCacheAttribute ();
}
-#if NET_2_0
protected internal override void CreateMethods ()
{
base.CreateMethods ();
CreateProfileProperty ();
}
-#endif
void AddOutputCacheAttribute ()
{
protected override void AddStatementsToInitMethod (CodeMemberMethod method)
{
-#if NET_2_0
if (parser.MasterPageFile != null) {
CodeExpression prop;
prop = new CodePropertyReferenceExpression (new CodeArgumentReferenceExpression("__ctrl"), "MasterPageFile");
CodeExpression ct = new CodePrimitiveExpression (parser.MasterPageFile);
method.Statements.Add (AddLinePragma (new CodeAssignStatement (prop, ct), parser.DirectiveLocation));
}
-#endif
}
}
}
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.CodeDom;
}
}
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.CodeDom;
}
}
}
-#endif
+
throw new HttpException ("Configuration error. Language not supported: " +
lang, 500);
-#if !NET_2_0
- Compiler = provider.CreateCompiler ();
-#endif
-
CompilerParameters compilerParameters;
CompilerParameters = compilerParameters = CachingCompiler.GetOptions (parser.Assemblies);
compilerParameters.IncludeDebugInformation = parser.Debug;
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0 && WEBSERVICES_DEP
+#if WEBSERVICES_DEP
using System;
using System.CodeDom;
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
}
}
}
-#endif
+