Ejemplo n.º 1
0
        private void extractToolStripButton_Click(object sender, EventArgs e)
        {
            if (tvDirs.SelectedNode == null)
            {
                return;
            }

            // Get the selected catalog node from tree node tag
            CCatalogNode node = (CCatalogNode)tvDirs.SelectedNode.Tag;

            if (node == null)
            {
                return;
            }
            if ((node.Type == ENodeType.Root) || (node.Type == ENodeType.Set))
            {
                return;
            }

            // Get extraction path
            if (fbdBackup.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            string TargetPath = fbdBackup.SelectedPath;

            // Extract the selected node and child nodes
            node.ExtractTo(mFile, TargetPath);
        }
Ejemplo n.º 2
0
        private void tvDirs_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }

            // Get the selected catalog node from tree node tag
            CCatalogNode node = (CCatalogNode)tvDirs.SelectedNode.Tag;

            if (node == null)
            {
                return;
            }
            if (node.Type != ENodeType.File)
            {
                return;
            }

            // Extract the selected node to a temporary folder
            string TargetPath = System.IO.Path.GetTempPath();

            node.ExtractTo(mFile, TargetPath);

            // Open the file
            System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(TargetPath + node.Name);
            psi.UseShellExecute         = true;
            psi.ErrorDialog             = true;
            psi.ErrorDialogParentHandle = this.Handle;
            try
            {
                System.Diagnostics.Process.Start(psi);
            }
            catch (Win32Exception ex)
            {
                MessageBox.Show(this, "Could not open the file '" + node.Name + "'." + ex.ToString(), "Backup Reader", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }