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;
///
///
/// Represents the results
/// of compilation from the compiler.
///
///
[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;
///
///
/// Initializes a new instance of
/// that uses the specified
/// temporary files.
///
///
[PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")]
public CompilerResults(TempFileCollection tempFiles) {
this.tempFiles = tempFiles;
}
///
///
/// Gets or sets the temporary files to use.
///
///
public TempFileCollection TempFiles {
[PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")]
get {
return tempFiles;
}
[PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")]
set {
tempFiles = value;
}
}
///
///
/// Set the evidence for partially trusted scenarios.
///
///
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;
}
}
///
///
/// The compiled assembly.
///
///
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;
}
}
///
///
/// Gets or sets the collection of compiler errors.
///
///
public CompilerErrorCollection Errors {
get {
return errors;
}
}
///
///
/// Gets or sets the compiler output messages.
///
///
public StringCollection Output {
[PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")]
get {
return output;
}
}
///
///
/// Gets or sets the path to the assembly.
///
///
public string PathToAssembly {
[PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")]
get {
return pathToAssembly;
}
[PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")]
set {
pathToAssembly = value;
}
}
///
///
/// Gets or sets the compiler's return value.
///
///
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 );
}
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Buffer.cs
- VisualBrush.cs
- AtomContentProperty.cs
- WebScriptClientGenerator.cs
- ListSurrogate.cs
- Matrix3D.cs
- KnownTypeAttribute.cs
- GridViewRowEventArgs.cs
- MemoryMappedFileSecurity.cs
- ByteStorage.cs
- RuntimeConfigurationRecord.cs
- ClientEventManager.cs
- Attributes.cs
- SecurityTokenProvider.cs
- RadioButton.cs
- XmlQuerySequence.cs
- Geometry3D.cs
- SqlDataSourceSelectingEventArgs.cs
- XmlReflectionImporter.cs
- EncryptedType.cs
- TextMarkerSource.cs
- MarkupExtensionParser.cs
- XmlSchemaDocumentation.cs
- TextBreakpoint.cs
- PrintDialog.cs
- ControlDesignerState.cs
- OraclePermissionAttribute.cs
- FormsAuthenticationTicket.cs
- ObjectQueryProvider.cs
- JournalEntryListConverter.cs
- DefaultBinder.cs
- RequestResponse.cs
- ComponentChangingEvent.cs
- MinimizableAttributeTypeConverter.cs
- CLRBindingWorker.cs
- ItemList.cs
- TripleDESCryptoServiceProvider.cs
- ToolStripSplitStackLayout.cs
- DataGridViewRowsRemovedEventArgs.cs
- TimeSpanOrInfiniteConverter.cs
- _KerberosClient.cs
- OAVariantLib.cs
- ApplicationTrust.cs
- WhitespaceRuleReader.cs
- PeerCustomResolverBindingElement.cs
- FileLogRecordEnumerator.cs
- TextServicesPropertyRanges.cs
- TextElementEnumerator.cs
- SelectionEditingBehavior.cs
- ControlPropertyNameConverter.cs
- DiscoveryClientElement.cs
- ActivationArguments.cs
- SqlConnectionPoolGroupProviderInfo.cs
- EventSetterHandlerConverter.cs
- SmtpCommands.cs
- CfgParser.cs
- SliderAutomationPeer.cs
- MissingFieldException.cs
- SendSecurityHeader.cs
- EntityTypeEmitter.cs
- QueryCreatedEventArgs.cs
- ValueChangedEventManager.cs
- GeometryConverter.cs
- DbDataReader.cs
- CodePageEncoding.cs
- ApplicationCommands.cs
- ServiceErrorHandler.cs
- CodeTypeReferenceExpression.cs
- DbExpressionVisitor_TResultType.cs
- Simplifier.cs
- WindowsSolidBrush.cs
- SqlUserDefinedTypeAttribute.cs
- QilScopedVisitor.cs
- BindingCollection.cs
- CompiledXpathExpr.cs
- SettingsProperty.cs
- DataGridViewCheckBoxCell.cs
- WebPartMovingEventArgs.cs
- DictionaryKeyPropertyAttribute.cs
- URIFormatException.cs
- InstancePersistenceContext.cs
- wgx_exports.cs
- MarkupExtensionParser.cs
- ZipPackagePart.cs
- ShaperBuffers.cs
- UserControlAutomationPeer.cs
- StreamInfo.cs
- BoolLiteral.cs
- ExternalCalls.cs
- StringKeyFrameCollection.cs
- OrderByQueryOptionExpression.cs
- SiteMapNodeCollection.cs
- FixUpCollection.cs
- _Semaphore.cs
- XmlnsCompatibleWithAttribute.cs
- StickyNoteContentControl.cs
- ImageFormatConverter.cs
- NavigationHelper.cs
- SecurityUtils.cs
- DirectionalLight.cs