DecodeAppTrustManagerFromElement() private static method

private static DecodeAppTrustManagerFromElement ( SecurityElement elTrustManager ) : IApplicationTrustManager
elTrustManager SecurityElement
return IApplicationTrustManager
示例#1
0
 private static IApplicationTrustManager DecodeAppTrustManager()
 {
     if (File.InternalExists(ApplicationSecurityManager.s_machineConfigFile))
     {
         string end;
         using (FileStream fileStream = new FileStream(ApplicationSecurityManager.s_machineConfigFile, FileMode.Open, FileAccess.Read))
             end = new StreamReader((Stream)fileStream).ReadToEnd();
         SecurityElement securityElement1 = SecurityElement.FromString(end).SearchForChildByTag("mscorlib");
         if (securityElement1 != null)
         {
             SecurityElement securityElement2 = securityElement1.SearchForChildByTag("security");
             if (securityElement2 != null)
             {
                 SecurityElement securityElement3 = securityElement2.SearchForChildByTag("policy");
                 if (securityElement3 != null)
                 {
                     SecurityElement securityElement4 = securityElement3.SearchForChildByTag("ApplicationSecurityManager");
                     if (securityElement4 != null)
                     {
                         SecurityElement elTrustManager = securityElement4.SearchForChildByTag("IApplicationTrustManager");
                         if (elTrustManager != null)
                         {
                             IApplicationTrustManager applicationTrustManager = ApplicationSecurityManager.DecodeAppTrustManagerFromElement(elTrustManager);
                             if (applicationTrustManager != null)
                             {
                                 return(applicationTrustManager);
                             }
                         }
                     }
                 }
             }
         }
     }
     return(ApplicationSecurityManager.DecodeAppTrustManagerFromElement(ApplicationSecurityManager.CreateDefaultApplicationTrustManagerElement()));
 }