Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / xsp / System / Web / Compilation / CompilerTypeWithParams.cs / 1 / CompilerTypeWithParams.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.Compilation {
using System;
using System.Security.Permissions;
using System.IO;
using System.Collections;
using System.Globalization;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Web.Hosting;
using System.Web.Util;
using System.Web.UI;
using System.Web.Configuration;
/*
* This class describes a CodeDom compiler, along with the parameters that it uses.
* The reason we need this class is that if two files both use the same language,
* but ask for different command line options (e.g. debug vs retail), we will not
* be able to compile them together. So effectively, we need to treat them as
* different languages.
*/
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public sealed class CompilerType {
private Type _codeDomProviderType;
public Type CodeDomProviderType { get { return _codeDomProviderType; } }
private CompilerParameters _compilParams;
public CompilerParameters CompilerParameters { get { return _compilParams; } }
internal CompilerType(Type codeDomProviderType, CompilerParameters compilParams) {
Debug.Assert(codeDomProviderType != null);
_codeDomProviderType = codeDomProviderType;
if (compilParams == null)
_compilParams = new CompilerParameters();
else
_compilParams = compilParams;
}
internal CompilerType Clone() {
// Clone the CompilerParameters to make sure the original is untouched
return new CompilerType(_codeDomProviderType, CloneCompilerParameters());
}
private CompilerParameters CloneCompilerParameters() {
CompilerParameters copy = new CompilerParameters();
copy.IncludeDebugInformation = _compilParams.IncludeDebugInformation;
copy.TreatWarningsAsErrors = _compilParams.TreatWarningsAsErrors;
copy.WarningLevel = _compilParams.WarningLevel;
copy.CompilerOptions = _compilParams.CompilerOptions;
return copy;
}
public override int GetHashCode() {
return _codeDomProviderType.GetHashCode();
}
public override bool Equals(Object o) {
CompilerType other = o as CompilerType;
if (o == null)
return false;
return _codeDomProviderType == other._codeDomProviderType &&
_compilParams.WarningLevel == other._compilParams.WarningLevel &&
_compilParams.IncludeDebugInformation == other._compilParams.IncludeDebugInformation &&
_compilParams.CompilerOptions == other._compilParams.CompilerOptions;
}
internal AssemblyBuilder CreateAssemblyBuilder(CompilationSection compConfig,
ICollection referencedAssemblies) {
return CreateAssemblyBuilder(compConfig, referencedAssemblies,
null /*generatedFilesDir*/, null /*outputAssemblyName*/);
}
internal AssemblyBuilder CreateAssemblyBuilder(CompilationSection compConfig,
ICollection referencedAssemblies, string generatedFilesDir, string outputAssemblyName) {
// Create a special AssemblyBuilder when we're only supposed to generate
// source files but not compile them (for ClientBuildManager.GetCodeDirectoryInformation)
if (generatedFilesDir != null) {
return new CbmCodeGeneratorBuildProviderHost(compConfig,
referencedAssemblies, this, generatedFilesDir, outputAssemblyName);
}
return new AssemblyBuilder(compConfig, referencedAssemblies, this, outputAssemblyName);
}
private static CompilerType GetDefaultCompilerTypeWithParams(
CompilationSection compConfig, VirtualPath configPath) {
// By default, use C# when no provider is asking for a specific language
return CompilationUtil.GetCSharpCompilerInfo(compConfig, configPath);
}
internal static AssemblyBuilder GetDefaultAssemblyBuilder(CompilationSection compConfig,
ICollection referencedAssemblies, VirtualPath configPath, string outputAssemblyName) {
return GetDefaultAssemblyBuilder(compConfig, referencedAssemblies,
configPath, null /*generatedFilesDir*/, outputAssemblyName);
}
internal static AssemblyBuilder GetDefaultAssemblyBuilder(CompilationSection compConfig,
ICollection referencedAssemblies, VirtualPath configPath,
string generatedFilesDir, string outputAssemblyName) {
CompilerType ctwp = GetDefaultCompilerTypeWithParams(compConfig, configPath);
return ctwp.CreateAssemblyBuilder(compConfig, referencedAssemblies,
generatedFilesDir, outputAssemblyName);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.Compilation {
using System;
using System.Security.Permissions;
using System.IO;
using System.Collections;
using System.Globalization;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Web.Hosting;
using System.Web.Util;
using System.Web.UI;
using System.Web.Configuration;
/*
* This class describes a CodeDom compiler, along with the parameters that it uses.
* The reason we need this class is that if two files both use the same language,
* but ask for different command line options (e.g. debug vs retail), we will not
* be able to compile them together. So effectively, we need to treat them as
* different languages.
*/
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public sealed class CompilerType {
private Type _codeDomProviderType;
public Type CodeDomProviderType { get { return _codeDomProviderType; } }
private CompilerParameters _compilParams;
public CompilerParameters CompilerParameters { get { return _compilParams; } }
internal CompilerType(Type codeDomProviderType, CompilerParameters compilParams) {
Debug.Assert(codeDomProviderType != null);
_codeDomProviderType = codeDomProviderType;
if (compilParams == null)
_compilParams = new CompilerParameters();
else
_compilParams = compilParams;
}
internal CompilerType Clone() {
// Clone the CompilerParameters to make sure the original is untouched
return new CompilerType(_codeDomProviderType, CloneCompilerParameters());
}
private CompilerParameters CloneCompilerParameters() {
CompilerParameters copy = new CompilerParameters();
copy.IncludeDebugInformation = _compilParams.IncludeDebugInformation;
copy.TreatWarningsAsErrors = _compilParams.TreatWarningsAsErrors;
copy.WarningLevel = _compilParams.WarningLevel;
copy.CompilerOptions = _compilParams.CompilerOptions;
return copy;
}
public override int GetHashCode() {
return _codeDomProviderType.GetHashCode();
}
public override bool Equals(Object o) {
CompilerType other = o as CompilerType;
if (o == null)
return false;
return _codeDomProviderType == other._codeDomProviderType &&
_compilParams.WarningLevel == other._compilParams.WarningLevel &&
_compilParams.IncludeDebugInformation == other._compilParams.IncludeDebugInformation &&
_compilParams.CompilerOptions == other._compilParams.CompilerOptions;
}
internal AssemblyBuilder CreateAssemblyBuilder(CompilationSection compConfig,
ICollection referencedAssemblies) {
return CreateAssemblyBuilder(compConfig, referencedAssemblies,
null /*generatedFilesDir*/, null /*outputAssemblyName*/);
}
internal AssemblyBuilder CreateAssemblyBuilder(CompilationSection compConfig,
ICollection referencedAssemblies, string generatedFilesDir, string outputAssemblyName) {
// Create a special AssemblyBuilder when we're only supposed to generate
// source files but not compile them (for ClientBuildManager.GetCodeDirectoryInformation)
if (generatedFilesDir != null) {
return new CbmCodeGeneratorBuildProviderHost(compConfig,
referencedAssemblies, this, generatedFilesDir, outputAssemblyName);
}
return new AssemblyBuilder(compConfig, referencedAssemblies, this, outputAssemblyName);
}
private static CompilerType GetDefaultCompilerTypeWithParams(
CompilationSection compConfig, VirtualPath configPath) {
// By default, use C# when no provider is asking for a specific language
return CompilationUtil.GetCSharpCompilerInfo(compConfig, configPath);
}
internal static AssemblyBuilder GetDefaultAssemblyBuilder(CompilationSection compConfig,
ICollection referencedAssemblies, VirtualPath configPath, string outputAssemblyName) {
return GetDefaultAssemblyBuilder(compConfig, referencedAssemblies,
configPath, null /*generatedFilesDir*/, outputAssemblyName);
}
internal static AssemblyBuilder GetDefaultAssemblyBuilder(CompilationSection compConfig,
ICollection referencedAssemblies, VirtualPath configPath,
string generatedFilesDir, string outputAssemblyName) {
CompilerType ctwp = GetDefaultCompilerTypeWithParams(compConfig, configPath);
return ctwp.CreateAssemblyBuilder(compConfig, referencedAssemblies,
generatedFilesDir, outputAssemblyName);
}
}
}
// 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
- Marshal.cs
- MemoryMappedViewStream.cs
- DateTimeHelper.cs
- HealthMonitoringSectionHelper.cs
- NameValuePair.cs
- Span.cs
- SpoolingTaskBase.cs
- MsmqHostedTransportManager.cs
- DetailsViewRowCollection.cs
- MarginsConverter.cs
- WebEventCodes.cs
- MenuItemStyle.cs
- FreezableOperations.cs
- ValidateNames.cs
- FileVersionInfo.cs
- CatalogPart.cs
- ObjectDataSourceMethodEventArgs.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- ValidationResult.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- ChangesetResponse.cs
- XamlInt32CollectionSerializer.cs
- TerminatorSinks.cs
- ContentPlaceHolder.cs
- EditorZone.cs
- IpcChannelHelper.cs
- ValidatingPropertiesEventArgs.cs
- XmlReflectionMember.cs
- TabPage.cs
- DBConnection.cs
- PerfCounters.cs
- _HelperAsyncResults.cs
- DbExpressionBuilder.cs
- CharacterBuffer.cs
- WinEventQueueItem.cs
- HttpApplicationFactory.cs
- PenCursorManager.cs
- HtmlControl.cs
- RoleManagerSection.cs
- SettingsPropertyWrongTypeException.cs
- DocumentPageViewAutomationPeer.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- indexingfiltermarshaler.cs
- CalendarDay.cs
- NativeMethods.cs
- ModifierKeysConverter.cs
- ErrorTableItemStyle.cs
- EnumerationRangeValidationUtil.cs
- CannotUnloadAppDomainException.cs
- Root.cs
- TdsParserStateObject.cs
- GroupDescription.cs
- OleDbError.cs
- SettingsSavedEventArgs.cs
- RequiredAttributeAttribute.cs
- ReaderWriterLockWrapper.cs
- SymLanguageVendor.cs
- ActivityDesigner.cs
- Tile.cs
- WindowsTitleBar.cs
- CurrentTimeZone.cs
- FunctionDescription.cs
- DataServiceHostFactory.cs
- TextViewSelectionProcessor.cs
- WebEvents.cs
- PartialTrustHelpers.cs
- OSFeature.cs
- EventWaitHandle.cs
- XslNumber.cs
- ScrollBarRenderer.cs
- HwndSourceParameters.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- SqlGenericUtil.cs
- ThreadAttributes.cs
- OutputCacheModule.cs
- TargetException.cs
- XmlSchemaAnnotation.cs
- Rectangle.cs
- DataIdProcessor.cs
- UInt64Storage.cs
- ellipse.cs
- ZipFileInfo.cs
- StateMachineWorkflowDesigner.cs
- BaseTreeIterator.cs
- PlaceHolder.cs
- XmlCharType.cs
- CollectionChangeEventArgs.cs
- CultureInfoConverter.cs
- Int32RectConverter.cs
- DataGridPageChangedEventArgs.cs
- GlyphRunDrawing.cs
- FormParameter.cs
- ZipIORawDataFileBlock.cs
- ExpressionPrefixAttribute.cs
- ValidatorCollection.cs
- SQLBinaryStorage.cs
- OrderByLifter.cs
- ErrorTableItemStyle.cs
- XPathNode.cs
- CodeChecksumPragma.cs