/// <summary>
        /// Returns the decrypted file's contents using the supplied encryption key.
        /// </summary>
        /// <param name="filename">File to decrypt</param>
        /// <param name="encryptionkey">Encryption key</param>
        /// <returns></returns>
        public static string DecryptFromFile(string filename, string encryptionkey)
        {
            StringBuilder _decrypted = new StringBuilder();
            EdiFile       _edi       = new EdiFile(filename, encryptionkey);

            _edi.Read(); _decrypted.Append(_edi.Contents); _edi.Dispose();
            return(_decrypted.ToString());
        }
        /// <summary>
        /// Encrypts the specified DataTable object's contents into a file using the supplied encryption key.
        /// </summary>
        /// <param name="filename">File path to put in the encrypted contents</param>
        /// <param name="table">DataTable object to encrypt</param>
        /// <param name="encryptionkey">Encryption key</param>
        /// <returns></returns>
        public static FileInfo EncryptToFile(string filename, DataTable table, string encryptionkey)
        {
            FileInfo _file = null;

            EdiFile _edi = new EdiFile(filename, table, encryptionkey);

            _file = _edi.Write(); _edi.Dispose();

            return(_file);
        }
        /// <summary>
        /// Encrypts data retrieved using the specified database connection and command statement into a file using the supplied encryption key.
        /// </summary>
        /// <param name="filename">File path to put in the encrypted contents</param>
        /// <param name="connection">Database connection object</param>
        /// <param name="sql">Database command statement</param>
        /// <param name="encryptionkey">Encryption key</param>
        /// <returns></returns>
        public static FileInfo EncryptToFile(string filename, IDbConnection connection, string sql, string encryptionkey)
        {
            FileInfo _file = null;

            EdiFile _edi = new EdiFile(filename, connection, sql, encryptionkey);

            _file = _edi.Write(); _edi.Dispose();

            return(_file);
        }
        /// <summary>
        /// Encrypts the specified DataTable object's contents into a file using the supplied encryption key.
        /// </summary>
        /// <param name="filename">File path to put in the encrypted contents</param>
        /// <param name="table">DataTable object to encrypt</param>
        /// <param name="encryptionkey">Encryption key</param>
        /// <returns>System.IO.FileInfo object that corresponds the encrypted file's information. Returns nothing if encryption process fails.</returns>
        public static FileInfo EncryptToFile(string filename, DataTable table, string encryptionkey)
        {
            FileInfo _file = null;

            EdiFile _edi = new EdiFile(filename, table, encryptionkey);
            _file = _edi.Write(); _edi.Dispose();

            return _file;
        }
        /// <summary>
        /// Encrypts data retrieved using the specified database connection and command statement into a file using the supplied encryption key.
        /// </summary>
        /// <param name="filename">File path to put in the encrypted contents</param>
        /// <param name="connection">Database connection object</param>
        /// <param name="sql">Database command statement</param>
        /// <param name="encryptionkey">Encryption key</param>
        /// <returns>System.IO.FileInfo object that corresponds the encrypted file's information. Returns nothing if encryption process fails.</returns>
        public static FileInfo EncryptToFile(string filename, IDbConnection connection, string sql, string encryptionkey)
        {
            FileInfo _file = null;

            EdiFile _edi = new EdiFile(filename, connection, sql, encryptionkey);
            _file = _edi.Write(); _edi.Dispose();

            return _file;
        }
 /// <summary>
 /// Gets the decrypted file's contents using the supplied encryption key.
 /// </summary>
 /// <param name="filename">File to decrypt</param>
 /// <param name="encryptionkey">Encryption key</param>
 /// <returns>Decrypted file's contents. Returns an empty string if decryption process fails.</returns>
 public static string DecryptFromFile(string filename, string encryptionkey)
 {
     StringBuilder _decrypted = new StringBuilder();
     EdiFile _edi = new EdiFile(filename, encryptionkey);
     _edi.Read(); _decrypted.Append(_edi.Contents); _edi.Dispose();
     return _decrypted.ToString();
 }