/** Reads * keyInfo{ * deprecated{ * kh{"true"} * vt{"true"} * } * valueType{ * ca{"incremental"} * h0{"single"} * kr{"multiple"} * vt{"multiple"} * x0{"any"} * } * } */ private static void GetKeyInfo(UResourceBundle keyInfoRes) { ISet <string> _deprecatedKeys = new JCG.HashSet <string>(); IDictionary <string, KeyTypeDataValueType> _valueTypes = new JCG.LinkedDictionary <string, KeyTypeDataValueType>(); foreach (var keyInfoEntry in keyInfoRes) { string key = keyInfoEntry.Key; KeyInfoType keyInfo = (KeyInfoType)Enum.Parse(typeof(KeyInfoType), key, true); foreach (var keyInfoEntry2 in keyInfoEntry) { string key2 = keyInfoEntry2.Key; string value2 = keyInfoEntry2.GetString(); switch (keyInfo) { case KeyInfoType.deprecated: _deprecatedKeys.Add(key2); break; case KeyInfoType.valueType: _valueTypes[key2] = (KeyTypeDataValueType)Enum.Parse(typeof(KeyTypeDataValueType), value2, true); break; } } } DEPRECATED_KEYS = _deprecatedKeys.AsReadOnly(); VALUE_TYPES = _valueTypes.AsReadOnly(); }
public static Languages GetInstance(string languagesResourceName) { // read languages list ISet <string> ls = new JCG.HashSet <string>(); Stream langIS = typeof(Languages).FindAndGetManifestResourceStream(languagesResourceName); if (langIS == null) { throw new ArgumentException("Unable to resolve required resource: " + languagesResourceName); } using (TextReader reader = new StreamReader(langIS, ResourceConstants.ENCODING)) { bool inExtendedComment = false; string rawLine; while ((rawLine = reader.ReadLine()) != null) { string line = rawLine.Trim(); if (inExtendedComment) { if (line.EndsWith(ResourceConstants.EXT_CMT_END, StringComparison.Ordinal)) { inExtendedComment = false; } } else { if (line.StartsWith(ResourceConstants.EXT_CMT_START, StringComparison.Ordinal)) { inExtendedComment = true; } else if (line.Length > 0) { ls.Add(line); } } } } return(new Languages(ls.AsReadOnly())); }