internal static IResourceProvider GetResourceProvider (string virtualPath, bool isLocal)
{
if (!EnsureProviderFactory ())
return null;
// TODO: check if it makes sense to cache the providers and, if yes, maybe
// we should expire the entries (or just store them in InternalCache?)
IResourceProvider rp = null;
if (!resource_providers.TryGetValue (virtualPath, out rp)) {
if (isLocal)
rp = provider_factory.CreateLocalResourceProvider (virtualPath);
else
rp = provider_factory.CreateGlobalResourceProvider (virtualPath);
if (rp == null) {
if (isLocal)
rp = DefaultProviderFactory.CreateLocalResourceProvider (virtualPath);
else
rp = DefaultProviderFactory.CreateGlobalResourceProvider (virtualPath);
if (rp == null)
return null;
}
resource_providers.Add (virtualPath, rp);
}
return rp;
}