private void ts_open_Click(object sender, EventArgs e) { OpenFileDialog diag = new OpenFileDialog(); diag.InitialDirectory = path; diag.Title = "Open XBB Files ..."; diag.Filter = "XBB files (*.xbb, *.bin) | *.xbb; *.bin|All Files|*.*"; if (diag.ShowDialog() != DialogResult.OK) { return; } path = Path.GetFullPath(diag.FileName); xbbFile = null; GC.Collect(); FileStream _FileTemp = new FileStream(diag.FileName, FileMode.Open); BinaryReader _binaryread = new BinaryReader(_FileTemp); xbbFile = new xbb(); xbbFile.Load(_binaryread.ReadBytes((int)_FileTemp.Length)); _binaryread.Close(); _FileTemp.Close(); tlb_files.Text = xbbFile.getCount() + " files"; cb_xbb.Items.Clear(); for (int i = 0; i < xbbFile.getCount(); i++) { cb_xbb.Items.Add(xbbFile.getFileName(i)); } cb_xbb.SelectedIndex = 0; ts_saveas.Enabled = true; ts_unpack.Enabled = true; uxTabControl1.Enabled = true; }
private void formclosing_view(object sender, FormClosingEventArgs e) { xbbFile = null; GC.Collect(); this.Dispose(true); }