Exemplo n.º 1
0
        public static Dictionary <NamespaceKey, string>?DeserializeLanguageConfig(string path)
        {
            if (!File.Exists(path))
            {
                return(null);
            }

            var localizations = new Dictionary <NamespaceKey, string>();
            var lines         = File.ReadAllLines(path);

            foreach (var line in lines)
            {
                var split        = line.Split('=');
                var key          = NamespaceKey.From(split[0], '.');
                var localization = split[1];

                if (key != null && !string.IsNullOrEmpty(localization))
                {
                    localizations.Add(key, localization);
                }
            }

            return(localizations);
        }
Exemplo n.º 2
0
 public static KeyValuePair <NamespaceKey, V> StringToNamespaceKey(KeyValuePair <string, V> pair) => new KeyValuePair <NamespaceKey, V>(NamespaceKey.From(pair.Key), pair.Value);