Esempio n. 1
0
        private Stream CreateResourceFromUri(CustomUri resourcex, String path)
        {
            if (resourcex == null)
            {
                throw new ArgumentNullException("resourcex");
            }

            assemblyName = resourcex.Host;
            resourcePath = ConvertToResourceName(assemblyName, resourcex.Path);

            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(CultureInfo.InvariantCulture, "The assembly resource {0} could not be located", resourcePath);
                throw new ResourceException(message);
            }

            basePath = ConvertToPath(resourcePath);

            return(assembly.GetManifestResourceStream(nameFound));
        }
Esempio n. 2
0
 public AssemblyResource(CustomUri resource, String basePath)
 {
     CreateStream = delegate
     {
         return(CreateResourceFromUri(resource, basePath));
     };
 }
Esempio n. 3
0
 public AssemblyResource(CustomUri resource)
 {
     CreateStream = delegate
     {
         return(CreateResourceFromUri(resource, null));
     };
 }
Esempio n. 4
0
        public IResource Create(CustomUri uri, String basePath)
        {
            if (basePath == null)
            {
                return(new AssemblyResource(uri));
            }

            return(new AssemblyResource(uri, basePath));
        }
 public IResource Create(CustomUri uri, String basePath)
 {
     if (basePath != null)
     {
         return(new FileResource(uri, basePath));
     }
     else
     {
         return(new FileResource(uri));
     }
 }
Esempio n. 6
0
        private Stream CreateStreamFromUri(CustomUri resource, String rootPath)
        {
            if (resource == null)
            {
                throw new ArgumentNullException("resource");
            }
            if (rootPath == null)
            {
                throw new ArgumentNullException("rootPath");
            }

            if (!resource.IsFile)
            {
                throw new ArgumentException("The specified resource is not a file", "resource");
            }

            return(CreateStreamFromPath(resource.Path, rootPath));
        }
 public IResource Create(CustomUri uri, String basePath)
 {
     return(Create(uri));
 }
 public IResource Create(CustomUri uri)
 {
     return(new ConfigResource(uri));
 }
 public bool Accept(CustomUri uri)
 {
     return("config".Equals(uri.Scheme));
 }
Esempio n. 10
0
 public IResource Create(CustomUri uri, String basePath)
 {
     return(new UncResource(uri, basePath));
 }
Esempio n. 11
0
 public IResource Create(CustomUri uri)
 {
     return(new UncResource(uri));
 }
Esempio n. 12
0
 public bool Accept(CustomUri uri)
 {
     return(uri.IsUnc);
 }
Esempio n. 13
0
 public IResource Create(CustomUri uri)
 {
     return(Create(uri, null));
 }
Esempio n. 14
0
 public bool Accept(CustomUri uri)
 {
     return("assembly".Equals(uri.Scheme));
 }
Esempio n. 15
0
 public ConfigResource(CustomUri uri) : this(uri.Host)
 {
 }
Esempio n. 16
0
 public AssemblyBundleResource(CustomUri resource)
 {
     this.resource = resource;
 }