Amazon.Internal.RegionEndpointProviderV2.RegionEndpoint.TryLoadEndpointDefinitionsFromAssemblyDir C# (CSharp) Méthode

TryLoadEndpointDefinitionsFromAssemblyDir() static private méthode

static private TryLoadEndpointDefinitionsFromAssemblyDir ( ) : bool
Résultat bool
            static bool TryLoadEndpointDefinitionsFromAssemblyDir()
            {
                string endpointsFile;
                try
                {
                    var assembly = typeof(Amazon.RegionEndpoint).Assembly;
                    var codeBase = assembly.CodeBase;
                    if (string.IsNullOrEmpty(codeBase))
                        return false;

                    var uri = new Uri(codeBase);
                    var dirPath = Path.GetDirectoryName(uri.LocalPath);
                    var dirInfo = new DirectoryInfo(dirPath);
                    if (!dirInfo.Exists)
                        return false;

                    var files = dirInfo.GetFiles(REGIONS_FILE, SearchOption.TopDirectoryOnly);
                    if (files.Length != 1)
                        return false;

                    endpointsFile = files[0].FullName;
                }
                catch
                {
                    endpointsFile = null;
                }

                if (string.IsNullOrEmpty(endpointsFile))
                    return false;

                LoadEndpointDefinitionFromFilePath(endpointsFile);
                return true;
            }
#endif