• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# System.ActivationContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.ActivationContext的典型用法代码示例。如果您正苦于以下问题:C# ActivationContext类的具体用法?C# ActivationContext怎么用?C# ActivationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ActivationContext类属于System命名空间,在下文中一共展示了ActivationContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: 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
                    directoryName = Directory.UnsafeGetCurrentDirectory();
                }

                file = Path.Combine(directoryName, file);
            }

            return file;
        }
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:19,代码来源:cmsutils.cs


示例17: GetDependentAssemblies

 internal static IAssemblyReferenceEntry[] GetDependentAssemblies(ActivationContext activationContext)
 {
     IAssemblyReferenceEntry[] entries = null;
     ICMS appManifest = activationContext.ApplicationComponentManifest;
     if (appManifest == null)
         return null;
     
     ISection dependencySection =  appManifest.AssemblyReferenceSection;
     uint count = (dependencySection != null) ? dependencySection.Count : 0;
     if (count > 0)
     {
         uint fetched = 0;
         entries = new IAssemblyReferenceEntry[count];
         IEnumUnknown dependencyEnum = (IEnumUnknown)dependencySection._NewEnum;
         int hr = dependencyEnum.Next(count, entries, ref fetched);
         if (fetched != count || hr < 0)
             return null; //
     }
     return entries;
 }
开发者ID:REALTOBIZ,项目名称:mono,代码行数:20,代码来源:cmsutils.cs


示例18: GetDependentAssemblies

 internal static IAssemblyReferenceEntry[] GetDependentAssemblies(ActivationContext activationContext)
 {
     IAssemblyReferenceEntry[] rgelt = null;
     ICMS applicationComponentManifest = activationContext.ApplicationComponentManifest;
     if (applicationComponentManifest != null)
     {
         ISection assemblyReferenceSection = applicationComponentManifest.AssemblyReferenceSection;
         uint celt = (assemblyReferenceSection != null) ? assemblyReferenceSection.Count : 0;
         if (celt <= 0)
         {
             return rgelt;
         }
         uint celtFetched = 0;
         rgelt = new IAssemblyReferenceEntry[celt];
         int num3 = ((IEnumUnknown) assemblyReferenceSection._NewEnum).Next(celt, rgelt, ref celtFetched);
         if ((celtFetched == celt) && (num3 >= 0))
         {
             return rgelt;
         }
     }
     return null;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:22,代码来源:CmsUtils.cs


示例19: ManifestRunner

 internal ManifestRunner(AppDomain domain, ActivationContext activationContext)
 {
     string str;
     string str2;
     this.m_domain = domain;
     CmsUtils.GetEntryPoint(activationContext, out str, out str2);
     if (string.IsNullOrEmpty(str))
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_NoMain"));
     }
     if (string.IsNullOrEmpty(str2))
     {
         this.m_args = new string[0];
     }
     else
     {
         this.m_args = str2.Split(new char[] { ' ' });
     }
     this.m_apt = ApartmentState.Unknown;
     string applicationDirectory = activationContext.ApplicationDirectory;
     this.m_path = Path.Combine(applicationDirectory, str);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:22,代码来源:ManifestRunner.cs


示例20: GetManifestCompletedEventArgs

 internal GetManifestCompletedEventArgs(BindCompletedEventArgs e, ActivationDescription activationDescription, string logFilePath, Logger.LogIdentity log) : base(e.Error, e.Cancelled, e.UserState)
 {
     this._applicationIdentity = (e.ActivationContext != null) ? e.ActivationContext.Identity : null;
     Logger.AddInternalState(log, "Creating GetManifestCompletedEventArgs.");
     string text = this._applicationIdentity.ToString();
     DefinitionAppId id = new DefinitionAppId(text);
     this._subId = id.DeploymentIdentity.ToSubscriptionId();
     this._logFilePath = logFilePath;
     this._isCached = e.IsCached;
     this._name = e.FriendlyName;
     this._actContext = e.ActivationContext;
     Logger.AddInternalState(log, "Application identity=" + text);
     Logger.AddInternalState(log, "Subscription identity=" + ((this._subId != null) ? this._subId.ToString() : "null"));
     Logger.AddInternalState(log, "IsCached=" + this._isCached.ToString());
     if (this._isCached)
     {
         this._rawDeploymentManifest = e.ActivationContext.DeploymentManifestBytes;
         this._rawApplicationManifest = e.ActivationContext.ApplicationManifestBytes;
     }
     this._activationDescription = activationDescription;
     this._version = this._activationDescription.AppId.DeploymentIdentity.Version;
     this._support = this._activationDescription.DeployManifest.Description.SupportUri;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:GetManifestCompletedEventArgs.cs



注:本文中的System.ActivationContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# System.AggregateException类代码示例发布时间:2022-05-26
下一篇:
C# System.Action类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap