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
- Grammar.cs
- PopupRoot.cs
- DataGridViewCellFormattingEventArgs.cs
- MailBnfHelper.cs
- ToolBar.cs
- TypeUsage.cs
- RetrieveVirtualItemEventArgs.cs
- TextBoxView.cs
- CounterSet.cs
- HandleExceptionArgs.cs
- IgnoreFileBuildProvider.cs
- MimeFormatExtensions.cs
- DependencyPropertyKind.cs
- StructuralCache.cs
- XmlSchemaSimpleContent.cs
- UnsafeNativeMethodsPenimc.cs
- ForeignKeyConstraint.cs
- ValueChangedEventManager.cs
- SqlDataSourceCommandEventArgs.cs
- HttpApplicationFactory.cs
- ConditionalBranch.cs
- WebPartTracker.cs
- ApplicationInfo.cs
- XmlEntity.cs
- TextParaClient.cs
- EventItfInfo.cs
- DataGridViewColumnCollection.cs
- Thread.cs
- WsdlBuildProvider.cs
- Assert.cs
- LookupNode.cs
- Screen.cs
- MethodAccessException.cs
- GroupItem.cs
- ApplicationBuildProvider.cs
- EndEvent.cs
- StringBuilder.cs
- InputEventArgs.cs
- BinaryUtilClasses.cs
- SqlServer2KCompatibilityCheck.cs
- ConfigXmlWhitespace.cs
- HwndSourceParameters.cs
- LayoutDump.cs
- NameSpaceEvent.cs
- TreeNode.cs
- XmlStringTable.cs
- DesignerMetadata.cs
- InheritedPropertyChangedEventArgs.cs
- ConfigurationSection.cs
- ColorConvertedBitmap.cs
- ProtocolsConfigurationHandler.cs
- EmbeddedMailObject.cs
- columnmapfactory.cs
- CodeIdentifiers.cs
- DataSet.cs
- HwndAppCommandInputProvider.cs
- WindowsRichEdit.cs
- ValidationPropertyAttribute.cs
- TypeDescriptionProvider.cs
- EditorOptionAttribute.cs
- ImageListStreamer.cs
- X509CertificateInitiatorClientCredential.cs
- PriorityBinding.cs
- XmlDataFileEditor.cs
- GridItemPattern.cs
- Stylesheet.cs
- LabelLiteral.cs
- IndexedEnumerable.cs
- UserControlBuildProvider.cs
- PathSegmentCollection.cs
- CategoryAttribute.cs
- HealthMonitoringSection.cs
- _TransmitFileOverlappedAsyncResult.cs
- XsltSettings.cs
- ExponentialEase.cs
- CacheDependency.cs
- Documentation.cs
- PolicyValidationException.cs
- ISAPIRuntime.cs
- HttpSysSettings.cs
- HwndStylusInputProvider.cs
- DataRecordInternal.cs
- infer.cs
- UnsafeNativeMethods.cs
- AssemblyLoader.cs
- MDIClient.cs
- CredentialManagerDialog.cs
- _SafeNetHandles.cs
- ZipIOFileItemStream.cs
- FileInfo.cs
- AssemblyHash.cs
- TimeSpanConverter.cs
- BufferedGraphicsManager.cs
- SingleKeyFrameCollection.cs
- ListMarkerSourceInfo.cs
- MetafileHeaderWmf.cs
- XPathAxisIterator.cs
- GPRECT.cs
- X509ChainPolicy.cs
- XslTransform.cs