Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / CodeDOM / Compiler / CompilerInfo.cs / 1305376 / CompilerInfo.cs
//------------------------------------------------------------------------------ //// // //----------------------------------------------------------------------------- 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[....] // Copyright (c) Microsoft Corporation. All rights reserved. //_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 CodeDomProvider CreateProvider(IDictionary providerOptions) { if (providerOptions == null) throw new ArgumentNullException("providerOptions"); ConstructorInfo constructor = CodeDomProviderType.GetConstructor(new Type[] { typeof(IDictionary ) }); if (constructor != null) { return (CodeDomProvider)constructor.Invoke(new object[] { providerOptions }); } else throw new InvalidOperationException(SR.GetString(SR.Provider_does_not_support_options, CodeDomProviderType.ToString())); } 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. //------------------------------------------------------------------------------ // // // //----------------------------------------------------------------------------- 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[....] // Copyright (c) Microsoft Corporation. All rights reserved. //_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 CodeDomProvider CreateProvider(IDictionary providerOptions) { if (providerOptions == null) throw new ArgumentNullException("providerOptions"); ConstructorInfo constructor = CodeDomProviderType.GetConstructor(new Type[] { typeof(IDictionary ) }); if (constructor != null) { return (CodeDomProvider)constructor.Invoke(new object[] { providerOptions }); } else throw new InvalidOperationException(SR.GetString(SR.Provider_does_not_support_options, CodeDomProviderType.ToString())); } 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
- ArrayWithOffset.cs
- GridViewColumnHeaderAutomationPeer.cs
- QueryCacheManager.cs
- CodeIdentifiers.cs
- EndpointAddressElementBase.cs
- XmlSchemaGroupRef.cs
- ChildDocumentBlock.cs
- xsdvalidator.cs
- MessageSecurityOverHttpElement.cs
- SwitchElementsCollection.cs
- DeviceContext2.cs
- SpAudioStreamWrapper.cs
- GenericIdentity.cs
- Decorator.cs
- BaseParser.cs
- AssemblyInfo.cs
- BitmapPalettes.cs
- TemplateInstanceAttribute.cs
- DataContractJsonSerializer.cs
- SubqueryRules.cs
- ExpandSegment.cs
- ObjectComplexPropertyMapping.cs
- StackSpiller.cs
- httpapplicationstate.cs
- QueryBranchOp.cs
- FileSecurity.cs
- Property.cs
- ContextMenuAutomationPeer.cs
- TCPListener.cs
- SqlParameterCollection.cs
- ExpressionEditorAttribute.cs
- StylusPointPropertyInfo.cs
- SqlBuilder.cs
- ColorTransformHelper.cs
- DocumentOrderComparer.cs
- KeyGestureConverter.cs
- FrugalList.cs
- ToolStripSplitButton.cs
- SingleAnimationUsingKeyFrames.cs
- CodeNamespaceImportCollection.cs
- DiscreteKeyFrames.cs
- MachineKeyConverter.cs
- MetadataException.cs
- CollectionChangeEventArgs.cs
- fixedPageContentExtractor.cs
- Double.cs
- GlyphShapingProperties.cs
- HtmlToClrEventProxy.cs
- SchemaImporterExtension.cs
- EntityRecordInfo.cs
- BulletDecorator.cs
- ConfigXmlSignificantWhitespace.cs
- _ScatterGatherBuffers.cs
- Transform3DCollection.cs
- PageCodeDomTreeGenerator.cs
- XpsS0ValidatingLoader.cs
- XmlAttributeProperties.cs
- CriticalFinalizerObject.cs
- Authorization.cs
- FunctionNode.cs
- TextTreeFixupNode.cs
- ImportCatalogPart.cs
- SqlServer2KCompatibilityCheck.cs
- RuntimeHelpers.cs
- _NestedMultipleAsyncResult.cs
- HMACSHA512.cs
- InputBinding.cs
- xmlsaver.cs
- VectorKeyFrameCollection.cs
- HttpCachePolicy.cs
- BamlStream.cs
- Transform3DGroup.cs
- MetadataCache.cs
- MailDefinition.cs
- SHA384CryptoServiceProvider.cs
- FontWeight.cs
- WebPartChrome.cs
- ContextMenuService.cs
- DelayedRegex.cs
- COM2FontConverter.cs
- NameNode.cs
- Crc32Helper.cs
- NumberSubstitution.cs
- XmlSiteMapProvider.cs
- filewebrequest.cs
- GradientBrush.cs
- GeometryGroup.cs
- TabItemAutomationPeer.cs
- AliasedExpr.cs
- EncoderParameter.cs
- TextClipboardData.cs
- PerformanceCounterCategory.cs
- ListSourceHelper.cs
- TextWriterTraceListener.cs
- CompilerInfo.cs
- FixedSOMLineRanges.cs
- VarRefManager.cs
- RijndaelManagedTransform.cs
- OptimisticConcurrencyException.cs
- NamedPermissionSet.cs