private void ButtonAddFiles_Click(object sender, EventArgs e)
        {
            OpenFileDialog OpenFileDialogObject = new OpenFileDialog
            {
                Multiselect = true,
                Filter      = "Multimedia Files(*.BMP;*.JPG;*.GIF;*.JPEG;*.PNG;*.MP3;*.WAW;*.WMA;*.FLAC)|*.BMP;*.JPG;*.GIF;*.JPEG;*.PNG;*.MP3;*.WAW;*.WMA;*.FLAC",
            };

            if (OpenFileDialogObject.ShowDialog() == DialogResult.OK)
            {
                if (this.DigitalContainerObject == null)
                {
                    this.DigitalContainerObject = new DigitalContainer();
                }
                String[] FIleNames = OpenFileDialogObject.FileNames;
                foreach (String FileName in FIleNames)
                {
                    try
                    {
                        FileDetails File = new FileDetails(FileName);
                        this.DigitalContainerObject.InsertFileInContainer(File);
                        ListViewItem listViewItem = new ListViewItem(File.GetFileName());
                        listViewItem.SubItems.Add(File.GetFileSize() + "");
                        this.ListViewFilesToEncode.Items.Add(listViewItem);
                    }
                    catch (Exception Ex)
                    {
                        MessageBox.Show(Ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            OpenFileDialogObject.Dispose();
        }
 private void ClearDigitalContainer()
 {
     if (this.DigitalContainerObject != null)
     {
         this.DigitalContainerObject.GetFiles().Clear();
         this.DigitalContainerObject = null;
         this.SavedContainerFileName = null;
         this.ListViewFilesToEncode.Items.Clear();
         this.ListViewFilesInsideContainer.Items.Clear();
         GC.Collect();
         GC.WaitForFullGCApproach();
     }
 }
        private void ButtonOpenContainer_Click(object sender, EventArgs e)
        {
            this.ClearDigitalContainer();
            OpenFileDialog OpenFileDialogObject = new OpenFileDialog
            {
                Multiselect = false,
                DefaultExt  = ".dc",
                Filter      = "Digital Container Files (*.dc)|*.dc",
            };

            if (OpenFileDialogObject.ShowDialog() == DialogResult.OK)
            {
                this.SavedContainerFileName = OpenFileDialogObject.FileName;
                this.DigitalContainerObject = new DigitalContainer(OpenFileDialogObject.FileName);
                foreach (KeyValuePair <String, FileDetails> Pair in this.DigitalContainerObject.GetFiles())
                {
                    ListViewItem listViewItem = new ListViewItem(Pair.Value.GetFileName());
                    listViewItem.SubItems.Add(Pair.Value.GetFileSize() + "");
                    listViewItem.SubItems.Add(Pair.Value.GetFileOffset() + "");
                    this.ListViewFilesInsideContainer.Items.Add(listViewItem);
                }
                MessageBox.Show("Container Loaded!", "Information!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 private void MainForm_Load(object sender, EventArgs e)
 {
     this.DigitalContainerObject = null;
     this.SavedContainerFileName = null;
 }