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
- DeviceContexts.cs
- HtmlElementCollection.cs
- ProcessModelInfo.cs
- IEnumerable.cs
- MarkerProperties.cs
- PrivateFontCollection.cs
- LayoutEditorPart.cs
- GAC.cs
- ForEachAction.cs
- control.ime.cs
- TypeUsage.cs
- ConfigUtil.cs
- SafeThemeHandle.cs
- WsdlImporter.cs
- WMICapabilities.cs
- URIFormatException.cs
- CompiledRegexRunner.cs
- SingleAnimationBase.cs
- FormViewUpdateEventArgs.cs
- DataContractAttribute.cs
- SpellerStatusTable.cs
- PersonalizableAttribute.cs
- CommandManager.cs
- Cloud.cs
- PageStatePersister.cs
- ViewGenerator.cs
- DataGridViewImageCell.cs
- SystemFonts.cs
- HttpCookiesSection.cs
- SymbolType.cs
- BaseServiceProvider.cs
- httpstaticobjectscollection.cs
- PageContentCollection.cs
- DescendantOverDescendantQuery.cs
- PostBackOptions.cs
- AnnotationResourceCollection.cs
- CallbackTimeoutsBehavior.cs
- RuleSetDialog.Designer.cs
- UInt64.cs
- ReflectTypeDescriptionProvider.cs
- ItemsControlAutomationPeer.cs
- EnumBuilder.cs
- CollectionContainer.cs
- DetailsViewModeEventArgs.cs
- SettingsPropertyValueCollection.cs
- InvalidAsynchronousStateException.cs
- Operator.cs
- WebPartConnectionsConnectVerb.cs
- GeometryGroup.cs
- RepeaterCommandEventArgs.cs
- StrokeCollectionConverter.cs
- CodeStatementCollection.cs
- OleDbCommand.cs
- GetPageNumberCompletedEventArgs.cs
- ECDiffieHellmanCng.cs
- FragmentQueryKB.cs
- EntityCommandCompilationException.cs
- ObjectDisposedException.cs
- DataMisalignedException.cs
- Schema.cs
- ArrangedElement.cs
- PolicyLevel.cs
- UrlMappingCollection.cs
- TemplateBindingExpression.cs
- ApplicationHost.cs
- SparseMemoryStream.cs
- DataGridColumnCollection.cs
- FixedPosition.cs
- MemberDescriptor.cs
- MarkupExtensionReturnTypeAttribute.cs
- CipherData.cs
- HandleExceptionArgs.cs
- Span.cs
- Configuration.cs
- EntityCommandCompilationException.cs
- HttpFileCollection.cs
- KnownBoxes.cs
- SimpleNameService.cs
- StateValidator.cs
- LeaseManager.cs
- DirectionalLight.cs
- ToolStripControlHost.cs
- Int32Animation.cs
- StateRuntime.cs
- SqlConnectionPoolProviderInfo.cs
- ObsoleteAttribute.cs
- StringFunctions.cs
- MSAAEventDispatcher.cs
- PropertyHelper.cs
- HostingPreferredMapPath.cs
- InvokeDelegate.cs
- SessionStateModule.cs
- MenuAdapter.cs
- SplitterEvent.cs
- UICuesEvent.cs
- PrintDialog.cs
- DeviceFilterDictionary.cs
- Ipv6Element.cs
- TreeViewBindingsEditorForm.cs
- SchemaNamespaceManager.cs