Ejemplo n.º 1
0
        public virtual ResourceKey GetKey(string fullName)
        {
            return(_cache.GetOrAdd(fullName, fqn =>
            {
                ResourceKey key = null;
                foreach (Rule map in _options.Rules)
                {
                    key = map.TryGetKey(fqn, _options);
                    if (key != null)
                    {
                        break;
                    }
                }

                return key;
            }));
        }
Ejemplo n.º 2
0
        public ResourceKey TryGetKey(string fullQualifiedName, ResourceMapperOptions options)
        {
            ResourceKey key = null;

            Match match = _expression.Match(fullQualifiedName);

            if (match.Success)
            {
                key              = new ResourceKey();
                key.KeyName      = Resolve(KeyNameTemplate, match, options);
                key.ResourceName = Resolve(SourceTemplate, match, options);
                if (LocationTemplate != null)
                {
                    key.ResourceLocation = Resolve(LocationTemplate, match, options);
                }
            }

            return(key);
        }