Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / CompMod / System / CodeDOM / Compiler / CompilerResults.cs / 1 / CompilerResults.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.CodeDom.Compiler { using System; using System.CodeDom; using System.Reflection; using System.Collections; using System.Collections.Specialized; using System.Security; using System.Security.Permissions; using System.Security.Policy; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; using System.IO; ////// [Serializable()] [PermissionSet(SecurityAction.InheritanceDemand, Name="FullTrust")] public class CompilerResults { private CompilerErrorCollection errors = new CompilerErrorCollection(); private StringCollection output = new StringCollection(); private Assembly compiledAssembly; private string pathToAssembly; private int nativeCompilerReturnValue; private TempFileCollection tempFiles; private Evidence evidence; ////// Represents the results /// of compilation from the compiler. /// ////// [PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")] public CompilerResults(TempFileCollection tempFiles) { this.tempFiles = tempFiles; } ////// Initializes a new instance of ////// that uses the specified /// temporary files. /// /// public TempFileCollection TempFiles { [PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")] get { return tempFiles; } [PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")] set { tempFiles = value; } } ////// Gets or sets the temporary files to use. /// ////// public Evidence Evidence { [PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")] get { Evidence e = null; if (evidence != null) e = CloneEvidence(evidence); return e; } [PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")] [SecurityPermissionAttribute( SecurityAction.Demand, ControlEvidence = true )] set { if (value != null) evidence = CloneEvidence(value); else evidence = null; } } ////// Set the evidence for partially trusted scenarios. /// ////// public Assembly CompiledAssembly { [SecurityPermissionAttribute(SecurityAction.Assert, Flags=SecurityPermissionFlag.ControlEvidence)] get { if (compiledAssembly == null && pathToAssembly != null) { AssemblyName assemName = new AssemblyName(); assemName.CodeBase = pathToAssembly; compiledAssembly = Assembly.Load(assemName,evidence); } return compiledAssembly; } [PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")] set { compiledAssembly = value; } } ////// The compiled assembly. /// ////// public CompilerErrorCollection Errors { get { return errors; } } ////// Gets or sets the collection of compiler errors. /// ////// public StringCollection Output { [PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")] get { return output; } } ////// Gets or sets the compiler output messages. /// ////// public string PathToAssembly { [PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")] get { return pathToAssembly; } [PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")] set { pathToAssembly = value; } } ////// Gets or sets the path to the assembly. /// ////// public int NativeCompilerReturnValue { get { return nativeCompilerReturnValue; } [PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")] set { nativeCompilerReturnValue = value; } } internal static Evidence CloneEvidence(Evidence ev) { new PermissionSet( PermissionState.Unrestricted ).Assert(); MemoryStream stream = new MemoryStream(); BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize( stream, ev ); stream.Position = 0; return (Evidence)formatter.Deserialize( stream ); } } }/// Gets or sets the compiler's return value. /// ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- InputLangChangeEvent.cs
- RawStylusInputCustomData.cs
- RowToParametersTransformer.cs
- MethodResolver.cs
- MobileDeviceCapabilitiesSectionHandler.cs
- CompareValidator.cs
- PerformanceCounterCategory.cs
- ProviderException.cs
- TextParentUndoUnit.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- Converter.cs
- FormViewCommandEventArgs.cs
- UnrecognizedAssertionsBindingElement.cs
- BufferedStream.cs
- Underline.cs
- FontUnit.cs
- ElementHost.cs
- __ComObject.cs
- SQLDateTimeStorage.cs
- ToolStripDropDownItemDesigner.cs
- JavaScriptString.cs
- MembershipSection.cs
- StreamReader.cs
- FragmentQueryKB.cs
- AssemblyFilter.cs
- BitmapEffectGeneralTransform.cs
- DecimalStorage.cs
- DatePicker.cs
- HandlerFactoryCache.cs
- AdCreatedEventArgs.cs
- InternalBufferOverflowException.cs
- SqlAggregateChecker.cs
- COSERVERINFO.cs
- odbcmetadatacolumnnames.cs
- RuntimeWrappedException.cs
- FaultDescription.cs
- DBBindings.cs
- DataGridItemEventArgs.cs
- ReadOnlyCollectionBuilder.cs
- HtmlInputImage.cs
- TimeoutValidationAttribute.cs
- UnsafeNativeMethodsTablet.cs
- WebRequestModuleElementCollection.cs
- ResXDataNode.cs
- ZipIORawDataFileBlock.cs
- HelloOperationCD1AsyncResult.cs
- StrongTypingException.cs
- ColorConverter.cs
- DbConnectionPoolOptions.cs
- AppDomainInstanceProvider.cs
- ICspAsymmetricAlgorithm.cs
- TransformerInfo.cs
- ParentQuery.cs
- RIPEMD160Managed.cs
- InvalidProgramException.cs
- ObjectDesignerDataSourceView.cs
- ConfigXmlComment.cs
- DetailsViewUpdatedEventArgs.cs
- EditingCoordinator.cs
- DataGridHeaderBorder.cs
- ColorConvertedBitmap.cs
- CharAnimationUsingKeyFrames.cs
- path.cs
- FixedTextSelectionProcessor.cs
- View.cs
- ADMembershipProvider.cs
- AuthenticationException.cs
- XmlExtensionFunction.cs
- GridViewSortEventArgs.cs
- ObjectKeyFrameCollection.cs
- DependencyObjectType.cs
- CanExecuteRoutedEventArgs.cs
- OutputScopeManager.cs
- DataGridViewButtonColumn.cs
- UserControl.cs
- HtmlTableRow.cs
- AQNBuilder.cs
- EtwTrace.cs
- ClientBuildManagerCallback.cs
- DayRenderEvent.cs
- BaseConfigurationRecord.cs
- TextTreeRootTextBlock.cs
- ComponentCodeDomSerializer.cs
- IDQuery.cs
- ComponentConverter.cs
- Certificate.cs
- ServiceDefaults.cs
- DbParameterHelper.cs
- MsmqIntegrationBindingCollectionElement.cs
- UnionExpr.cs
- CollaborationHelperFunctions.cs
- MailMessage.cs
- _OverlappedAsyncResult.cs
- ImageCodecInfoPrivate.cs
- ISessionStateStore.cs
- RemotingSurrogateSelector.cs
- XmlSignatureManifest.cs
- ITreeGenerator.cs
- _ConnectOverlappedAsyncResult.cs
- DataSourceControl.cs