C# Class nl.siegmann.epublib.domain.Resources

Afficher le fichier Open project: lanfengqi/EpubLib-Sharp Class Usage Examples

Méthodes publiques

Méthode Description
AddAll ( List resources ) : void

Sets the collection of Resources to the given collection of resources

add ( Resource resource ) : Resource

Adds a resource to the resources. Fixes the resources id and href if necessary.

containsByHref ( string href ) : bool

Whether there exists a resource with the given href

containsId ( string id ) : bool

Whether the map of resources already contains a resource with the given id.

findFirstResourceByMediaType ( Resource>.Dictionary resources, MediaType mediaType ) : Resource

Gets the first resource (random order) with the give mediatype. Useful for looking up the table of contents as it's supposed to be the only resource with NCX mediatype.

findFirstResourceByMediaType ( MediaType mediaType ) : Resource

Gets the first resource (random order) with the give mediatype. Useful for looking up the table of contents as it's supposed to be the only resource with NCX mediatype.

fixResourceId ( Resource resource ) : void

Checks the id of the given resource and changes to a unique identifier if it isn't one already.

getAll ( ) : IEnumerable
getAllHrefs ( ) : IEnumerable
getByHref ( string href ) : Resource

Gets the resource with the given href. If the given href contains a fragmentId then that fragment id will be ignored.

getById ( string id ) : Resource

Gets the resource with the given id.

getByIdOrHref ( string idOrHref ) : Resource

First tries to find a resource with as id the given idOrHref, if that fails it tries to find one with the idOrHref as href.

getResourceMap ( ) : Resource>.Dictionary

The resources that make up this book. Resources can be xhtml pages, images, xml documents, etc.

getResourcesByMediaType ( MediaType mediaType ) : List

All resources that have the given MediaType.

getResourcesByMediaTypes ( MediaType mediaTypes ) : List

All Resources that match any of the given list of MediaTypes

isEmpty ( ) : bool
remove ( string href ) : Resource

Remove the resource with the given href.

set ( List resources ) : void

Sets the collection of Resources to the given collection of resources

size ( ) : int

The number of resources

Private Methods

Méthode Description
createHref ( MediaType mediaType, int counter ) : string
createUniqueResourceId ( Resource resource ) : string

Creates a new resource id that is guarenteed to be unique for this set of Resources

fixResourceHref ( Resource resource ) : void
getResourceItemPrefix ( Resource resource ) : string
makeValidId ( string resourceId, Resource resource ) : string

Check if the id is a valid identifier. if not: prepend with valid identifier

Method Details

AddAll() public méthode

Sets the collection of Resources to the given collection of resources
public AddAll ( List resources ) : void
resources List A map with as keys the resources href and as values the /// Resources
Résultat void

add() public méthode

Adds a resource to the resources. Fixes the resources id and href if necessary.
public add ( Resource resource ) : Resource
resource Resource
Résultat Resource

containsByHref() public méthode

Whether there exists a resource with the given href
public containsByHref ( string href ) : bool
href string
Résultat bool

containsId() public méthode

Whether the map of resources already contains a resource with the given id.
public containsId ( string id ) : bool
id string
Résultat bool

findFirstResourceByMediaType() public static méthode

Gets the first resource (random order) with the give mediatype. Useful for looking up the table of contents as it's supposed to be the only resource with NCX mediatype.
public static findFirstResourceByMediaType ( Resource>.Dictionary resources, MediaType mediaType ) : Resource
resources Resource>.Dictionary
mediaType MediaType
Résultat Resource

findFirstResourceByMediaType() public méthode

Gets the first resource (random order) with the give mediatype. Useful for looking up the table of contents as it's supposed to be the only resource with NCX mediatype.
public findFirstResourceByMediaType ( MediaType mediaType ) : Resource
mediaType MediaType
Résultat Resource

fixResourceId() public méthode

Checks the id of the given resource and changes to a unique identifier if it isn't one already.
public fixResourceId ( Resource resource ) : void
resource Resource resource
Résultat void

getAll() public méthode

public getAll ( ) : IEnumerable
Résultat IEnumerable

getAllHrefs() public méthode

public getAllHrefs ( ) : IEnumerable
Résultat IEnumerable

getByHref() public méthode

Gets the resource with the given href. If the given href contains a fragmentId then that fragment id will be ignored.
public getByHref ( string href ) : Resource
href string
Résultat Resource

getById() public méthode

Gets the resource with the given id.
public getById ( string id ) : Resource
id string
Résultat Resource

getByIdOrHref() public méthode

First tries to find a resource with as id the given idOrHref, if that fails it tries to find one with the idOrHref as href.
public getByIdOrHref ( string idOrHref ) : Resource
idOrHref string
Résultat Resource

getResourceMap() public méthode

The resources that make up this book. Resources can be xhtml pages, images, xml documents, etc.
public getResourceMap ( ) : Resource>.Dictionary
Résultat Resource>.Dictionary

getResourcesByMediaType() public méthode

All resources that have the given MediaType.
public getResourcesByMediaType ( MediaType mediaType ) : List
mediaType MediaType
Résultat List

getResourcesByMediaTypes() public méthode

All Resources that match any of the given list of MediaTypes
public getResourcesByMediaTypes ( MediaType mediaTypes ) : List
mediaTypes MediaType
Résultat List

isEmpty() public méthode

public isEmpty ( ) : bool
Résultat bool

remove() public méthode

Remove the resource with the given href.
public remove ( string href ) : Resource
href string
Résultat Resource

set() public méthode

Sets the collection of Resources to the given collection of resources
public set ( List resources ) : void
resources List resources
Résultat void

size() public méthode

The number of resources
public size ( ) : int
Résultat int