Esempio n. 1
0
        public Settings(string fileName, bool isCached)
        {
            // Each skin may have its own SkinSettings.xml file so we need to use the entire path to detect a cache hit.
            // Adding a check when plugin send only the filename for mediaportal.xml instead of the full path and filename.
            _xmlFileName = fileName.ToLowerInvariant() == "mediaportal.xml"
        ? Config.GetFile(Config.Dir.Config, "MediaPortal.xml").ToLowerInvariant()
        : Path.GetFullPath(fileName).ToLowerInvariant();

            _isCached = isCached;

            if (_isCached)
            {
                XMLCache.TryGetValue(_xmlFileName, out _xmlDoc);
            }

            if (_xmlDoc == null)
            {
                _xmlDoc = new CacheSettingsProvider(new XmlSettingsProvider(fileName));

                if (_isCached)
                {
                    XMLCache.Add(_xmlFileName, _xmlDoc);
                }
            }
        }
Esempio n. 2
0
        public Settings(string fileName, bool isCached)
        {
            // Each skin may have its own SkinSettings.xml file so we need to use the entire path to detect a cache hit.
            _xmlFileName = Path.GetFullPath(fileName).ToLowerInvariant();

            _isCached = isCached;

            if (_isCached)
            {
                XMLCache.TryGetValue(_xmlFileName, out _xmlDoc);
            }

            if (_xmlDoc == null)
            {
                _xmlDoc = new CacheSettingsProvider(new XmlSettingsProvider(fileName));

                if (_isCached)
                {
                    XMLCache.Add(_xmlFileName, _xmlDoc);
                }
            }
        }