本文整理汇总了C#中System.ActivationContext类的典型用法代码示例。如果您正苦于以下问题:C# ActivationContext类的具体用法?C# ActivationContext怎么用?C# ActivationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActivationContext类属于System命名空间,在下文中一共展示了ActivationContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetManifestXml
private static unsafe XmlDocument GetManifestXml(ActivationContext application, ManifestKinds manifest)
{
IStream applicationComponentManifest = null;
if (manifest == ManifestKinds.Application)
{
applicationComponentManifest = InternalActivationContextHelper.GetApplicationComponentManifest(application) as IStream;
}
else if (manifest == ManifestKinds.Deployment)
{
applicationComponentManifest = InternalActivationContextHelper.GetDeploymentComponentManifest(application) as IStream;
}
using (MemoryStream stream2 = new MemoryStream())
{
byte[] pv = new byte[0x1000];
int count = 0;
do
{
applicationComponentManifest.Read(pv, pv.Length, new IntPtr((void*) &count));
stream2.Write(pv, 0, count);
}
while (count == pv.Length);
stream2.Position = 0L;
XmlDocument document = new XmlDocument {
PreserveWhitespace = true
};
document.Load(stream2);
return document;
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:ManifestSignatureInformation.cs
示例2: VerifySignature
public static ManifestSignatureInformationCollection VerifySignature(ActivationContext application, ManifestKinds manifests, X509RevocationFlag revocationFlag, X509RevocationMode revocationMode)
{
if (application == null)
{
throw new ArgumentNullException("application");
}
if ((revocationFlag < X509RevocationFlag.EndCertificateOnly) || (X509RevocationFlag.ExcludeRoot < revocationFlag))
{
throw new ArgumentOutOfRangeException("revocationFlag");
}
if ((revocationMode < X509RevocationMode.NoCheck) || (X509RevocationMode.Offline < revocationMode))
{
throw new ArgumentOutOfRangeException("revocationMode");
}
List<ManifestSignatureInformation> signatureInformation = new List<ManifestSignatureInformation>();
if ((manifests & ManifestKinds.Deployment) == ManifestKinds.Deployment)
{
ManifestSignedXml xml = new ManifestSignedXml(GetManifestXml(application, ManifestKinds.Deployment), ManifestKinds.Deployment);
signatureInformation.Add(xml.VerifySignature(revocationFlag, revocationMode));
}
if ((manifests & ManifestKinds.Application) == ManifestKinds.Application)
{
ManifestSignedXml xml2 = new ManifestSignedXml(GetManifestXml(application, ManifestKinds.Application), ManifestKinds.Application);
signatureInformation.Add(xml2.VerifySignature(revocationFlag, revocationMode));
}
return new ManifestSignatureInformationCollection(signatureInformation);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:ManifestSignatureInformation.cs
示例3: GetEntryPoint
internal static void GetEntryPoint (ActivationContext activationContext, out string fileName, out string parameters) {
parameters = null;
fileName = null;
ICMS appManifest = activationContext.ApplicationComponentManifest;
if (appManifest == null || appManifest.EntryPointSection == null)
throw new ArgumentException(Environment.GetResourceString("Argument_NoMain"));
IEnumUnknown refEnum = (IEnumUnknown) appManifest.EntryPointSection._NewEnum;
uint count = 0;
Object[] entries = new Object[1];
// Look for the first entry point. ClickOnce semantic validation ensures exactly one entry point is present.
if (refEnum.Next(1, entries, ref count) == 0 && count == 1) {
IEntryPointEntry iref= (IEntryPointEntry) entries[0];
EntryPointEntry reference = iref.AllData;
if (reference.CommandLine_File != null && reference.CommandLine_File.Length > 0) {
fileName = reference.CommandLine_File;
} else {
// Locate the dependent assembly that is being refered to. Well-formed manifests should have an identity.
IAssemblyReferenceEntry refEntry = null;
object assemblyObj = null;
if (reference.Identity != null) {
((ISectionWithReferenceIdentityKey)appManifest.AssemblyReferenceSection).Lookup(reference.Identity, out assemblyObj);
refEntry = (IAssemblyReferenceEntry) assemblyObj;
fileName = refEntry.DependentAssembly.Codebase;
}
}
parameters = reference.CommandLine_Parameters;
}
}
示例4: DetermineApplicationTrust
public static bool DetermineApplicationTrust(ActivationContext activationContext, TrustManagerContext context)
{
if (activationContext == null)
{
throw new ArgumentNullException("activationContext");
}
ApplicationTrust trust = null;
AppDomainManager domainManager = AppDomain.CurrentDomain.DomainManager;
if (domainManager != null)
{
HostSecurityManager hostSecurityManager = domainManager.HostSecurityManager;
if ((hostSecurityManager != null) && ((hostSecurityManager.Flags & HostSecurityManagerOptions.HostDetermineApplicationTrust) == HostSecurityManagerOptions.HostDetermineApplicationTrust))
{
trust = hostSecurityManager.DetermineApplicationTrust(CmsUtils.MergeApplicationEvidence(null, activationContext.Identity, activationContext, null), null, context);
if (trust == null)
{
return false;
}
return trust.IsApplicationTrustedToRun;
}
}
trust = DetermineApplicationTrustInternal(activationContext, context);
if (trust == null)
{
return false;
}
return trust.IsApplicationTrustedToRun;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:ApplicationSecurityManager.cs
示例5: CompareIdentities
internal static bool CompareIdentities(ActivationContext activationContext1, ActivationContext activationContext2)
{
if ((activationContext1 != null) && (activationContext2 != null))
{
return IsolationInterop.AppIdAuthority.AreDefinitionsEqual(0, activationContext1.Identity.Identity, activationContext2.Identity.Identity);
}
return (activationContext1 == activationContext2);
}
示例6: ApplicationSecurityInfo
public ApplicationSecurityInfo(ActivationContext activationContext)
{
if (activationContext == null)
{
throw new ArgumentNullException("activationContext");
}
this.m_context = activationContext;
}
示例7: GetDeploymentManifestBytes
public static byte[] GetDeploymentManifestBytes(ActivationContext appInfo)
{
if (appInfo == null)
{
throw new ArgumentNullException("appInfo");
}
return appInfo.GetDeploymentManifestBytes();
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:InternalActivationContextHelper.cs
示例8: RequestTrust
public static System.Security.Policy.ApplicationTrust RequestTrust(SubscriptionState subState, bool isShellVisible, bool isUpdate, ActivationContext actCtx)
{
TrustManagerContext tmc = new TrustManagerContext {
IgnorePersistedDecision = false,
NoPrompt = false,
Persist = true
};
return RequestTrust(subState, isShellVisible, isUpdate, actCtx, tmc);
}
示例9: base
// Constructor.
internal BindCompletedEventArgs
(Exception error, bool cancelled, Object userState,
ActivationContext activationContext, String friendlyName,
bool isCached)
: base(error, cancelled, userState)
{
this.activationContext = activationContext;
this.friendlyName = friendlyName;
this.isCached = isCached;
}
示例10: Proceed
private static async Task Proceed(Func<Task<object>> proceed, ActivationContext ctx)
{
if (!ctx.SkipAwait)
{
await proceed();
}
else
{
proceed();
}
}
示例11: PersistTrustWithoutEvaluation
public static System.Security.Policy.ApplicationTrust PersistTrustWithoutEvaluation(ActivationContext actCtx)
{
ApplicationSecurityInfo info = new ApplicationSecurityInfo(actCtx);
System.Security.Policy.ApplicationTrust trust = new System.Security.Policy.ApplicationTrust(actCtx.Identity) {
IsApplicationTrustedToRun = true,
DefaultGrantSet = new PolicyStatement(info.DefaultRequestSet, PolicyStatementAttribute.Nothing),
Persist = true,
ApplicationIdentity = actCtx.Identity
};
ApplicationSecurityManager.UserApplicationTrusts.Add(trust);
return trust;
}
示例12: DoAfter
private async Task<ActivationContext> DoAfter(MethodAdviceContext context, ActivationContext ctx)
{
if (context.IsAwaitable())
{
ctx = await AfterProcesssingAsync(ctx);
}
else
{
ctx = AfterProcesssing(ctx);
}
return ctx;
}
示例13: CreateInstance
public virtual ObjectHandle CreateInstance(ActivationContext activationContext, string[] activationCustomData)
{
if (activationContext == null)
{
throw new ArgumentNullException("activationContext");
}
if (CmsUtils.CompareIdentities(AppDomain.CurrentDomain.ActivationContext, activationContext))
{
ManifestRunner runner = new ManifestRunner(AppDomain.CurrentDomain, activationContext);
return new ObjectHandle(runner.ExecuteAsAssembly());
}
AppDomainSetup adSetup = new AppDomainSetup(new ActivationArguments(activationContext, activationCustomData));
return CreateInstanceHelper(adSetup);
}
示例14: CreateActivationContext
internal static void CreateActivationContext(string fullName, string[] manifestPaths, bool useFusionActivationContext, out ApplicationIdentity applicationIdentity, out ActivationContext activationContext)
{
applicationIdentity = new ApplicationIdentity(fullName);
activationContext = null;
if (useFusionActivationContext)
{
if (manifestPaths != null)
{
activationContext = new ActivationContext(applicationIdentity, manifestPaths);
}
else
{
activationContext = new ActivationContext(applicationIdentity);
}
}
}
示例15: GetEntryPointFullPath
internal static string GetEntryPointFullPath (ActivationContext activationContext) {
string file, parameters;
GetEntryPoint(activationContext, out file, out parameters);
if (!String.IsNullOrEmpty(file)) {
string directoryName = activationContext.ApplicationDirectory;
if (directoryName == null || directoryName.Length == 0) {
// If we were passed a relative path, assume the app base is the current working directory
StringBuilder sb = new StringBuilder(Path.MAX_PATH + 1);
if (Win32Native.GetCurrentDirectory(sb.Capacity, sb) == 0)
System.IO.__Error.WinIOError();
directoryName = sb.ToString();
}
file = Path.Combine(directoryName, file);
}
return file;
}