private Stream CreateResourceFromUri(CustomUri resourcex, String basePath)
{
if (resourcex == null) throw new ArgumentNullException("resourcex");
assemblyName = resourcex.Host;
resourcePath = ConvertToResourceName(assemblyName, resourcex.Path, basePath);
Assembly assembly = ObtainAssembly(assemblyName);
String[] names = assembly.GetManifestResourceNames();
String nameFound = GetNameFound(names);
if (nameFound == null)
{
resourcePath = resourcex.Path.Replace('/', '.').Substring(1);
nameFound = GetNameFound(names);
}
if (nameFound == null)
{
String message = String.Format("The assembly resource {0} could not be located", resourcePath);
throw new ResourceException(message);
}
this.basePath = ConvertToPath(resourcePath);
return assembly.GetManifestResourceStream(nameFound);
}