Code:
/ DotNET / DotNET / 8.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
- TextWriter.cs
- GcHandle.cs
- IIS7WorkerRequest.cs
- XmlUrlEditor.cs
- Item.cs
- SoapTypeAttribute.cs
- WebPartUserCapability.cs
- Size.cs
- BitmapEffectInputConnector.cs
- Parameter.cs
- ExecutionEngineException.cs
- CallbackHandler.cs
- SystemInformation.cs
- ChildDocumentBlock.cs
- Stackframe.cs
- Margins.cs
- EntityDataSourceDataSelection.cs
- EntityDataSourceColumn.cs
- RegexInterpreter.cs
- QuadraticBezierSegment.cs
- x509store.cs
- QilUnary.cs
- ConnectionStringsExpressionBuilder.cs
- Ipv6Element.cs
- Script.cs
- behaviorssection.cs
- TreeNodeCollectionEditorDialog.cs
- WebColorConverter.cs
- DeclarationUpdate.cs
- TextPointerBase.cs
- UpdatePanelControlTrigger.cs
- FrameworkRichTextComposition.cs
- SoapCodeExporter.cs
- PointCollection.cs
- NumberFunctions.cs
- SBCSCodePageEncoding.cs
- OdbcEnvironmentHandle.cs
- StrokeDescriptor.cs
- DataGridItem.cs
- InstanceDataCollection.cs
- PageThemeCodeDomTreeGenerator.cs
- TreeNodeCollection.cs
- BaseTypeViewSchema.cs
- AtlasWeb.Designer.cs
- DebugInfoGenerator.cs
- RouteTable.cs
- EdmSchemaError.cs
- TriggerAction.cs
- DynamicValueConverter.cs
- LinqDataSourceView.cs
- SafeThemeHandle.cs
- RoleManagerEventArgs.cs
- remotingproxy.cs
- AssemblyNameProxy.cs
- SpanIndex.cs
- CalendarItem.cs
- SemanticResultKey.cs
- FragmentQueryKB.cs
- UnitySerializationHolder.cs
- CompiledAction.cs
- DataGridBoundColumn.cs
- TreePrinter.cs
- GraphicsContext.cs
- LinkTarget.cs
- SoapAttributeAttribute.cs
- NotificationContext.cs
- Configuration.cs
- UInt32.cs
- Path.cs
- HttpProtocolReflector.cs
- ClientTargetCollection.cs
- ConditionalAttribute.cs
- CustomSignedXml.cs
- HtmlDocument.cs
- ProviderCommandInfoUtils.cs
- TreeBuilderXamlTranslator.cs
- Timeline.cs
- TextRangeAdaptor.cs
- SqlDataSourceView.cs
- SimpleFieldTemplateUserControl.cs
- ISAPIRuntime.cs
- CallbackException.cs
- PersonalizationDictionary.cs
- PersianCalendar.cs
- xmlfixedPageInfo.cs
- InputProviderSite.cs
- CfgSemanticTag.cs
- IntegerValidator.cs
- Script.cs
- IntSecurity.cs
- FormsAuthenticationEventArgs.cs
- TimeStampChecker.cs
- DBConnectionString.cs
- InvokeBinder.cs
- ThreadExceptionEvent.cs
- Int16.cs
- AnnotationComponentChooser.cs
- SimpleMailWebEventProvider.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- ApplicationServiceManager.cs