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); }
public static KeyValuePair <NamespaceKey, V> StringToNamespaceKey(KeyValuePair <string, V> pair) => new KeyValuePair <NamespaceKey, V>(NamespaceKey.From(pair.Key), pair.Value);
public NamespaceModel(NamespaceKey key, GeneratorConfiguration configuration) { Configuration = configuration; Key = key; Types = new Dictionary<string, TypeModel>(); }
public Logger([NotNull] NamespaceKey key, TextWriter?writer = null) { messages = ImmutableArray.CreateBuilder <LogMessage>(); Key = key; this.writer = writer; }
public void StartNamespace(NamespaceKey key) { if (key == null) throw new ArgumentNullException("key"); _namespaces.Push(key); }
private NamespaceModel CreateNamespaceModel(Uri source, XmlQualifiedName qualifiedName) { NamespaceModel namespaceModel = null; if (!qualifiedName.IsEmpty && qualifiedName.Namespace != XmlSchema.Namespace) { var key = new NamespaceKey(source, qualifiedName.Namespace); if (!Namespaces.TryGetValue(key, out namespaceModel)) { var namespaceName = BuildNamespace(source, qualifiedName.Namespace); namespaceModel = new NamespaceModel(key, _configuration) { Name = namespaceName }; Namespaces.Add(key, namespaceModel); } } return namespaceModel; }
private string BuildNamespace(Uri source, string xmlNamespace) { var key = new NamespaceKey(source, xmlNamespace); var result = NamespaceProvider.FindNamespace(key); if (!string.IsNullOrEmpty(result)) return result; throw new Exception(string.Format("Namespace {0} not provided through map or generator.", xmlNamespace)); }
public Permission(NamespaceKey key) => Key = key;