C# Класс CmisSync.Lib.Cmis.Database

Database to cache remote information from the CMIS server. Implemented with SQLite.
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
AddFile ( string path, System.DateTime serverSideModificationDate, string[]>.Dictionary metadata, byte filehash ) : void

Add a file to the database. If checksum is not null, it will be used for the database entry

AddFolder ( string path, System.DateTime serverSideModificationDate ) : void

Add a folder to the database.

ContainsFile ( string path ) : bool

Checks whether the database contains a given file.

ContainsFolder ( string path ) : bool

Checks whether the database contains a given folder.

Database ( string dataPath ) : System

Constructor.

Dispose ( ) : void

Implement IDisposable interface.

GetChangeLogToken ( ) : string

Get the ChangeLog token that was stored at the end of the last successful CmisSync synchronization.

GetSQLiteConnection ( ) : SQLiteConnection

Connection to the database. The sqliteConnection must not be used directly, used this method instead.

GetServerSideModificationDate ( string path ) : DateTime?

Get the time at which the file was last modified. This is the time on the CMIS server side, in UTC. Client-side time does not matter.

LocalFileHasChanged ( string path ) : bool

Check whether a file's content has changed locally since it was last synchronized. This happens when the user edits a file on the local computer. This method does not communicate with the CMIS server, it just checks whether the checksum has changed.

MoveFile ( string oldPath, string newPath ) : void

Move a file.

MoveFolder ( string oldPath, string newPath ) : void

Move a folder.

RecalculateChecksum ( string path ) : void

Recalculate the checksum of a file and save it to database.

RemoveFile ( string path ) : void

Remove a file from the database.

RemoveFolder ( string path ) : void

Remove a folder from the database.

SetChangeLogToken ( string token ) : void

Set the stored ChangeLog token. This should be called after each successful CmisSync synchronization.

SetFileServerSideModificationDate ( string path, DateTime serverSideModificationDate ) : void

Set the last modification date of a file. This is the time on the CMIS server side, in UTC. Client-side time does not matter. TODO Combine this method and the next in a new method ModifyFile, and find out if GetServerSideModificationDate is really needed.

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

Метод Описание
Dispose ( bool disposing ) : void

Dispose pattern implementation.

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

Метод Описание
AddFile ( string path, System.DateTime serverSideModificationDate, string[]>.Dictionary metadata ) : void
Checksum ( string filePath ) : string

Calculate the SHA1 checksum of a file. Code from http://stackoverflow.com/a/1993919/226958

ChecksumToString ( byte hash ) : string

Transforms a given hash into a string

ComposeSQLCommand ( SQLiteCommand command, string text, object>.Dictionary parameters ) : void

Helper method to fill the parameters inside an SQL command.

ExecuteSQLAction ( string text, object>.Dictionary parameters ) : void

Helper method to execute an SQL command that does not return anything.

ExecuteSQLFunction ( string text, object>.Dictionary parameters ) : object

Helper method to execute an SQL command that returns something.

Json ( string[]>.Dictionary dictionary ) : string

Put all the values of a dictionary into a JSON string.

Normalize ( string path ) : string

Normalize a path. All paths stored in database must be normalized. Goals: - Make data smaller in database - Reduce OS-specific differences

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

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

Add a file to the database. If checksum is not null, it will be used for the database entry
public AddFile ( string path, System.DateTime serverSideModificationDate, string[]>.Dictionary metadata, byte filehash ) : void
path string
serverSideModificationDate System.DateTime
metadata string[]>.Dictionary
filehash byte
Результат void

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

Add a folder to the database.
public AddFolder ( string path, System.DateTime serverSideModificationDate ) : void
path string
serverSideModificationDate System.DateTime
Результат void

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

Checks whether the database contains a given file.
public ContainsFile ( string path ) : bool
path string
Результат bool

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

Checks whether the database contains a given folder.
public ContainsFolder ( string path ) : bool
path string
Результат bool

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

Constructor.
public Database ( string dataPath ) : System
dataPath string
Результат System

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

Implement IDisposable interface.
public Dispose ( ) : void
Результат void

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

Dispose pattern implementation.
protected Dispose ( bool disposing ) : void
disposing bool
Результат void

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

Get the ChangeLog token that was stored at the end of the last successful CmisSync synchronization.
public GetChangeLogToken ( ) : string
Результат string

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

Connection to the database. The sqliteConnection must not be used directly, used this method instead.
public GetSQLiteConnection ( ) : SQLiteConnection
Результат SQLiteConnection

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

Get the time at which the file was last modified. This is the time on the CMIS server side, in UTC. Client-side time does not matter.
public GetServerSideModificationDate ( string path ) : DateTime?
path string
Результат DateTime?

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

Check whether a file's content has changed locally since it was last synchronized. This happens when the user edits a file on the local computer. This method does not communicate with the CMIS server, it just checks whether the checksum has changed.
public LocalFileHasChanged ( string path ) : bool
path string
Результат bool

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

Move a file.
public MoveFile ( string oldPath, string newPath ) : void
oldPath string
newPath string
Результат void

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

Move a folder.
public MoveFolder ( string oldPath, string newPath ) : void
oldPath string
newPath string
Результат void

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

Recalculate the checksum of a file and save it to database.
public RecalculateChecksum ( string path ) : void
path string
Результат void

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

Remove a file from the database.
public RemoveFile ( string path ) : void
path string
Результат void

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

Remove a folder from the database.
public RemoveFolder ( string path ) : void
path string
Результат void

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

Set the stored ChangeLog token. This should be called after each successful CmisSync synchronization.
public SetChangeLogToken ( string token ) : void
token string
Результат void

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

Set the last modification date of a file. This is the time on the CMIS server side, in UTC. Client-side time does not matter. TODO Combine this method and the next in a new method ModifyFile, and find out if GetServerSideModificationDate is really needed.
public SetFileServerSideModificationDate ( string path, DateTime serverSideModificationDate ) : void
path string
serverSideModificationDate DateTime
Результат void