Ejemplo n.º 1
0
        public override Target this[string id]
        {
            get
            {
                Target target = null;

                if (_targetCache != null)
                {
                    target = _targetCache[id];
                    if (target != null)
                    {
                        return(target);
                    }
                }

                if (_targetStorage != null && _targetStorage.ContainsKey(id))
                {
                    target = TargetsReader.ReadXml(_targetStorage[id]);
                    if (target != null && _targetCache != null)
                    {
                        _targetCache.Add(target);
                    }
                }

                return(target);
            }
        }
Ejemplo n.º 2
0
        public override Target this[string id]
        {
            get
            {
                Target target = null;
                if (_quickStorage != null && _quickStorage.Count != 0)
                {
                    target = _quickStorage[id];
                    if (target != null)
                    {
                        return(target);
                    }
                }
                if (_targetCache != null)
                {
                    target = _targetCache[id];
                    if (target != null)
                    {
                        return(target);
                    }
                }

                if (_targetStorage != null && _targetStorage.ContainsKey(id))
                {
                    target = TargetsReader.ReadXml(_targetStorage[id]);
                    if (target != null && _targetCache != null)
                    {
                        _targetCache.Add(target);
                    }

                    return(target);
                }
                if (_otherStorages != null && _otherStorages.Count != 0)
                {
                    // We will not cache any target from the other sources, since
                    // each has internal cache...
                    for (int i = 0; i < _otherStorages.Count; i++)
                    {
                        target = _otherStorages[i][id];
                        if (target != null)
                        {
                            break;
                        }
                    }
                }

                return(target);
            }
        }