Be.Windows.Forms.DynamicFileByteProvider.Dispose C# (CSharp) Метод

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

See IDisposable.Dispose for more information.
public Dispose ( ) : void
Результат void
        public void Dispose()
        {
            if (_stream != null)
            {
                _stream.Close();
                _stream = null;
            }
            _fileName = null;
            _dataMap = null;
            GC.SuppressFinalize(this);
        }

Usage Example

Пример #1
0
        private void btnLoadFrom_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            DialogResult   res = dlg.ShowDialog(this);

            if (res == DialogResult.Cancel)
            {
                return;
            }
            string fpath = dlg.FileName;

            FileInfo fi = new FileInfo(fpath);

            if (fi.Length > MAX_BLOB_FILESIZE_MB * 1000 * 1024)
            {
                res = MessageBox.Show(this,
                                      "SQLite does not handle BLOBs larger than " + MAX_BLOB_FILESIZE_MB + "MB very well.\r\n" +
                                      "It is highly recommended that you don't add such large BLOB\r\n" +
                                      "fields into the database due to performance reasons.\r\n" +
                                      "Do you want to abort the operation?",
                                      "Warning",
                                      MessageBoxButtons.YesNo,
                                      MessageBoxIcon.Warning);
                if (res == DialogResult.Yes)
                {
                    return;
                }
            }

            if (_blobProvider != null)
            {
                Be.Windows.Forms.DynamicFileByteProvider dp = _blobProvider as Be.Windows.Forms.DynamicFileByteProvider;
                if (dp != null)
                {
                    dp.Dispose();
                }
            }

            try
            {
                // Copy the file to the temporary BLOB file
                if (File.Exists(Configuration.TempBlobFilePath))
                {
                    File.Delete(Configuration.TempBlobFilePath);
                }
                File.Copy(fpath, Configuration.TempBlobFilePath);
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Internal Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            } // catch

            _blobProvider            = new DynamicFileByteProvider(Configuration.TempBlobFilePath);
            ucHexEditor.ByteProvider = _blobProvider;
            lblBlobSize.Text         = "Blob contains " + Utils.FormatMemSize(fi.Length, MemFormat.KB);
        }
All Usage Examples Of Be.Windows.Forms.DynamicFileByteProvider::Dispose