Esempio n. 1
0
        private static void loadShortNumberMetadataFromFile(String regionCode)
        {
            var resourceName = SHORT_NUMBER_METADATA_FILE_PREFIX + "_" + regionCode;
            var assembly     = typeof(MetadataManager).Assembly;

            try
            {
                using (var stream = assembly.GetManifestResourceStream(resourceName))
                {
                    using (var reader = new BinaryReader(stream))
                    {
                        PhoneMetadataCollection shortNumberMetadata = new PhoneMetadataCollection();
                        shortNumberMetadata.readExternal(reader);
                        foreach (PhoneMetadata metadata in shortNumberMetadata.getMetadataList())
                        {
                            regionCodeToShortNumberMetadataMap.Add(regionCode, metadata);
                        }
                    }
                }
            }
            catch (IOException e)
            {
                LOGGER.log(Level.WARNING, e.ToString());
            }
        }
Esempio n. 2
0
        private static void loadAlternateFormatsMetadataFromFile(int countryCallingCode)
        {
            var resourceName = ALTERNATE_FORMATS_FILE_PREFIX + "_" + countryCallingCode;
            var assembly     = typeof(MetadataManager).Assembly;

            try
            {
                using (var stream = assembly.GetManifestResourceStream(resourceName))
                {
                    using (var reader = new BinaryReader(stream))
                    {
                        PhoneMetadataCollection alternateFormats = new PhoneMetadataCollection();
                        alternateFormats.readExternal(reader);
                        foreach (PhoneMetadata metadata in alternateFormats.getMetadataList())
                        {
                            callingCodeToAlternateFormatsMap.Add(metadata.getCountryCode(), metadata);
                        }
                    }
                }
            }
            catch (IOException e)
            {
                LOGGER.log(Level.WARNING, e.ToString());
            }
        }