public String GetLoaderNameForResource(String resourceName)
{
ResourceLoader resourceLoader;
/*
* loop through our loaders...
*/
for(int i = 0; i < resourceLoaders.Count; i++)
{
resourceLoader = (ResourceLoader) resourceLoaders[i];
Stream input = null;
// if we find one that can provide the resource,
// return the name of the loaders's Class
try
{
input = resourceLoader.GetResourceStream(resourceName);
if (input != null)
{
return resourceLoader.GetType().ToString();
}
}
catch(ResourceNotFoundException)
{
// this isn't a problem. keep going
}
finally
{
// if we did find one, clean up because we were
// returned an open stream
if (input != null)
{
try
{
input.Close();
}
catch(IOException)
{
}
}
}
}
return null;
}