Example #1
0
        private void exportFolderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog f = new FolderBrowserDialog();

            if (f.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            using (FileStream GCMStream = OpenGCMStream())
            {
                if (treeView1.SelectedNode is GCMNode GCMNode)
                {
                    for (int i = 0; i < GCMNode.Nodes.Count; i++)
                    {
                        if (GCMNode.Nodes[i] is FolderNode FolderNode)
                        {
                            GCM.ExportDirectory(FolderNode, GCMStream, Path.Combine(f.SelectedPath, FolderNode.Entry.Name));
                        }
                        else if (GCMNode.Nodes[i] is FileNode FileNode)
                        {
                            using (FileStream Output = File.Open(Path.Combine(f.SelectedPath, FileNode.Entry.Name), FileMode.Create, FileAccess.Write))
                            {
                                GCM.ExportFile(FileNode.Entry, GCMStream, Output);
                            }
                        }
                    }
                }
                else if (treeView1.SelectedNode is FolderNode FolderNode)
                {
                    GCM.ExportDirectory(FolderNode, GCMStream, f.SelectedPath);
                }
            }
        }