Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / CompMod / System / CodeDOM / Compiler / CompilerInfo.cs / 2 / 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; } } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CommandTreeTypeHelper.cs
- TouchesOverProperty.cs
- ListBoxItemAutomationPeer.cs
- WebPageTraceListener.cs
- FontStretch.cs
- ImageFormatConverter.cs
- MsmqHostedTransportManager.cs
- _ProxyChain.cs
- CompiledELinqQueryState.cs
- FreezableCollection.cs
- XmlUtilWriter.cs
- UriScheme.cs
- ArrayElementGridEntry.cs
- SmtpLoginAuthenticationModule.cs
- DataListCommandEventArgs.cs
- BufferedStream.cs
- ISAPIApplicationHost.cs
- Stream.cs
- DataContractSet.cs
- SqlDataReader.cs
- Validator.cs
- ExeContext.cs
- ProfileInfo.cs
- MatchNoneMessageFilter.cs
- GrabHandleGlyph.cs
- Parameter.cs
- VScrollBar.cs
- _ScatterGatherBuffers.cs
- NotifyCollectionChangedEventArgs.cs
- FieldNameLookup.cs
- TextParagraphProperties.cs
- DataGridColumnCollection.cs
- NamedPipeTransportManager.cs
- ViewStateModeByIdAttribute.cs
- CanExecuteRoutedEventArgs.cs
- GB18030Encoding.cs
- PointHitTestResult.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- GridViewColumnCollection.cs
- Publisher.cs
- Rotation3DKeyFrameCollection.cs
- GenerateTemporaryTargetAssembly.cs
- QilInvokeLateBound.cs
- CheckBoxStandardAdapter.cs
- _NestedSingleAsyncResult.cs
- SingleAnimationBase.cs
- WmlValidationSummaryAdapter.cs
- ComponentDispatcherThread.cs
- DirectoryNotFoundException.cs
- LabelLiteral.cs
- MergeFailedEvent.cs
- UIAgentMonitorHandle.cs
- PermissionRequestEvidence.cs
- ListParagraph.cs
- _ConnectOverlappedAsyncResult.cs
- RepeatButton.cs
- HttpStreamXmlDictionaryReader.cs
- DependencyObjectType.cs
- FixedTextBuilder.cs
- ContainerVisual.cs
- ModulesEntry.cs
- HttpHandlersSection.cs
- ColorTranslator.cs
- EntityDataSourceDesigner.cs
- HTMLTagNameToTypeMapper.cs
- OleDbCommand.cs
- DataServiceRequest.cs
- EntityTypeBase.cs
- GreenMethods.cs
- LogExtent.cs
- WebControlsSection.cs
- CollectionDataContract.cs
- SecurityState.cs
- AnchoredBlock.cs
- SpotLight.cs
- Shape.cs
- TaskHelper.cs
- BindingCompleteEventArgs.cs
- WebBrowserNavigatingEventHandler.cs
- StructuredTypeInfo.cs
- WinEventTracker.cs
- LocalizeDesigner.cs
- BitmapPalette.cs
- WindowShowOrOpenTracker.cs
- MetaTable.cs
- CursorInteropHelper.cs
- SerialReceived.cs
- SecureEnvironment.cs
- TextTreeDeleteContentUndoUnit.cs
- ColumnMapTranslator.cs
- EventSetterHandlerConverter.cs
- Dispatcher.cs
- ResourceAttributes.cs
- ConstraintConverter.cs
- EditingScope.cs
- DurableErrorHandler.cs
- PenLineJoinValidation.cs
- BoolExpr.cs
- PreservationFileReader.cs
- SqlDataReader.cs