當前位置: 首頁>>代碼示例>>C#>>正文


C# System.ActivationContext類代碼示例

本文整理匯總了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;
            }
        }
開發者ID:REALTOBIZ,項目名稱:mono,代碼行數:30,代碼來源:cmsutils.cs

示例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);
 }
開發者ID:randomize,項目名稱:VimConfig,代碼行數:8,代碼來源:CmsUtils.cs

示例6: ApplicationSecurityInfo

 public ApplicationSecurityInfo(ActivationContext activationContext)
 {
     if (activationContext == null)
     {
         throw new ArgumentNullException("activationContext");
     }
     this.m_context = activationContext;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:8,代碼來源:ApplicationSecurityInfo.cs

示例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);
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:9,代碼來源:ApplicationTrust.cs

示例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;
			}
開發者ID:jjenki11,項目名稱:blaze-chem-rendering,代碼行數:11,代碼來源:BindCompletedEventArgs.cs

示例10: Proceed

 private static async Task Proceed(Func<Task<object>> proceed, ActivationContext ctx)
 {
     if (!ctx.SkipAwait)
     {
         await proceed();
     }
     else
     {
         proceed();
     }
 }
開發者ID:JonasSyrstad,項目名稱:Stardust,代碼行數:11,代碼來源:DimensionAttributeBase.cs

示例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;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:12,代碼來源:ApplicationTrust.cs

示例12: DoAfter

 private async Task<ActivationContext> DoAfter(MethodAdviceContext context, ActivationContext ctx)
 {
     if (context.IsAwaitable())
     {
         ctx = await AfterProcesssingAsync(ctx);
     }
     else
     {
         ctx = AfterProcesssing(ctx);
     }
     return ctx;
 }
開發者ID:JonasSyrstad,項目名稱:Stardust,代碼行數:12,代碼來源:DimensionAttributeBase.cs

示例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);
 }
開發者ID:randomize,項目名稱:VimConfig,代碼行數:14,代碼來源:ApplicationActivator.cs

示例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);
         }
     }
 }
開發者ID:randomize,項目名稱:VimConfig,代碼行數:16,代碼來源:CmsUtils.cs

示例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;
        }
開發者ID:REALTOBIZ,項目名稱:mono,代碼行數:19,代碼來源:cmsutils.cs


注:本文中的System.ActivationContext類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。