Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / BaseParser.cs / 1471291 / BaseParser.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
* Implements the ASP.NET template parser
*
* Copyright (c) 1998 Microsoft Corporation
*/
/*********************************
Class hierarchy
BaseParser
DependencyParser
TemplateControlDependencyParser
PageDependencyParser
UserControlDependencyParser
MasterPageDependencyParser
TemplateParser
BaseTemplateParser
TemplateControlParser
PageParser
UserControlParser
MasterPageParser
PageThemeParser
ApplicationFileParser
**********************************/
namespace System.Web.UI {
using System;
using System.Collections;
using System.Reflection;
using System.Web.Compilation;
using System.Web.Hosting;
using System.Web.Util;
using System.Text.RegularExpressions;
using System.Web.RegularExpressions;
using System.Security.Permissions;
// Internal interface for Parser that have exteranl assembly dependency.
internal interface IAssemblyDependencyParser {
ICollection AssemblyDependencies { get; }
}
///
/// [To be supplied.]
///
public class BaseParser {
// The directory used for relative path calculations
private VirtualPath _baseVirtualDir;
internal VirtualPath BaseVirtualDir {
get { return _baseVirtualDir; }
}
// The virtual path to the file currently being processed
private VirtualPath _currentVirtualPath;
internal VirtualPath CurrentVirtualPath {
get { return _currentVirtualPath; }
set {
_currentVirtualPath = value;
// Can happen in the designer
if (value == null) return;
_baseVirtualDir = value.Parent;
}
}
internal string CurrentVirtualPathString {
get { return System.Web.VirtualPath.GetVirtualPathString(CurrentVirtualPath); }
}
private Regex _tagRegex;
// The 3.5 regex is used only when targeting 2.0/3.5 for backward compatibility (Dev10 bug 830783).
private readonly static Regex tagRegex35 = new TagRegex35();
// The 4.0 regex is used for web sites targeting 4.0 and above.
private readonly static Regex tagRegex40 = new TagRegex();
internal readonly static Regex directiveRegex = new DirectiveRegex();
internal readonly static Regex endtagRegex = new EndTagRegex();
internal readonly static Regex aspCodeRegex = new AspCodeRegex();
internal readonly static Regex aspExprRegex = new AspExprRegex();
internal readonly static Regex aspEncodedExprRegex = new AspEncodedExprRegex();
internal readonly static Regex databindExprRegex = new DatabindExprRegex();
internal readonly static Regex commentRegex = new CommentRegex();
internal readonly static Regex includeRegex = new IncludeRegex();
internal readonly static Regex textRegex = new TextRegex();
// Regexes used in DetectSpecialServerTagError
internal readonly static Regex gtRegex = new GTRegex();
internal readonly static Regex ltRegex = new LTRegex();
internal readonly static Regex serverTagsRegex = new ServerTagsRegex();
internal readonly static Regex runatServerRegex = new RunatServerRegex();
/*
* Turns relative virtual path into absolute ones
*/
internal VirtualPath ResolveVirtualPath(VirtualPath virtualPath) {
return VirtualPathProvider.CombineVirtualPathsInternal(CurrentVirtualPath, virtualPath);
}
private bool IsVersion40OrAbove() {
if (HostingEnvironment.IsHosted) {
// If we are running in a hosted environment, then we can simply check the target version.
return MultiTargetingUtil.IsTargetFramework40OrAbove;
}
else {
// Otherwise, we are in the designer, and thus should check using the type description provider.
// The new type TagRegex35 only exists when targeting 4.0 and above.
return TargetFrameworkUtil.IsSupportedType(typeof(TagRegex35));
}
}
internal Regex TagRegex {
get {
if (_tagRegex == null) {
_tagRegex = IsVersion40OrAbove() ? tagRegex40 : tagRegex35;
}
return _tagRegex;
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
* Implements the ASP.NET template parser
*
* Copyright (c) 1998 Microsoft Corporation
*/
/*********************************
Class hierarchy
BaseParser
DependencyParser
TemplateControlDependencyParser
PageDependencyParser
UserControlDependencyParser
MasterPageDependencyParser
TemplateParser
BaseTemplateParser
TemplateControlParser
PageParser
UserControlParser
MasterPageParser
PageThemeParser
ApplicationFileParser
**********************************/
namespace System.Web.UI {
using System;
using System.Collections;
using System.Reflection;
using System.Web.Compilation;
using System.Web.Hosting;
using System.Web.Util;
using System.Text.RegularExpressions;
using System.Web.RegularExpressions;
using System.Security.Permissions;
// Internal interface for Parser that have exteranl assembly dependency.
internal interface IAssemblyDependencyParser {
ICollection AssemblyDependencies { get; }
}
///
/// [To be supplied.]
///
public class BaseParser {
// The directory used for relative path calculations
private VirtualPath _baseVirtualDir;
internal VirtualPath BaseVirtualDir {
get { return _baseVirtualDir; }
}
// The virtual path to the file currently being processed
private VirtualPath _currentVirtualPath;
internal VirtualPath CurrentVirtualPath {
get { return _currentVirtualPath; }
set {
_currentVirtualPath = value;
// Can happen in the designer
if (value == null) return;
_baseVirtualDir = value.Parent;
}
}
internal string CurrentVirtualPathString {
get { return System.Web.VirtualPath.GetVirtualPathString(CurrentVirtualPath); }
}
private Regex _tagRegex;
// The 3.5 regex is used only when targeting 2.0/3.5 for backward compatibility (Dev10 bug 830783).
private readonly static Regex tagRegex35 = new TagRegex35();
// The 4.0 regex is used for web sites targeting 4.0 and above.
private readonly static Regex tagRegex40 = new TagRegex();
internal readonly static Regex directiveRegex = new DirectiveRegex();
internal readonly static Regex endtagRegex = new EndTagRegex();
internal readonly static Regex aspCodeRegex = new AspCodeRegex();
internal readonly static Regex aspExprRegex = new AspExprRegex();
internal readonly static Regex aspEncodedExprRegex = new AspEncodedExprRegex();
internal readonly static Regex databindExprRegex = new DatabindExprRegex();
internal readonly static Regex commentRegex = new CommentRegex();
internal readonly static Regex includeRegex = new IncludeRegex();
internal readonly static Regex textRegex = new TextRegex();
// Regexes used in DetectSpecialServerTagError
internal readonly static Regex gtRegex = new GTRegex();
internal readonly static Regex ltRegex = new LTRegex();
internal readonly static Regex serverTagsRegex = new ServerTagsRegex();
internal readonly static Regex runatServerRegex = new RunatServerRegex();
/*
* Turns relative virtual path into absolute ones
*/
internal VirtualPath ResolveVirtualPath(VirtualPath virtualPath) {
return VirtualPathProvider.CombineVirtualPathsInternal(CurrentVirtualPath, virtualPath);
}
private bool IsVersion40OrAbove() {
if (HostingEnvironment.IsHosted) {
// If we are running in a hosted environment, then we can simply check the target version.
return MultiTargetingUtil.IsTargetFramework40OrAbove;
}
else {
// Otherwise, we are in the designer, and thus should check using the type description provider.
// The new type TagRegex35 only exists when targeting 4.0 and above.
return TargetFrameworkUtil.IsSupportedType(typeof(TagRegex35));
}
}
internal Regex TagRegex {
get {
if (_tagRegex == null) {
_tagRegex = IsVersion40OrAbove() ? tagRegex40 : tagRegex35;
}
return _tagRegex;
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- NamespaceList.cs
- CodeExpressionCollection.cs
- EntitySqlQueryCacheEntry.cs
- _TLSstream.cs
- FileVersionInfo.cs
- XpsDocument.cs
- DoubleCollection.cs
- SqlDataSourceQueryConverter.cs
- ScriptReferenceBase.cs
- TraceLevelHelper.cs
- DbDataReader.cs
- X509Utils.cs
- TcpPortSharing.cs
- Rotation3D.cs
- EncoderNLS.cs
- EdmComplexTypeAttribute.cs
- TdsRecordBufferSetter.cs
- PenLineJoinValidation.cs
- ComNativeDescriptor.cs
- EndpointNotFoundException.cs
- PersonalizationAdministration.cs
- ColumnHeaderConverter.cs
- Rule.cs
- DataSourceControl.cs
- DefaultSection.cs
- RightsManagementResourceHelper.cs
- ApplicationServiceHelper.cs
- AxDesigner.cs
- Int64Storage.cs
- NextPreviousPagerField.cs
- RegexCaptureCollection.cs
- SQLDouble.cs
- XslAstAnalyzer.cs
- XsltQilFactory.cs
- XmlMtomReader.cs
- DivideByZeroException.cs
- HebrewCalendar.cs
- HttpAsyncResult.cs
- KoreanLunisolarCalendar.cs
- PiiTraceSource.cs
- CollectionDataContractAttribute.cs
- TextElementEditingBehaviorAttribute.cs
- SoapWriter.cs
- ClientScriptManagerWrapper.cs
- SchemaImporterExtension.cs
- UserPreferenceChangedEventArgs.cs
- CompilerLocalReference.cs
- StreamAsIStream.cs
- BroadcastEventHelper.cs
- ToolStripDropDownItem.cs
- XmlArrayItemAttribute.cs
- HttpResponseHeader.cs
- ReadOnlyHierarchicalDataSourceView.cs
- CheckBoxDesigner.cs
- SafeNativeMethodsMilCoreApi.cs
- NestPullup.cs
- SqlServices.cs
- CategoryValueConverter.cs
- SystemNetworkInterface.cs
- KeyInterop.cs
- ImageDrawing.cs
- FileSystemInfo.cs
- AttachmentService.cs
- SrgsRuleRef.cs
- LicFileLicenseProvider.cs
- CircleHotSpot.cs
- HierarchicalDataSourceControl.cs
- SafeRightsManagementHandle.cs
- InputLanguageProfileNotifySink.cs
- SmuggledIUnknown.cs
- SamlAuthenticationStatement.cs
- HScrollProperties.cs
- NCryptNative.cs
- DurableErrorHandler.cs
- InputLanguage.cs
- ContentElement.cs
- ProfileManager.cs
- CalendarModeChangedEventArgs.cs
- ObjectToIdCache.cs
- MachineKeySection.cs
- XmlSchemaSet.cs
- XmlDeclaration.cs
- PageCatalogPartDesigner.cs
- DataSourceCacheDurationConverter.cs
- IgnoreDataMemberAttribute.cs
- HistoryEventArgs.cs
- ObjectDataSourceFilteringEventArgs.cs
- TextEditorThreadLocalStore.cs
- SQLBinary.cs
- ScrollBar.cs
- RequestReplyCorrelator.cs
- XPathArrayIterator.cs
- DefaultShape.cs
- CharAnimationBase.cs
- FormViewUpdateEventArgs.cs
- BitmapMetadataEnumerator.cs
- ZipIOLocalFileDataDescriptor.cs
- CodeArrayCreateExpression.cs
- PipelineComponent.cs
- DataGridPagerStyle.cs