Ejemplo n.º 1
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            ResetData();

            ISurrogateProvider surrogateProvider = treeView1.SelectedNode as ISurrogateProvider;

            if (surrogateProvider == null)
            {
                return;
            }


            object surrogate = surrogateProvider.SurrogateObject;

            propertyGrid1.SelectedObject = surrogate;

            if (surrogate is IDataSurrogate)
            {
                FileDataNode node = treeView1.SelectedNode as FileDataNode;
                ShowHexPanel(surrogate as IDataSurrogate, node.GetFileOffset() + node.GetHeaderSize());
            }

            if (surrogate is IImageSurrogate)
            {
                ShowImageData(surrogate as IImageSurrogate);
            }
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            FileDataNode node = treeView1.SelectedNode as FileDataNode;

            if (node != null)
            {
                IDataSurrogate dataSurrogate = node.SurrogateObject as IDataSurrogate;
                int            offset        = node.GetFileOffset() + node.GetHeaderSize();
                ShowHexData(dataSurrogate, offset);
            }

            button1.Visible = false;
        }
Ejemplo n.º 3
0
        private void SaveFile(string path)
        {
            if (treeView1.Nodes.Count == 0 || !(treeView1.Nodes[0] is FileDataNode))
            {
                return;
            }

            FileDataNode node = treeView1.Nodes[0] as FileDataNode;

            node.Export(path);

            _Path = path;
            Text  = string.Format("{0} - {1}", _Title, path);
        }
Ejemplo n.º 4
0
        private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeView1.Nodes.Count == 0 || !(treeView1.Nodes[0] is FileDataNode))
            {
                return;
            }

            FileDataNode node = treeView1.Nodes[0] as FileDataNode;

            saveFileDialog1.FileName = node.Text;
            if (saveFileDialog1.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            SaveFile(saveFileDialog1.FileName);
        }