Example #1
0
        //open file
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int BytesRead = 0;
            var ofd       = new OpenFileDialog();

            ofd.ShowDialog();

            if (ofd.FileName != "")
            {
                FileStream fs = File.OpenRead(ofd.FileName);
                var        br = new BinaryReader(fs);

                fileLength      = (int)fs.Length; // This limits the maximum file size to ~2GB due to maxint
                fileBufferArray = new byte[fileLength];
                var fpb = new FrmProgressBar("loading file...");
                fpb.MdiParent = this;
                fpb.Start(0, fileLength);
                fpb.Show();
                while (BytesRead < fileLength)
                {
                    fileBufferArray[BytesRead] = br.ReadByte();
                    if (BytesRead % 10000 == 0)
                    {
                        fpb.Update(BytesRead);
                        Application.DoEvents();
                    }
                    BytesRead++;
                }
                fpb.Close();
                br.Close();
                Text = "BinVis " + ofd.FileName;

                //FrmFrequency.calcFrequency(fileLength, ref byteCount, ref fileBufferArray, ref frequency);
                globalFrmFrequency.calcFrequency(fileLength, ref byteCount, ref fileBufferArray, ref frequency, this);
                processMemory.Process(fileLength, ref fileBufferArray);
                globalFrmNavigator.init(fileLength, ref fileBufferArray);
                globalFrmNavigator.MdiParent = this;
                globalFrmNavigator.Show();
            }
        }
Example #2
0
        //open file
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int BytesRead = 0;
            var ofd = new OpenFileDialog();
            ofd.ShowDialog();

            if (ofd.FileName != "")
            {
                FileStream fs = File.OpenRead(ofd.FileName);
                var br = new BinaryReader(fs);

                fileLength = (int) fs.Length; // This limits the maximum file size to ~2GB due to maxint
                fileBufferArray = new byte[fileLength];
                var fpb = new FrmProgressBar("loading file...");
                fpb.MdiParent = this;
                fpb.Start(0, fileLength);
                fpb.Show();
                while (BytesRead < fileLength)
                {
                    fileBufferArray[BytesRead] = br.ReadByte();
                    if (BytesRead%10000 == 0)
                    {
                        fpb.Update(BytesRead);
                        Application.DoEvents();
                    }
                    BytesRead++;
                }
                fpb.Close();
                br.Close();
                Text = "BinVis " + ofd.FileName;

                //FrmFrequency.calcFrequency(fileLength, ref byteCount, ref fileBufferArray, ref frequency);
                globalFrmFrequency.calcFrequency(fileLength, ref byteCount, ref fileBufferArray, ref frequency, this);
                processMemory.Process(fileLength, ref fileBufferArray);
                globalFrmNavigator.init(fileLength, ref fileBufferArray);
                globalFrmNavigator.MdiParent = this;
                globalFrmNavigator.Show();
            }
        }