Code:
/ DotNET / DotNET / 8.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
- UIElement.cs
- LinqDataSourceSelectEventArgs.cs
- RequestDescription.cs
- UpDownEvent.cs
- XmlNamespaceMapping.cs
- ExpressionParser.cs
- ReachDocumentPageSerializer.cs
- ECDsa.cs
- TrustManager.cs
- TPLETWProvider.cs
- KeyMatchBuilder.cs
- DemultiplexingClientMessageFormatter.cs
- ListViewItemEventArgs.cs
- NetworkInterface.cs
- RecognitionEventArgs.cs
- XpsPackagingPolicy.cs
- ClassImporter.cs
- WebPartEditorCancelVerb.cs
- PolicyStatement.cs
- DesignerLoader.cs
- RenderData.cs
- DependencyObject.cs
- EncoderParameters.cs
- ProjectionRewriter.cs
- UpdateDelegates.Generated.cs
- TableRowGroup.cs
- WizardSideBarListControlItem.cs
- FontNamesConverter.cs
- ArgumentException.cs
- HttpHandlersSection.cs
- PeerCredentialElement.cs
- DoubleCollectionConverter.cs
- WebHeaderCollection.cs
- EntityDescriptor.cs
- SQLByteStorage.cs
- ManagementDateTime.cs
- ProfileInfo.cs
- SQLInt32.cs
- Internal.cs
- FontCacheLogic.cs
- PropertyStore.cs
- NotifyInputEventArgs.cs
- SourceItem.cs
- COM2ExtendedUITypeEditor.cs
- SymbolMethod.cs
- XmlElementList.cs
- InputMethodStateTypeInfo.cs
- CipherData.cs
- XmlEncodedRawTextWriter.cs
- BoundColumn.cs
- TdsParserSessionPool.cs
- SystemIPGlobalProperties.cs
- ImageButton.cs
- AppearanceEditorPart.cs
- SecurityCredentialsManager.cs
- XmlnsCache.cs
- QilScopedVisitor.cs
- Compiler.cs
- LineGeometry.cs
- BinaryCommonClasses.cs
- ImageFormat.cs
- RelationshipEndCollection.cs
- LoadWorkflowByKeyAsyncResult.cs
- HttpRuntime.cs
- DelayDesigner.cs
- KeyNotFoundException.cs
- SqlDependencyListener.cs
- RequestFactory.cs
- UntrustedRecipientException.cs
- WebPartDeleteVerb.cs
- NavigationProperty.cs
- ComponentChangedEvent.cs
- DrawingContextWalker.cs
- ByteViewer.cs
- OperatorExpressions.cs
- PropertyTab.cs
- SingleObjectCollection.cs
- ProjectionAnalyzer.cs
- _ListenerRequestStream.cs
- ReadingWritingEntityEventArgs.cs
- SqlInternalConnectionSmi.cs
- FindResponse.cs
- PropertyItem.cs
- AnnotationDocumentPaginator.cs
- ServiceObjectContainer.cs
- Options.cs
- SendMailErrorEventArgs.cs
- ConfigXmlElement.cs
- ExpressionBuilder.cs
- SerializableAuthorizationContext.cs
- CommandField.cs
- AuthenticationService.cs
- MatrixTransform3D.cs
- ObjectStateEntryDbDataRecord.cs
- TypeCollectionDesigner.xaml.cs
- ParserHooks.cs
- SQLChars.cs
- BinaryFormatterWriter.cs
- FixedLineResult.cs
- SamlAssertionKeyIdentifierClause.cs