C# Класс Bloom.Book.BookStorage

Наследование: IBookStorage
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
AssertIsAlreadyInitialized void
AttemptToReplaceMissingImage bool
EnsureDoesntHaveLinkToStyleSheet void
EnsureHasLinkToStyleSheet void
EnsureHasLinksToStylesheets void
ExpensiveInitialization void
GetBaseForRelativePaths string
GetImagePathsRelativeToBook List
GetNameForATempFileInStorageFolder string
GetNormalizedPathForOS string
GetUniqueFolderName string
GetUniqueFolderPath string
IsPathReadonly bool
MakeCssLinksAppropriateForStoredFile void
ProcessAccessDeniedError void
RemoveDangerousCharacters string
SanitizeNameForFileSystem string
Update void
UpdateSupportFiles void
ValidateBook string

Открытые методы

Метод Описание
BookStorage ( string folderPath, SIL baseFileLocator, BookRenamedEvent bookRenamedEvent, CollectionSettings collectionSettings ) : System
CheckBook ( IProgress progress, string pathToFolderOfReplacementImages = null ) : void

The image-replacement feature is perhaps a one-off for a project where an advisor replaced the folders with a version that lacked most of the images (perhaps because dropbox copies small files first and didn't complete the sync)

CleanupUnusedImageFiles ( ) : void

Compare the images we find in the top level of the book folder to those referenced in the dom, and remove any unreferenced on

FindBookHtmlInFolder ( string folderPath ) : string
GetBrokenBookRecommendationHtml ( ) : string
GetFileLocator ( ) : IFileLocator

this is a method because it wasn't clear if we will eventually generate it on the fly (book paths do change as they are renamed)

GetHtmlMessageIfVersionIsIncompatibleWithThisBloom ( HtmlDom dom, string path ) : string
GetLooksOk ( ) : bool
GetRelocatableCopyOfDom ( IProgress log ) : HtmlDom

creates a relocatable copy of our main HtmlDom

GetValidateErrors ( ) : string
HandleRetiredXMatterPacks ( HtmlDom dom, string nameOfXMatterPack ) : string
MakeDomRelocatable ( HtmlDom dom, IProgress log = null ) : HtmlDom

this one works on the dom passed to it

RemoveBookThumbnail ( string fileName ) : bool

Save ( ) : void
SaveHtml ( HtmlDom dom ) : string
SetBaseForRelativePaths ( HtmlDom dom, string folderPath ) : void
SetBookName ( string name ) : void
TryGetPremadeThumbnail ( string fileName, Image &image ) : bool
UpdateBookFileAndFolderName ( CollectionSettings collectionSettings ) : void
ValidateBook ( string path ) : string

Защищенные методы

Метод Описание
OnFolderPathChanged ( ) : void

Приватные методы

Метод Описание
AssertIsAlreadyInitialized ( ) : void
AttemptToReplaceMissingImage ( string missingFile, string pathToFolderOfReplacementImages, IProgress progress ) : bool
EnsureDoesntHaveLinkToStyleSheet ( HtmlDom dom, string path ) : void
EnsureHasLinkToStyleSheet ( HtmlDom dom, string path ) : void
EnsureHasLinksToStylesheets ( HtmlDom dom ) : void
ExpensiveInitialization ( ) : void

Do whatever is needed to do more than just show a title and thumbnail

GetBaseForRelativePaths ( string folderPath ) : string
GetImagePathsRelativeToBook ( XmlElement element ) : List

Return the paths, relative to the book folder, of all the images referred to in the element.

GetNameForATempFileInStorageFolder ( ) : string

Get a temporary file pathname in the current book's folder. This is needed to ensure proper permissions are granted to the resulting file later after FileUtils.ReplaceFileWithUserInteractionIfNeeded is called. That method may call File.Replace which replaces both the file content and the file metadata (permissions). The result of that if we use the user's temp directory is described in http://issues.bloomlibrary.org/youtrack/issue/BL-3954.

GetNormalizedPathForOS ( string path ) : string
GetUniqueFolderName ( string parentPath, string name ) : string

if necessary, append a number to make the subfolder name unique within the given folder

GetUniqueFolderPath ( string folderPath ) : string

if necessary, append a number to make the folder path unique

IsPathReadonly ( string path ) : bool
MakeCssLinksAppropriateForStoredFile ( HtmlDom dom ) : void

/// Creates a relative path from one file or folder to another. ///

ProcessAccessDeniedError ( UnauthorizedAccessException error ) : void
RemoveDangerousCharacters ( string name ) : string
SanitizeNameForFileSystem ( string name ) : string
Update ( string fileName, string factoryPath = "" ) : void
UpdateSupportFiles ( ) : void

we update these so that the file continues to look the same when you just open it in firefox

ValidateBook ( HtmlDom dom, string path ) : string

Описание методов

BookStorage() публичный Метод

public BookStorage ( string folderPath, SIL baseFileLocator, BookRenamedEvent bookRenamedEvent, CollectionSettings collectionSettings ) : System
folderPath string
baseFileLocator SIL
bookRenamedEvent BookRenamedEvent
collectionSettings Bloom.Collection.CollectionSettings
Результат System

CheckBook() публичный Метод

The image-replacement feature is perhaps a one-off for a project where an advisor replaced the folders with a version that lacked most of the images (perhaps because dropbox copies small files first and didn't complete the sync)
public CheckBook ( IProgress progress, string pathToFolderOfReplacementImages = null ) : void
progress IProgress
pathToFolderOfReplacementImages string We'll find any matches in the entire folder, regardless of sub-folder name
Результат void

CleanupUnusedImageFiles() публичный Метод

Compare the images we find in the top level of the book folder to those referenced in the dom, and remove any unreferenced on
public CleanupUnusedImageFiles ( ) : void
Результат void

FindBookHtmlInFolder() публичный статический Метод

public static FindBookHtmlInFolder ( string folderPath ) : string
folderPath string
Результат string

GetBrokenBookRecommendationHtml() публичный Метод

public GetBrokenBookRecommendationHtml ( ) : string
Результат string

GetFileLocator() публичный Метод

this is a method because it wasn't clear if we will eventually generate it on the fly (book paths do change as they are renamed)
public GetFileLocator ( ) : IFileLocator
Результат IFileLocator

GetHtmlMessageIfVersionIsIncompatibleWithThisBloom() публичный статический Метод

public static GetHtmlMessageIfVersionIsIncompatibleWithThisBloom ( HtmlDom dom, string path ) : string
dom HtmlDom
path string
Результат string

GetLooksOk() публичный Метод

public GetLooksOk ( ) : bool
Результат bool

GetRelocatableCopyOfDom() публичный Метод

creates a relocatable copy of our main HtmlDom
public GetRelocatableCopyOfDom ( IProgress log ) : HtmlDom
log IProgress
Результат HtmlDom

GetValidateErrors() публичный Метод

public GetValidateErrors ( ) : string
Результат string

HandleRetiredXMatterPacks() публичный Метод

public HandleRetiredXMatterPacks ( HtmlDom dom, string nameOfXMatterPack ) : string
dom HtmlDom
nameOfXMatterPack string
Результат string

MakeDomRelocatable() публичный Метод

this one works on the dom passed to it
public MakeDomRelocatable ( HtmlDom dom, IProgress log = null ) : HtmlDom
dom HtmlDom
log IProgress
Результат HtmlDom

OnFolderPathChanged() защищенный Метод

protected OnFolderPathChanged ( ) : void
Результат void

RemoveBookThumbnail() публичный Метод

public RemoveBookThumbnail ( string fileName ) : bool
fileName string
Результат bool

Save() публичный Метод

public Save ( ) : void
Результат void

SaveHtml() публичный Метод

public SaveHtml ( HtmlDom dom ) : string
dom HtmlDom
Результат string

SetBaseForRelativePaths() публичный статический Метод

public static SetBaseForRelativePaths ( HtmlDom dom, string folderPath ) : void
dom HtmlDom
folderPath string
Результат void

SetBookName() публичный Метод

public SetBookName ( string name ) : void
name string
Результат void

TryGetPremadeThumbnail() публичный Метод

public TryGetPremadeThumbnail ( string fileName, Image &image ) : bool
fileName string
image Image
Результат bool

UpdateBookFileAndFolderName() публичный Метод

public UpdateBookFileAndFolderName ( CollectionSettings collectionSettings ) : void
collectionSettings Bloom.Collection.CollectionSettings
Результат void

ValidateBook() публичный статический Метод

public static ValidateBook ( string path ) : string
path string
Результат string