private static bool ProbeForAssemblySatellite(
            IEnumerable <Uri> loadedUris,
            List <string> cultures,
            AssemblyName resolve,
            string resolveFileName,
            bool isLog,
            bool first,
            out Assembly resolvedAssembly)
        {
            HashSet <string> stringSet = new HashSet <string>((IEqualityComparer <string>)StringComparer.Ordinal);

            foreach (Uri loadedUri in loadedUris)
            {
                string localPath;
                if (loadedUri.IsAbsoluteUri && !string.IsNullOrEmpty(localPath = loadedUri.LocalPath))
                {
                    string loadedPath = (string)null;
                    try
                    {
                        loadedPath = AssemblySatelliteResolver.NormalizePath(Path.GetDirectoryName(localPath));
                    }
                    catch (Exception ex)
                    {
                        AssemblySatelliteResolver.log.DebugFormat("Cannot get directory path of \"{0}\". {1}", (object)localPath, (object)ex);
                    }
                    if (!string.IsNullOrEmpty(loadedPath) && stringSet.Add(loadedPath))
                    {
                        List <string> list = cultures.Select <string, string>((Func <string, string>)(culture => Path.Combine(loadedPath, culture, resolveFileName))).Select <string, string>(new Func <string, string>(AssemblySatelliteResolver.NormalizePath)).Where <string>(new Func <string, bool>(File.Exists)).ToList <string>();
                        if (isLog && AssemblySatelliteResolver.log.get_IsDebugEnabled() && list.Count < 1)
                        {
                            AssemblySatelliteResolver.log.DebugFormat("Resolving \"{0}\" cannot find ({2}) satellite for \"{1}\"", (object)resolve, (object)loadedPath, (object)string.Join(", ", (IEnumerable <string>)cultures));
                        }
                        foreach (string fullPath in list)
                        {
                            try
                            {
                                if (AssemblySatelliteResolver.LoadSatelliteByPath(resolve, fullPath, isLog, first, out resolvedAssembly))
                                {
                                    return(true);
                                }
                            }
                            catch (Exception ex)
                            {
                                AssemblySatelliteResolver.log.ErrorFormat("Error resolving \"{0}\" as \"{1}\". {2}", (object)resolve, (object)fullPath, (object)ex);
                            }
                        }
                    }
                }
            }
            resolvedAssembly = (Assembly)null;
            return(false);
        }
        // Token: 0x0600003A RID: 58 RVA: 0x00003818 File Offset: 0x00001A18
        private static bool ProbeForAssemblySatellite(IEnumerable <Uri> loadedUris, List <string> cultures, AssemblyName resolve, string resolveFileName, bool isLog, bool first, out Assembly resolvedAssembly)
        {
            HashSet <string> hashSet = new HashSet <string>(StringComparer.Ordinal);

            foreach (Uri uri in loadedUris)
            {
                string localPath;
                if (uri.IsAbsoluteUri && !string.IsNullOrEmpty(localPath = uri.LocalPath))
                {
                    string loadedPath = null;
                    try
                    {
                        loadedPath = AssemblySatelliteResolver.NormalizePath(Path.GetDirectoryName(localPath));
                    }
                    catch (Exception ex)
                    {
                        AssemblySatelliteResolver.log.DebugFormat("Cannot get directory path of \"{0}\". {1}", localPath, ex);
                    }
                    if (!string.IsNullOrEmpty(loadedPath) && hashSet.Add(loadedPath))
                    {
                        List <string> list = (from culture in cultures
                                              select Path.Combine(loadedPath, culture, resolveFileName)).Select(new Func <string, string>(AssemblySatelliteResolver.NormalizePath)).Where(new Func <string, bool>(File.Exists)).ToList <string>();
                        if (isLog && AssemblySatelliteResolver.log.IsDebugEnabled && list.Count < 1)
                        {
                            AssemblySatelliteResolver.log.DebugFormat("Resolving \"{0}\" cannot find ({2}) satellite for \"{1}\"", resolve, loadedPath, string.Join(", ", cultures));
                        }
                        foreach (string text in list)
                        {
                            try
                            {
                                if (AssemblySatelliteResolver.LoadSatelliteByPath(resolve, text, isLog, first, out resolvedAssembly))
                                {
                                    return(true);
                                }
                            }
                            catch (Exception ex2)
                            {
                                AssemblySatelliteResolver.log.ErrorFormat("Error resolving \"{0}\" as \"{1}\". {2}", resolve, text, ex2);
                            }
                        }
                    }
                }
            }
            resolvedAssembly = null;
            return(false);
        }
        private static bool LoadSatelliteByPath(
            AssemblyName resolve,
            string fullPath,
            bool isLog,
            bool first,
            out Assembly resolvedAssembly)
        {
            AssemblyName assemblyName = AssemblyName.GetAssemblyName(fullPath);

            if (!AssemblySatelliteResolver.SatelliteMatchesDefinition(resolve, assemblyName))
            {
                if (isLog)
                {
                    AssemblySatelliteResolver.log.DebugFormat("Resolving \"{0}\" does not match \"{1}\"", (object)resolve, (object)assemblyName);
                }
                resolvedAssembly = (Assembly)null;
                return(false);
            }
            Exception exception = (Exception)null;
            Assembly  assembly  = (Assembly)null;

            if (first)
            {
                try
                {
                    assembly = Assembly.Load(assemblyName);
                }
                catch (FileNotFoundException ex)
                {
                }
                catch (FileLoadException ex)
                {
                }
                catch (Exception ex)
                {
                    exception = ex;
                }
            }
            if (assembly == (Assembly)null)
            {
                if (exception != null)
                {
                    AssemblySatelliteResolver.log.DebugFormat("Cannot load \"{0}\", falling back to load-from. {1}", (object)assemblyName, (object)exception);
                }
                assembly = Assembly.LoadFrom(fullPath);
            }
            try
            {
                if (AssemblySatelliteResolver.ResolveCnt.GetOrAdd(assembly.FullName, (Func <string, AssemblySatelliteResolver.IntRef>)(_ => new AssemblySatelliteResolver.IntRef(0))).Increment() == 1 | isLog)
                {
                    Uri    assemblyLocation = AssemblySatelliteResolver.GetAssemblyLocation(assembly);
                    string str = !(assemblyLocation != (Uri)null) || !assemblyLocation.IsAbsoluteUri ? string.Empty : AssemblySatelliteResolver.NormalizePath(assemblyLocation.LocalPath);
                    if (AssemblyName.ReferenceMatchesDefinition(resolve, assembly.GetName()))
                    {
                        if (fullPath.Equals(str, StringComparison.Ordinal))
                        {
                            goto label_19;
                        }
                    }
                    AssemblySatelliteResolver.log.ErrorFormat("Resolved \"{0}\" as \"{1}\" at \"{2}\"", (object)resolve, (object)assembly, (object)str);
                }
            }
            catch (Exception ex)
            {
                AssemblySatelliteResolver.log.ErrorFormat("Error reporting assembly-resolved. {0}", (object)ex);
            }
label_19:
            resolvedAssembly = assembly;
            return(true);
        }
        // Token: 0x0600003B RID: 59 RVA: 0x00003A2C File Offset: 0x00001C2C
        private static bool LoadSatelliteByPath(AssemblyName resolve, string fullPath, bool isLog, bool first, out Assembly resolvedAssembly)
        {
            AssemblyName assemblyName = AssemblyName.GetAssemblyName(fullPath);

            if (!AssemblySatelliteResolver.SatelliteMatchesDefinition(resolve, assemblyName))
            {
                if (isLog)
                {
                    AssemblySatelliteResolver.log.DebugFormat("Resolving \"{0}\" does not match \"{1}\"", resolve, assemblyName);
                }
                resolvedAssembly = null;
                return(false);
            }
            Exception ex       = null;
            Assembly  assembly = null;

            if (first)
            {
                try
                {
                    assembly = Assembly.Load(assemblyName);
                }
                catch (FileNotFoundException)
                {
                }
                catch (FileLoadException)
                {
                }
                catch (Exception ex)
                {
                }
            }
            if (assembly == null)
            {
                if (ex != null)
                {
                    AssemblySatelliteResolver.log.DebugFormat("Cannot load \"{0}\", falling back to load-from. {1}", assemblyName, ex);
                }
                assembly = Assembly.LoadFrom(fullPath);
            }
            try
            {
                if (AssemblySatelliteResolver.ResolveCnt.GetOrAdd(assembly.FullName, (string _) => new AssemblySatelliteResolver.IntRef(0)).Increment() == 1 || isLog)
                {
                    Uri    assemblyLocation = AssemblySatelliteResolver.GetAssemblyLocation(assembly);
                    string text             = (assemblyLocation != null && assemblyLocation.IsAbsoluteUri) ? AssemblySatelliteResolver.NormalizePath(assemblyLocation.LocalPath) : string.Empty;
                    if (!AssemblyName.ReferenceMatchesDefinition(resolve, assembly.GetName()) || !fullPath.Equals(text, StringComparison.Ordinal))
                    {
                        AssemblySatelliteResolver.log.ErrorFormat("Resolved \"{0}\" as \"{1}\" at \"{2}\"", resolve, assembly, text);
                    }
                }
            }
            catch (Exception ex2)
            {
                AssemblySatelliteResolver.log.ErrorFormat("Error reporting assembly-resolved. {0}", ex2);
            }
            resolvedAssembly = assembly;
            return(true);
        }