Example #1
0
        public ILayerHandler GetLayerHandlerInstance(string key)
        {
            if (LayerHandlers.ContainsKey(key))
            {
                return(GetLayerHandlerInstance(LayerHandlers[key]));
            }


            return(null);
        }
Example #2
0
        /// <summary>
        /// Manually registers a layer. Only needed externally.
        /// </summary>
        public bool RegisterLayer <T>() where T : ILayerHandler
        {
            var t = typeof(T);

            if (LayerHandlers.ContainsKey(t))
            {
                return(false);
            }
            var meta = t.GetCustomAttribute <LayerHandlerMetaAttribute>() as LayerHandlerMetaAttribute;

            LayerHandlers.Add(t, new LayerHandlerMeta(t, meta));
            return(true);
        }
Example #3
0
        public bool RegisterLayerHandler(LayerHandlerEntry entry, bool @default = true)
        {
            if (LayerHandlers.ContainsKey(entry.Key) || DefaultLayerHandlers.Contains(entry.Key))
            {
                return(false);
            }

            LayerHandlers.Add(entry.Key, entry);

            if (@default)
            {
                DefaultLayerHandlers.Add(entry.Key);
            }

            return(true);
        }
Example #4
0
 public Type GetLayerHandlerType(string key)
 {
     return(LayerHandlers.ContainsKey(key) ? LayerHandlers[key].Type : null);
 }