Пример #1
0
        private void backtrackToModelToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Subfile s = treeNodesAndSubfiles[FileTree.SelectedNode];

            s.Load();
            backtrackSubfile(s);
        }
Пример #2
0
        private void replaceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            Subfile s = treeNodesAndSubfiles[FileTree.SelectedNode];

            s.Load();

            openFileDialog1.Title           = "Replace " + s.filename;
            openFileDialog1.Filter          = "All files (*.*)|*.*";
            openFileDialog1.CheckFileExists = true;
            openFileDialog1.CheckPathExists = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                s.filebytes = File.ReadAllBytes(openFileDialog1.FileName);
            }
        }
Пример #3
0
        private void exportAllContextMenuStripButton_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.Title           = "Select destination folder";
            saveFileDialog1.FileName        = "Save here";
            saveFileDialog1.CheckPathExists = false;
            saveFileDialog1.CheckFileExists = false;
            saveFileDialog1.Filter          = "Directory |directory";

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                foreach (TreeNode node in FileTree.Nodes[0].Nodes)
                {
                    bool    was_loaded_already = false;
                    Subfile target             = treeNodesAndSubfiles[node];

                    if (target.filebytes == null || target.filebytes.Length == 0)
                    {
                        target.Load();
                    }
                    else
                    {
                        was_loaded_already = true;
                    }

                    target.ExportFile(true, Path.Combine(Path.GetDirectoryName(saveFileDialog1.FileName), target.filename));

                    if (!was_loaded_already)
                    {
                        target.Unload();
                    }
                }
            }

            MessageBox.Show("Export complete.");
        }