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
- TextShapeableCharacters.cs
- ContractBase.cs
- EmptyQuery.cs
- HttpProcessUtility.cs
- RedistVersionInfo.cs
- PathFigureCollectionValueSerializer.cs
- PrimitiveSchema.cs
- ImageAnimator.cs
- HttpDictionary.cs
- StringReader.cs
- DataGridTableCollection.cs
- SystemIcons.cs
- DLinqDataModelProvider.cs
- GridViewRowEventArgs.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- Internal.cs
- CodeCommentStatementCollection.cs
- TransportBindingElementImporter.cs
- SqlFacetAttribute.cs
- TypeConverterMarkupExtension.cs
- PropertyInfoSet.cs
- BuilderElements.cs
- EntityTypeEmitter.cs
- InvalidFilterCriteriaException.cs
- EntitySqlQueryCacheEntry.cs
- CollectionType.cs
- HtmlUtf8RawTextWriter.cs
- DictionaryEntry.cs
- ManagedIStream.cs
- AttachmentCollection.cs
- GridViewPageEventArgs.cs
- safex509handles.cs
- Light.cs
- SqlCommandSet.cs
- Solver.cs
- XmlNodeChangedEventArgs.cs
- SoapUnknownHeader.cs
- Module.cs
- EntityDataSourceDesigner.cs
- ExternalException.cs
- MenuRendererStandards.cs
- LocatorGroup.cs
- FloaterBaseParaClient.cs
- TrackingCondition.cs
- AndCondition.cs
- FixedFindEngine.cs
- Configuration.cs
- EdmError.cs
- UIElementAutomationPeer.cs
- StyleCollection.cs
- SpeechEvent.cs
- Rect3DConverter.cs
- WebBrowserPermission.cs
- DateTimeStorage.cs
- TextEditorSpelling.cs
- TextControlDesigner.cs
- BaseTemplateCodeDomTreeGenerator.cs
- WebPartAuthorizationEventArgs.cs
- ResourceBinder.cs
- FixedPageStructure.cs
- TaskbarItemInfo.cs
- DBSqlParserColumnCollection.cs
- RectKeyFrameCollection.cs
- HttpValueCollection.cs
- ColorConvertedBitmapExtension.cs
- GridPattern.cs
- ApplyImportsAction.cs
- SourceItem.cs
- WebServicesDescriptionAttribute.cs
- DiscoveryClientReferences.cs
- log.cs
- WindowsListViewSubItem.cs
- SrgsNameValueTag.cs
- RenderCapability.cs
- HashStream.cs
- ToolStripPanelCell.cs
- ErrorStyle.cs
- SQLString.cs
- wgx_sdk_version.cs
- AssemblyInfo.cs
- SafeLocalAllocation.cs
- EdmComplexPropertyAttribute.cs
- Context.cs
- VersionedStream.cs
- IPAddress.cs
- MulticastDelegate.cs
- WebPartConnectionsConfigureVerb.cs
- TimeSpanSecondsConverter.cs
- ContentFileHelper.cs
- PartBasedPackageProperties.cs
- ContextStack.cs
- ProcessStartInfo.cs
- XamlPoint3DCollectionSerializer.cs
- EditorZoneBase.cs
- JsonEnumDataContract.cs
- WebPartManagerInternals.cs
- HttpConfigurationContext.cs
- SerialErrors.cs
- ScrollPatternIdentifiers.cs
- TextDecorationCollectionConverter.cs