Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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 ); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ ///// Gets or sets the compiler's return value. /// ///// 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 ); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007./// Gets or sets the compiler's return value. /// ///
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HtmlTable.cs
- DeploymentExceptionMapper.cs
- HttpCookiesSection.cs
- SimpleHandlerFactory.cs
- NativeCompoundFileAPIs.cs
- SettingsProviderCollection.cs
- GlobalizationAssembly.cs
- OleDbFactory.cs
- TypeTypeConverter.cs
- HttpAsyncResult.cs
- CharEntityEncoderFallback.cs
- WSDualHttpBindingCollectionElement.cs
- HtmlInputButton.cs
- TreeViewDesigner.cs
- GenericTypeParameterBuilder.cs
- ChannelSettingsElement.cs
- ComPlusThreadInitializer.cs
- sqlmetadatafactory.cs
- _FixedSizeReader.cs
- XPathEmptyIterator.cs
- LongSumAggregationOperator.cs
- Publisher.cs
- ActivitiesCollection.cs
- ControlBuilder.cs
- MembershipValidatePasswordEventArgs.cs
- SQLMembershipProvider.cs
- BasePattern.cs
- RuleSetDialog.Designer.cs
- SelectionProviderWrapper.cs
- DelimitedListTraceListener.cs
- StickyNoteHelper.cs
- Single.cs
- SQLBoolean.cs
- DescendantQuery.cs
- AuthenticationConfig.cs
- ReflectionPermission.cs
- TextElementEnumerator.cs
- NetCodeGroup.cs
- ExpressionPrefixAttribute.cs
- RuntimeIdentifierPropertyAttribute.cs
- GridViewCellAutomationPeer.cs
- Vector3DCollection.cs
- SqlProvider.cs
- WebGetAttribute.cs
- Size3D.cs
- LingerOption.cs
- Visual3D.cs
- XsltArgumentList.cs
- ImageAttributes.cs
- MsmqReceiveParameters.cs
- WebPartZoneBaseDesigner.cs
- ImageUrlEditor.cs
- BooleanExpr.cs
- GridViewCommandEventArgs.cs
- MetadataSource.cs
- MenuItemBindingCollection.cs
- ListViewInsertionMark.cs
- SkipQueryOptionExpression.cs
- CdpEqualityComparer.cs
- TimeSpanHelper.cs
- DeviceContext2.cs
- X509Logo.cs
- MissingMemberException.cs
- FormViewRow.cs
- IndicCharClassifier.cs
- MapPathBasedVirtualPathProvider.cs
- BinaryConverter.cs
- GuidelineCollection.cs
- SqlBulkCopy.cs
- InnerItemCollectionView.cs
- ContentWrapperAttribute.cs
- PropertyChangingEventArgs.cs
- ListViewCommandEventArgs.cs
- Parser.cs
- _ConnectOverlappedAsyncResult.cs
- LocalFileSettingsProvider.cs
- SchemaCreator.cs
- TextReader.cs
- UpdatePanelTrigger.cs
- QilStrConcat.cs
- InternalConfigSettingsFactory.cs
- _UriTypeConverter.cs
- AtomServiceDocumentSerializer.cs
- PropertyRef.cs
- PointAnimation.cs
- TypeListConverter.cs
- RecognitionEventArgs.cs
- NamedPipeActivation.cs
- TextSchema.cs
- CodeActivityMetadata.cs
- EventOpcode.cs
- DataColumnChangeEvent.cs
- TextBoxAutomationPeer.cs
- DesignParameter.cs
- ColorInterpolationModeValidation.cs
- StreamGeometry.cs
- XmlText.cs
- SyndicationDeserializer.cs
- TemplateLookupAction.cs
- ControlIdConverter.cs