示例#1
0
        /// <summary>
        /// Returns custom object for specified key
        /// </summary>
        public T GetCustomObject <T>(Guid pluginGuid) where T : class, ILayerMetadataBase
        {
            if (_rawObjects.ContainsKey(pluginGuid))
            {
                XmlElement el = _rawObjects[pluginGuid];

                var o = XmlSerializationHelper.DeserializeXmlElement <T>(el);
                if (o != null)
                {
                    _rawObjects.Remove(pluginGuid);
                    _customObjects[pluginGuid] = o;
                    return(o);
                }
            }

            if (_customObjects.ContainsKey(pluginGuid))
            {
                return(_customObjects[pluginGuid] as T);
            }

            return(default(T));
        }