internal static void RemoveResource(IResource toRemove)
 {
     ResourceByName.Remove(toRemove.Name);
     ResourceByType.Remove(toRemove.Type);
     ReloadResourceFinder();
     UpdateConfiguration();
 }
Example #2
0
        internal bool RemoveResource(IResource toRemove)
        {
            var r = ResourceByName.Remove(toRemove.Name);

            ResourceByType.Remove(toRemove.Type);
            ReloadResourceFinder();
            RootAccess.Load();
            return(r);
        }
Example #3
0
 public void Clear()
 {
     ResourceFinder.Clear();
     ResourceByName.Clear();
     ResourceByType.Clear();
 }
Example #4
0
 /// <summary>
 /// Gets the terminal resource for a given type or null if there is no such resource
 /// </summary>
 public ITerminalResource <T> SafeGetTerminalResource <T>() where T : Terminal => ResourceByType.SafeGet(typeof(T)) as ITerminalResource <T>;
Example #5
0
 /// <summary>
 /// Gets the terminal resource for a given type, and throws an UnknownResource exception
 /// if there is no such resource
 /// </summary>
 public ITerminalResource <T> GetTerminalResource <T>() where T : Terminal => ResourceByType.SafeGet(typeof(T)) as ITerminalResource <T>
 ?? throw new UnknownResource(typeof(T).GetRESTableTypeName());
Example #6
0
 /// <summary>
 /// Gets the terminal resource for a given type or null if there is no such resource
 /// </summary>
 public IResource <T> SafeGetResource <T>() where T : class => ResourceByType.SafeGet(typeof(T)) as IResource <T>;
Example #7
0
 /// <summary>
 /// Gets the terminal resource for a given type, and throws an UnknownResource exception
 /// if there is no such resource
 /// </summary>
 public IResource <T> GetResource <T>() where T : class => ResourceByType.SafeGet(typeof(T)) as IResource <T>
 ?? throw new UnknownResource(typeof(T).GetRESTableTypeName());
Example #8
0
 /// <summary>
 /// Gets the resource for a given type or returns null if there is no such resource
 /// </summary>
 public IResource SafeGetResource(Type type) => ResourceByType.SafeGet(type);
Example #9
0
 /// Gets the resource for a given type, or throws an UnknownResource exception if there is no such resource
 /// </summary>
 public IResource GetResource(Type type) => ResourceByType.SafeGet(type) ?? throw new UnknownResource(type.GetRESTableTypeName());