Exemplo n.º 1
0
        /// <summary>
        /// Opens hex editor on row double click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dataGridResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView dgv = sender as DataGridView;
            DataRowView  drv = dgv.Rows[e.RowIndex].DataBoundItem as DataRowView;

            FileInfoData.FileInfoRow fir = drv.Row as FileInfoData.FileInfoRow;

            HexEditor he = new HexEditor();

            NTFS.FileStreams FS = new NTFS.FileStreams(fir.File_Name);

            foreach (NTFS.StreamInfo s in FS)
            {
                if (s.Name == fir.Stream_Name)
                {
                    using (FileStream fs = s.Open(FileMode.Open))
                    {
                        if (fs == null)
                        {
                            MessageBox.Show("Accessing acquired file failed, " +
                                            "maybe you have insufficient rights or the file is in use.",
                                            "Access failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }

                        he.labelFileName.Text             = fir.File_Name;
                        he.labelStreamName.Text           = fir.Stream_Name;
                        he.fileStream                     = fs;
                        he.hexBoxFileContent.ByteProvider = new DynamicFileByteProvider(fs);
                        he.ShowDialog();
                    }
                }
            }

            he.Dispose();
            he = null;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Opens hex editor on row double click.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dataGridResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView dgv = sender as DataGridView;
            DataRowView drv = dgv.Rows[e.RowIndex].DataBoundItem as DataRowView;
            FileInfoData.FileInfoRow fir = drv.Row as FileInfoData.FileInfoRow;

            HexEditor he = new HexEditor();

            NTFS.FileStreams FS = new NTFS.FileStreams(fir.File_Name);

            foreach (NTFS.StreamInfo s in FS)
            {
                if (s.Name == fir.Stream_Name)
                {
                    using (FileStream fs = s.Open(FileMode.Open))
                    {
                        if (fs == null)
                        {
                            MessageBox.Show("Accessing acquired file failed, " +
                                "maybe you have insufficient rights or the file is in use.",
                                "Access failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }

                        he.labelFileName.Text = fir.File_Name;
                        he.labelStreamName.Text = fir.Stream_Name;
                        he.fileStream = fs;
                        he.hexBoxFileContent.ByteProvider = new DynamicFileByteProvider(fs);
                        he.ShowDialog();
                    }
                }
            }

            he.Dispose();
            he = null;
        }