Example #1
0
        }                              // 0 = not used, 1 > 2 etc.

        public static void Builder()
        {
            var reader = new StreamReader(File.OpenRead(@"C:\test.csv"));

            _isoLanguages          = new List <ISOLanguage>(555);
            _isoLanguageDictionary = new Dictionary <string, ISOLanguage>(555);
            _supportedIsoLanguages = new List <ISOLanguage>(3); //only supporting three at the moment
            while (!reader.EndOfStream)
            {
                string   line   = reader.ReadLine();
                string[] values = line.Split('\t');

                var language = new ISOLanguage
                {
                    Code3          = values[1],
                    Code2          = values[2],
                    EnglishName    = values[3],
                    Scope          = (LanguageScope)Enum.Parse(typeof(LanguageScope), values[4]),
                    Classification = (LanguageClassification)Enum.Parse(typeof(LanguageClassification), values[5]),
                    Rank           = RankLookup(values[1])
                };
                _isoLanguages.Add(language);
                _isoLanguageDictionary.Add(language.Code3, language);
                if (language.Rank > 0)
                {
                    _supportedIsoLanguages.Add(language);
                }
            }
        }
Example #2
0
        public static void Builder()
        {
            var reader = new StreamReader(File.OpenRead(@"C:\test.csv"));
            _isoLanguages = new List<ISOLanguage>(555);
            _isoLanguageDictionary = new Dictionary<string, ISOLanguage>(555);
            _supportedIsoLanguages = new List<ISOLanguage>(3); //only supporting three at the moment
            while (!reader.EndOfStream)
            {
                string line = reader.ReadLine();
                string[] values = line.Split('\t');

                var language = new ISOLanguage
                {
                    Code3 = values[1],
                    Code2 = values[2],
                    EnglishName = values[3],
                    Scope = (LanguageScope) Enum.Parse(typeof (LanguageScope), values[4]),
                    Classification = (LanguageClassification) Enum.Parse(typeof (LanguageClassification), values[5]),
                    Rank = RankLookup(values[1])
                };
                _isoLanguages.Add(language);
                _isoLanguageDictionary.Add(language.Code3, language);
                if (language.Rank > 0)
                {
                    _supportedIsoLanguages.Add(language);
                }
            }
        }