示例#1
0
        private void OnSaveAll(object sender, EventArgs e)
        {
            if (this.saveFilesDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            Stream input = File.OpenRead(this.openDialog.FileName);

            if (input == null)
            {
                return;
            }

            string basePath = this.saveFilesDialog.SelectedPath;

            Dictionary <uint, string> lookup =
                this.Manager.ActiveProject == null ? null : this.Manager.ActiveProject.FileHashLookup;

            SaveProgress.SaveAllSettings settings;
            settings.SaveFilesWithDuplicateNames = this.saveDuplicateNamesMenuItem.Checked;
            settings.SaveOnlyKnownFiles          = this.saveOnlyKnownFilesMenuItem.Checked;
            settings.DontOverwriteFiles          = this.dontOverwriteFilesMenuItem.Checked;
            settings.DontSaveAudioFiles          = this.dontSaveAudioFilesMenuItem.Checked;

            SaveProgress progress = new SaveProgress();

            progress.ShowSaveProgress(
                this,
                input,
                this.Archive,
                null, lookup,
                basePath,
                settings);

            input.Close();
        }
示例#2
0
        private void OnSaveAll(object sender, EventArgs e)
        {
            if (this.saveFilesDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            Stream input = File.OpenRead(this.openDialog.FileName);

            if (input == null)
            {
                return;
            }

            string basePath = this.saveFilesDialog.SelectedPath;

            Dictionary<uint, string> lookup =
                this.Manager.ActiveProject == null ? null : this.Manager.ActiveProject.FileHashLookup;

            SaveProgress.SaveAllSettings settings;
            settings.SaveFilesWithDuplicateNames = this.saveDuplicateNamesMenuItem.Checked;
            settings.SaveOnlyKnownFiles = this.saveOnlyKnownFilesMenuItem.Checked;
            settings.DontOverwriteFiles = this.dontOverwriteFilesMenuItem.Checked;
            settings.DontSaveAudioFiles = this.dontSaveAudioFilesMenuItem.Checked;

            SaveProgress progress = new SaveProgress();
            progress.ShowSaveProgress(
                this,
                input,
                this.Archive,
                null, lookup,
                basePath,
                settings);

            input.Close();
        }
示例#3
0
        private void OnSave(object sender, EventArgs e)
        {
            if (this.fileList.SelectedNode == null)
            {
                return;
            }

            string basePath;
            Dictionary<uint, string> lookup;
            List<BigFile.Entry> saving;

            SaveProgress.SaveAllSettings settings;
            settings.SaveFilesWithDuplicateNames = this.saveDuplicateNamesMenuItem.Checked;
            settings.SaveOnlyKnownFiles = false;
            settings.DontOverwriteFiles = this.dontOverwriteFilesMenuItem.Checked;
            settings.DontSaveAudioFiles = false; //this.dontSaveAudioFilesMenuItem.Checked;

            var root = this.fileList.SelectedNode;
            if (root.Nodes.Count == 0)
            {
                this.saveFileDialog.FileName = root.Text;

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

                var entry = (BigFile.Entry)root.Tag; 

                saving = new List<BigFile.Entry>();
                saving.Add(entry);

                lookup = new Dictionary<uint, string>();
                lookup.Add(entry.Name, Path.GetFileName(this.saveFileDialog.FileName));
                basePath = Path.GetDirectoryName(this.saveFileDialog.FileName);

                settings.DontOverwriteFiles = false;
            }
            else
            {
                if (this.saveFilesDialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                saving = new List<BigFile.Entry>();
                
                List<TreeNode> nodes = new List<TreeNode>();
                nodes.Add(root);

                while (nodes.Count > 0)
                {
                    var node = nodes[0];
                    nodes.RemoveAt(0);

                    if (node.Nodes.Count > 0)
                    {
                        foreach (TreeNode child in node.Nodes)
                        {
                            if (child.Nodes.Count > 0)
                            {
                                nodes.Add(child);
                            }
                            else
                            {
                                saving.Add((BigFile.Entry)child.Tag);
                            }
                        }
                    }
                }

                lookup = this.Manager.ActiveProject == null ? null : this.Manager.ActiveProject.FileHashLookup;
                basePath = this.saveFilesDialog.SelectedPath;
            }

            Stream input = File.OpenRead(this.openDialog.FileName);

            if (input == null)
            {
                return;
            }

            SaveProgress progress = new SaveProgress();
            progress.ShowSaveProgress(
                this,
                input,
                this.Archive,
                saving,
                lookup,
                basePath,
                settings);

            input.Close();
        }
示例#4
0
        private void OnSave(object sender, EventArgs e)
        {
            if (this.fileList.SelectedNode == null)
            {
                return;
            }

            string basePath;
            Dictionary <uint, string> lookup;
            List <BigFile.Entry>      saving;

            SaveProgress.SaveAllSettings settings;
            settings.SaveFilesWithDuplicateNames = this.saveDuplicateNamesMenuItem.Checked;
            settings.SaveOnlyKnownFiles          = false;
            settings.DontOverwriteFiles          = this.dontOverwriteFilesMenuItem.Checked;
            settings.DontSaveAudioFiles          = false; //this.dontSaveAudioFilesMenuItem.Checked;

            var root = this.fileList.SelectedNode;

            if (root.Nodes.Count == 0)
            {
                this.saveFileDialog.FileName = root.Text;

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

                var entry = (BigFile.Entry)root.Tag;

                saving = new List <BigFile.Entry>();
                saving.Add(entry);

                lookup = new Dictionary <uint, string>();
                lookup.Add(entry.Name, Path.GetFileName(this.saveFileDialog.FileName));
                basePath = Path.GetDirectoryName(this.saveFileDialog.FileName);

                settings.DontOverwriteFiles = false;
            }
            else
            {
                if (this.saveFilesDialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                saving = new List <BigFile.Entry>();

                List <TreeNode> nodes = new List <TreeNode>();
                nodes.Add(root);

                while (nodes.Count > 0)
                {
                    var node = nodes[0];
                    nodes.RemoveAt(0);

                    if (node.Nodes.Count > 0)
                    {
                        foreach (TreeNode child in node.Nodes)
                        {
                            if (child.Nodes.Count > 0)
                            {
                                nodes.Add(child);
                            }
                            else
                            {
                                saving.Add((BigFile.Entry)child.Tag);
                            }
                        }
                    }
                }

                lookup   = this.Manager.ActiveProject == null ? null : this.Manager.ActiveProject.FileHashLookup;
                basePath = this.saveFilesDialog.SelectedPath;
            }

            Stream input = File.OpenRead(this.openDialog.FileName);

            if (input == null)
            {
                return;
            }

            SaveProgress progress = new SaveProgress();

            progress.ShowSaveProgress(
                this,
                input,
                this.Archive,
                saving,
                lookup,
                basePath,
                settings);

            input.Close();
        }