private static TopologyMode SelectTopologyMode(out int adamPort)
 {
     adamPort = 0;
     if (AdamTopologyProvider.CheckIfAdamConfigured(out adamPort))
     {
         return(TopologyMode.Adam);
     }
     if (TopologyProvider.userSetTopologyMode != null)
     {
         return(TopologyProvider.userSetTopologyMode.Value);
     }
     if (ServiceTopologyProvider.IsAdTopologyServiceInstalled())
     {
         return(TopologyMode.ADTopologyService);
     }
     return(TopologyMode.Ldap);
 }
        internal static void SetProcessTopologyMode(bool isAdminMode, bool publicMethodCheck)
        {
            ExTraceGlobals.TopologyProviderTracer.TraceDebug <string, bool>(0L, "{0} method sets admin mode to {1}", publicMethodCheck ? "Public" : "Internal", isAdminMode);
            int num = 0;

            if (!publicMethodCheck || (TopologyProvider.staticInstance != null && TopologyProvider.CurrentTopologyMode == TopologyMode.Ldap && AdamTopologyProvider.CheckIfAdamConfigured(out num)) || TopologyProvider.staticInstance == null)
            {
                TopologyProvider.SetProcessTopologyMode(isAdminMode ? TopologyMode.Ldap : TopologyMode.ADTopologyService);
            }
        }