예제 #1
0
 /// <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");
 }
예제 #2
0
 /// <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");
     }
 }
예제 #3
0
 /// <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;
     }
 }
예제 #4
0
        /// <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;
            }
        }
예제 #5
0
 public virtual bool Predicate(string name, ResourceBase resource) => true;
예제 #6
0
 public override bool Predicate(string name, ResourceBase resource)
 => BundleInverseIndex.ContainsKey(name);
예제 #7
0
 public NamedResource(string name, ResourceBase resource)
 {
     Name     = name;
     Resource = resource;
 }
예제 #8
0
 public virtual bool Predicate(string name, ResourceBase resource) => true;
예제 #9
0
 private void AddRequiredResourceCore(ResourceBase resource) => AddRequiredResourceCore("__noname_" + nonameCtr++, resource);
예제 #10
0
 private void AddRequiredResourceCore(ResourceBase resource) => AddRequiredResourceCore("__noname_" + nonameCtr++, resource);
예제 #11
0
 public override bool Predicate(string name, ResourceBase resource)
     => BundleInverseIndex.ContainsKey(name);