C# Класс SQLServerFileSystemTools, SQL-Server-File-System-Tools

Tools for working with files and SQL Server. Includes storage compression and encryption. This is a set of stored procedures that allow you to store files in a database with the option to compress into a zip compatiable stream or encrypt with Rijndael or both. It can output to the file system compressed or decompressed. it can output to a sql record type decompressed
Показать файл Открыть проект

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

Метод Описание
ExtractFileToDisk ( long fileId, string location ) : void

Retrieves file from database uncompresses and decrypts it if it needs to.

ExtractFileToDiskCompressed ( long fileId, string location ) : void

Retrieves file from database raw compressed form with .zip extention

ExtractFileToDiskEncrypted ( long fileId, string location ) : void

Retrieves file from database raw encrypted form .enc extention

ExtractFileToDiskEncryptedCompressed ( long fileId, string location ) : void

Retrieves file from database raw encrypted and compressed form with .zip.enc extention

ExtractFileToRecord ( long fileId ) : void

Retrieves file from database output to recordset decrypts and decompresses file if needed.

ExtractFileToRecordCompressed ( long fileId ) : void

Retrieves file from database as sql recordset in raw compressed form

ExtractFileToRecordEncrypted ( long fileId ) : void

Retrieves file from database as sql recordset in raw encrypted form

ExtractFileToRecordEncryptedCompressed ( long fileId ) : void

Retrieves file from database as sql recordset in raw encrypted and compressed form

StoreAllFilesInPath ( string filesLocaton, string fileSuffix ) : void

Loads files from a path with filtering * for all flles in directory txt, doc, etc to filter by file type calls Loadfile to store the files in the database unencrypted and uncompressed.

StoreAllFilesInPathCompressed ( string filesLocaton, string fileSuffix, int compressionLevel ) : void

Loads files from a path with filtering * for all flles in directory txt, doc, etc to filter by file type calls Loadfile to store the files in the database unencrypted and compressed.

StoreAllFilesInPathEncrypted ( string filesLocaton, string fileSuffix ) : void

Loads files from a path with filtering * for all flles in directory txt, doc, etc to filter by file type calls Loadfile to store the files in the database encrypted and uncompressed.

StoreAllFilesInPathEncryptedCompressed ( string filesLocaton, string fileSuffix, int compressionLevel ) : void

Loads files from a path with filtering * for all flles in directory txt, doc, etc to filter by file type calls Loadfile to store the files in the database encrypted and compressed.

StoreFileCompressed ( string fileLocation, int compressionLevel, long &returnFileId ) : void

Load file from filesystem into database unencrypted and compressed

StoreFileEncrypted ( string fileLocation, long &returnFileId ) : void

Load file from filesystem into database encrypted and uncompressed

StoreFileEncryptedCompressed ( string fileLocation, int compressionLevel, long &returnFileId ) : void

Load file from filesystem into database encrypted and compressed

StorePassPhrase ( string password ) : void

Hashes and stores a passphrase in the database for encryption/decryption

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

Метод Описание
DecryptStream ( byte dataStream, string password ) : byte[]

Decrypt byte array

EncryptStream ( byte dataStream, string password ) : byte[]

Encrypt byte array

GetFileNameWithPath ( string location, string fileName ) : string

Creates path if it doesn't exists. Deletes any files with same name as output file.

GetMd5Hash ( string input ) : string

Generate 256 bit MD5 hash

RandomASCIIString ( int length ) : string

Generate random ASCII string

StoreFile ( string fileLocation, long &returnFileId ) : void
ZipCompress ( string fileName, int compressionLevel ) : byte[]

Stores incomming data as standard zip file into byte array

ZipDecompress ( byte compressedData, int origionalFileSize ) : byte[]

uncompresses zip data from byte array

xp_getfiledetails ( string filePath ) : void

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

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

Retrieves file from database uncompresses and decrypts it if it needs to.
public static ExtractFileToDisk ( long fileId, string location ) : void
fileId long file id
location string Location to extract to
Результат void

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

Retrieves file from database raw compressed form with .zip extention
public static ExtractFileToDiskCompressed ( long fileId, string location ) : void
fileId long file id
location string Location to extract to
Результат void

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

Retrieves file from database raw encrypted form .enc extention
public static ExtractFileToDiskEncrypted ( long fileId, string location ) : void
fileId long file id
location string Location to extract to
Результат void

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

Retrieves file from database raw encrypted and compressed form with .zip.enc extention
public static ExtractFileToDiskEncryptedCompressed ( long fileId, string location ) : void
fileId long file id
location string Location to extract to
Результат void

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

Retrieves file from database output to recordset decrypts and decompresses file if needed.
public static ExtractFileToRecord ( long fileId ) : void
fileId long file id
Результат void

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

Retrieves file from database as sql recordset in raw compressed form
public static ExtractFileToRecordCompressed ( long fileId ) : void
fileId long file id
Результат void

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

Retrieves file from database as sql recordset in raw encrypted form
public static ExtractFileToRecordEncrypted ( long fileId ) : void
fileId long file id
Результат void

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

Retrieves file from database as sql recordset in raw encrypted and compressed form
public static ExtractFileToRecordEncryptedCompressed ( long fileId ) : void
fileId long file id
Результат void

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

Loads files from a path with filtering * for all flles in directory txt, doc, etc to filter by file type calls Loadfile to store the files in the database unencrypted and uncompressed.
public static StoreAllFilesInPath ( string filesLocaton, string fileSuffix ) : void
filesLocaton string The files locaton.
fileSuffix string The file suffix.
Результат void

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

Loads files from a path with filtering * for all flles in directory txt, doc, etc to filter by file type calls Loadfile to store the files in the database unencrypted and compressed.
public static StoreAllFilesInPathCompressed ( string filesLocaton, string fileSuffix, int compressionLevel ) : void
filesLocaton string The files locaton.
fileSuffix string The file suffix.
compressionLevel int The storetype.
Результат void

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

Loads files from a path with filtering * for all flles in directory txt, doc, etc to filter by file type calls Loadfile to store the files in the database encrypted and uncompressed.
public static StoreAllFilesInPathEncrypted ( string filesLocaton, string fileSuffix ) : void
filesLocaton string The files locaton.
fileSuffix string The file suffix.
Результат void

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

Loads files from a path with filtering * for all flles in directory txt, doc, etc to filter by file type calls Loadfile to store the files in the database encrypted and compressed.
public static StoreAllFilesInPathEncryptedCompressed ( string filesLocaton, string fileSuffix, int compressionLevel ) : void
filesLocaton string The files locaton.
fileSuffix string The file suffix.
compressionLevel int The storetype.
Результат void

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

Load file from filesystem into database unencrypted and compressed
public static StoreFileCompressed ( string fileLocation, int compressionLevel, long &returnFileId ) : void
fileLocation string The files locaton.
compressionLevel int The files locaton.
returnFileId long Return of the inserted FileId
Результат void

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

Load file from filesystem into database encrypted and uncompressed
public static StoreFileEncrypted ( string fileLocation, long &returnFileId ) : void
fileLocation string The files locaton.
returnFileId long Return of the inserted FileId
Результат void

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

Load file from filesystem into database encrypted and compressed
public static StoreFileEncryptedCompressed ( string fileLocation, int compressionLevel, long &returnFileId ) : void
fileLocation string The files locaton.
compressionLevel int The files locaton.
returnFileId long
Результат void

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

Hashes and stores a passphrase in the database for encryption/decryption
public static StorePassPhrase ( string password ) : void
password string Passphrase
Результат void