Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CompMod / System / CodeDOM / Compiler / CompilerInfo.cs / 1 / CompilerInfo.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.CodeDom.Compiler {
using System;
using System.Reflection;
using System.Security.Permissions;
using System.CodeDom.Compiler;
using System.Configuration;
using System.Collections.Generic;
using System.Diagnostics;
[PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")]
public sealed class CompilerInfo {
internal String _codeDomProviderTypeName; // This can never by null
internal CompilerParameters _compilerParams; // This can never by null
internal String[] _compilerLanguages; // This can never by null
internal String[] _compilerExtensions; // This can never by null
internal String configFileName;
internal IDictionary _providerOptions; // This can never be null
internal int configFileLineNumber;
internal Boolean _mapped;
private Type type;
private CompilerInfo() {} // Not createable
public String[] GetLanguages() {
return CloneCompilerLanguages();
}
public String[] GetExtensions() {
return CloneCompilerExtensions();
}
public Type CodeDomProviderType {
get {
if( type == null) {
lock(this) {
if( type == null) {
type = Type.GetType(_codeDomProviderTypeName);
if (type == null) {
if( configFileName == null) {
throw new ConfigurationErrorsException(SR.GetString(SR.Unable_To_Locate_Type,
_codeDomProviderTypeName, string.Empty, 0));
}
else {
throw new ConfigurationErrorsException(SR.GetString(SR.Unable_To_Locate_Type,
_codeDomProviderTypeName), configFileName, configFileLineNumber);
}
}
}
}
}
return type;
}
}
public bool IsCodeDomProviderTypeValid {
get {
Type type = Type.GetType(_codeDomProviderTypeName);
return (type != null);
}
}
public CodeDomProvider CreateProvider() {
// if the provider defines an IDictionary ctor and
// provider options have been provided then call that and give it the
// provider options dictionary. Otherwise call the normal one.
Debug.Assert(_providerOptions != null, "Created CompilerInfo w/ null _providerOptions");
if (_providerOptions.Count > 0) {
ConstructorInfo ci = CodeDomProviderType.GetConstructor(new Type[] { typeof(IDictionary) });
if (ci != null) {
return (CodeDomProvider)ci.Invoke(new object[] { _providerOptions });
}
}
return (CodeDomProvider)Activator.CreateInstance(CodeDomProviderType);
}
public CompilerParameters CreateDefaultCompilerParameters() {
return CloneCompilerParameters();
}
internal CompilerInfo(CompilerParameters compilerParams, String codeDomProviderTypeName, String [] compilerLanguages, String [] compilerExtensions) {
_compilerLanguages = compilerLanguages;
_compilerExtensions = compilerExtensions;
_codeDomProviderTypeName = codeDomProviderTypeName;
if (compilerParams == null)
compilerParams = new CompilerParameters();
_compilerParams = compilerParams;
}
internal CompilerInfo(CompilerParameters compilerParams, String codeDomProviderTypeName) {
_codeDomProviderTypeName = codeDomProviderTypeName;
if (compilerParams == null)
compilerParams = new CompilerParameters();
_compilerParams = compilerParams;
}
public override int GetHashCode() {
return _codeDomProviderTypeName.GetHashCode();
}
public override bool Equals(Object o) {
CompilerInfo other = o as CompilerInfo;
if (o == null)
return false;
return CodeDomProviderType == other.CodeDomProviderType &&
CompilerParams.WarningLevel == other.CompilerParams.WarningLevel &&
CompilerParams.IncludeDebugInformation == other.CompilerParams.IncludeDebugInformation &&
CompilerParams.CompilerOptions == other.CompilerParams.CompilerOptions;
}
private CompilerParameters CloneCompilerParameters() {
CompilerParameters copy = new CompilerParameters();
copy.IncludeDebugInformation = _compilerParams.IncludeDebugInformation;
copy.TreatWarningsAsErrors = _compilerParams.TreatWarningsAsErrors;
copy.WarningLevel = _compilerParams.WarningLevel;
copy.CompilerOptions = _compilerParams.CompilerOptions;
return copy;
}
private String[] CloneCompilerLanguages() {
String[] compilerLanguages = new String[_compilerLanguages.Length];
Array.Copy(_compilerLanguages, compilerLanguages, _compilerLanguages.Length);
return compilerLanguages;
}
private String[] CloneCompilerExtensions() {
String[] compilerExtensions = new String[_compilerExtensions.Length];
Array.Copy(_compilerExtensions, compilerExtensions, _compilerExtensions.Length);
return compilerExtensions;
}
internal CompilerParameters CompilerParams {
get {
return _compilerParams;
}
}
// @
internal IDictionary ProviderOptions {
get {
return _providerOptions;
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.CodeDom.Compiler {
using System;
using System.Reflection;
using System.Security.Permissions;
using System.CodeDom.Compiler;
using System.Configuration;
using System.Collections.Generic;
using System.Diagnostics;
[PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")]
public sealed class CompilerInfo {
internal String _codeDomProviderTypeName; // This can never by null
internal CompilerParameters _compilerParams; // This can never by null
internal String[] _compilerLanguages; // This can never by null
internal String[] _compilerExtensions; // This can never by null
internal String configFileName;
internal IDictionary _providerOptions; // This can never be null
internal int configFileLineNumber;
internal Boolean _mapped;
private Type type;
private CompilerInfo() {} // Not createable
public String[] GetLanguages() {
return CloneCompilerLanguages();
}
public String[] GetExtensions() {
return CloneCompilerExtensions();
}
public Type CodeDomProviderType {
get {
if( type == null) {
lock(this) {
if( type == null) {
type = Type.GetType(_codeDomProviderTypeName);
if (type == null) {
if( configFileName == null) {
throw new ConfigurationErrorsException(SR.GetString(SR.Unable_To_Locate_Type,
_codeDomProviderTypeName, string.Empty, 0));
}
else {
throw new ConfigurationErrorsException(SR.GetString(SR.Unable_To_Locate_Type,
_codeDomProviderTypeName), configFileName, configFileLineNumber);
}
}
}
}
}
return type;
}
}
public bool IsCodeDomProviderTypeValid {
get {
Type type = Type.GetType(_codeDomProviderTypeName);
return (type != null);
}
}
public CodeDomProvider CreateProvider() {
// if the provider defines an IDictionary ctor and
// provider options have been provided then call that and give it the
// provider options dictionary. Otherwise call the normal one.
Debug.Assert(_providerOptions != null, "Created CompilerInfo w/ null _providerOptions");
if (_providerOptions.Count > 0) {
ConstructorInfo ci = CodeDomProviderType.GetConstructor(new Type[] { typeof(IDictionary) });
if (ci != null) {
return (CodeDomProvider)ci.Invoke(new object[] { _providerOptions });
}
}
return (CodeDomProvider)Activator.CreateInstance(CodeDomProviderType);
}
public CompilerParameters CreateDefaultCompilerParameters() {
return CloneCompilerParameters();
}
internal CompilerInfo(CompilerParameters compilerParams, String codeDomProviderTypeName, String [] compilerLanguages, String [] compilerExtensions) {
_compilerLanguages = compilerLanguages;
_compilerExtensions = compilerExtensions;
_codeDomProviderTypeName = codeDomProviderTypeName;
if (compilerParams == null)
compilerParams = new CompilerParameters();
_compilerParams = compilerParams;
}
internal CompilerInfo(CompilerParameters compilerParams, String codeDomProviderTypeName) {
_codeDomProviderTypeName = codeDomProviderTypeName;
if (compilerParams == null)
compilerParams = new CompilerParameters();
_compilerParams = compilerParams;
}
public override int GetHashCode() {
return _codeDomProviderTypeName.GetHashCode();
}
public override bool Equals(Object o) {
CompilerInfo other = o as CompilerInfo;
if (o == null)
return false;
return CodeDomProviderType == other.CodeDomProviderType &&
CompilerParams.WarningLevel == other.CompilerParams.WarningLevel &&
CompilerParams.IncludeDebugInformation == other.CompilerParams.IncludeDebugInformation &&
CompilerParams.CompilerOptions == other.CompilerParams.CompilerOptions;
}
private CompilerParameters CloneCompilerParameters() {
CompilerParameters copy = new CompilerParameters();
copy.IncludeDebugInformation = _compilerParams.IncludeDebugInformation;
copy.TreatWarningsAsErrors = _compilerParams.TreatWarningsAsErrors;
copy.WarningLevel = _compilerParams.WarningLevel;
copy.CompilerOptions = _compilerParams.CompilerOptions;
return copy;
}
private String[] CloneCompilerLanguages() {
String[] compilerLanguages = new String[_compilerLanguages.Length];
Array.Copy(_compilerLanguages, compilerLanguages, _compilerLanguages.Length);
return compilerLanguages;
}
private String[] CloneCompilerExtensions() {
String[] compilerExtensions = new String[_compilerExtensions.Length];
Array.Copy(_compilerExtensions, compilerExtensions, _compilerExtensions.Length);
return compilerExtensions;
}
internal CompilerParameters CompilerParams {
get {
return _compilerParams;
}
}
// @
internal IDictionary ProviderOptions {
get {
return _providerOptions;
}
}
}
}
// 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
- FrugalMap.cs
- CodeAttachEventStatement.cs
- FrugalList.cs
- RequestTimeoutManager.cs
- BitmapEffectGeneralTransform.cs
- ModuleBuilder.cs
- XmlWrappingReader.cs
- PropertyGroupDescription.cs
- Timer.cs
- LoadedOrUnloadedOperation.cs
- SrgsElementFactoryCompiler.cs
- DoubleIndependentAnimationStorage.cs
- CompositeFontInfo.cs
- RemoteHelper.cs
- RoutedEvent.cs
- JsonDeserializer.cs
- ArraySubsetEnumerator.cs
- SafePointer.cs
- PropertyStore.cs
- Utils.cs
- CompiledQuery.cs
- AnnotationObservableCollection.cs
- CFStream.cs
- Effect.cs
- SafeHandles.cs
- ParserExtension.cs
- BasicHttpSecurity.cs
- DecimalAverageAggregationOperator.cs
- ErrorProvider.cs
- TraceLevelStore.cs
- DataAdapter.cs
- IteratorFilter.cs
- ResolveNameEventArgs.cs
- CustomError.cs
- SqlVisitor.cs
- XmlSchemaElement.cs
- FormatVersion.cs
- WaitHandleCannotBeOpenedException.cs
- WinFormsSpinner.cs
- DiagnosticTraceSource.cs
- XmlObjectSerializerReadContext.cs
- PhoneCallDesigner.cs
- QuotedPairReader.cs
- Baml2006ReaderSettings.cs
- __Error.cs
- ProcessProtocolHandler.cs
- LocatorManager.cs
- MailBnfHelper.cs
- SolidBrush.cs
- OlePropertyStructs.cs
- MasterPageCodeDomTreeGenerator.cs
- TableCellCollection.cs
- AnnotationResource.cs
- HttpCachePolicy.cs
- BookmarkManager.cs
- FormViewRow.cs
- Transform3D.cs
- ControlEvent.cs
- CatalogZoneBase.cs
- ObjectToIdCache.cs
- ListenDesigner.cs
- View.cs
- SymmetricAlgorithm.cs
- RelatedPropertyManager.cs
- ExcCanonicalXml.cs
- HtmlEncodedRawTextWriter.cs
- Metafile.cs
- TreeWalker.cs
- DataGridCommandEventArgs.cs
- MissingMemberException.cs
- UserThread.cs
- QueryParameter.cs
- InfocardExtendedInformationCollection.cs
- MulticastDelegate.cs
- ArgIterator.cs
- DataSetMappper.cs
- UnsafeNativeMethods.cs
- FormatPage.cs
- ObjectQueryProvider.cs
- ToolStripScrollButton.cs
- RequiredFieldValidator.cs
- InstanceOwner.cs
- XamlParser.cs
- ExpressionList.cs
- PersistenceProviderFactory.cs
- PhonemeConverter.cs
- DesigntimeLicenseContext.cs
- PropertyCondition.cs
- CurrencyWrapper.cs
- DataSourceView.cs
- XPathAxisIterator.cs
- Form.cs
- DbSetClause.cs
- FrameworkTextComposition.cs
- AttributeCollection.cs
- ListViewDeleteEventArgs.cs
- clipboard.cs
- RC2.cs
- XamlVector3DCollectionSerializer.cs
- CommonProperties.cs