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
- DataGridViewColumnEventArgs.cs
- MeasureItemEvent.cs
- UrlMappingsModule.cs
- DayRenderEvent.cs
- Registry.cs
- DataPointer.cs
- Quaternion.cs
- ColorConvertedBitmapExtension.cs
- MinMaxParagraphWidth.cs
- Accessible.cs
- MethodInfo.cs
- SoapAttributes.cs
- MatrixCamera.cs
- EpmHelper.cs
- OutputCacheProfile.cs
- LineGeometry.cs
- BufferBuilder.cs
- IndexedString.cs
- Popup.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- ValidatorAttribute.cs
- _SslState.cs
- DataReaderContainer.cs
- CreateSequenceResponse.cs
- BitmapCache.cs
- SqlFactory.cs
- SmiRequestExecutor.cs
- TableCell.cs
- ResourceExpressionBuilder.cs
- TcpChannelFactory.cs
- CodeDefaultValueExpression.cs
- ContentPlaceHolder.cs
- CodeValidator.cs
- future.cs
- CompiledRegexRunner.cs
- SplayTreeNode.cs
- CachedFontFamily.cs
- Style.cs
- Part.cs
- XmlSignatureProperties.cs
- DataControlButton.cs
- SafeEventLogWriteHandle.cs
- x509utils.cs
- EditingScopeUndoUnit.cs
- GraphicsContext.cs
- ParameterBinding.cs
- OrderToken.cs
- UrlMappingCollection.cs
- httpstaticobjectscollection.cs
- CorePropertiesFilter.cs
- NewExpression.cs
- StorageInfo.cs
- FontDifferentiator.cs
- UpdatePanelTrigger.cs
- IncrementalCompileAnalyzer.cs
- UrlMapping.cs
- LineServicesRun.cs
- NamespaceInfo.cs
- XPathScanner.cs
- CustomValidator.cs
- SiteMapNodeCollection.cs
- RadioButton.cs
- JsonServiceDocumentSerializer.cs
- SortDescription.cs
- XmlSortKey.cs
- COM2ExtendedBrowsingHandler.cs
- GlyphTypeface.cs
- PowerStatus.cs
- ListViewItemSelectionChangedEvent.cs
- DataSvcMapFile.cs
- ComplexTypeEmitter.cs
- Empty.cs
- ToolboxItemFilterAttribute.cs
- GridPattern.cs
- ManagementObjectSearcher.cs
- AtomEntry.cs
- Int16AnimationUsingKeyFrames.cs
- FixedHyperLink.cs
- SqlCacheDependencyDatabaseCollection.cs
- CurrencyManager.cs
- SqlMethodTransformer.cs
- FontDriver.cs
- UIAgentAsyncEndRequest.cs
- SqlXml.cs
- ResourceSet.cs
- AssemblyLoader.cs
- Repeater.cs
- BadImageFormatException.cs
- Process.cs
- _PooledStream.cs
- storepermission.cs
- EmbeddedMailObject.cs
- DynamicValidatorEventArgs.cs
- RTLAwareMessageBox.cs
- MsmqBindingFilter.cs
- CopyAction.cs
- SpotLight.cs
- ReceiveCompletedEventArgs.cs
- TrackingProfileCache.cs
- DataGridViewCellFormattingEventArgs.cs