/// <summary> /// registers a new resource in collection /// </summary> public void Register(string name, ResourceBase resource, bool replaceIfExists = true) { if (replaceIfExists) Resources.AddOrUpdate(name, resource, (key, res) => resource); else if (!Resources.TryAdd(name, resource)) throw new InvalidOperationException("name already registered"); }
/// <summary> /// registers a new resource in collection /// </summary> public void Register(string name, ResourceBase resource, bool replaceIfExists = true) { if (replaceIfExists) { Resources.AddOrUpdate(name, resource, (key, res) => resource); } else if (!Resources.TryAdd(name, resource)) { throw new InvalidOperationException("name already registered"); } }
/// <summary> /// Adds the resource and checks name conflicts. /// </summary> private void AddRequiredResourceCore(string name, ResourceBase resource) { ResourceBase originalResource; if (requiredResources.TryGetValue(name, out originalResource)) { if (originalResource.Url != resource.Url) { ThrowNonUniqueName(name); } } else { foreach (var dep in resource.Dependencies) { AddRequiredResource(dep); } requiredResourcesOrdered.Add(name); requiredResources[name] = resource; } }
public virtual bool Predicate(string name, ResourceBase resource) => true;
public override bool Predicate(string name, ResourceBase resource) => BundleInverseIndex.ContainsKey(name);
public NamedResource(string name, ResourceBase resource) { Name = name; Resource = resource; }
private void AddRequiredResourceCore(ResourceBase resource) => AddRequiredResourceCore("__noname_" + nonameCtr++, resource);